Title: [136645] trunk/Source/WebCore
Revision
136645
Author
[email protected]
Date
2012-12-05 00:01:33 -0800 (Wed, 05 Dec 2012)

Log Message

[V8] Replace String::New("symbol") with String::NewSymbol("symbol") (part 2)
https://bugs.webkit.org/show_bug.cgi?id=104082

Reviewed by Adam Barth.

V8 can look up symbols faster than strings.

No tests. No change in behavior.

* bindings/v8/custom/V8ArrayBufferViewCustom.cpp:
(WebCore::getHiddenCopyMethod):
(WebCore::installHiddenCopyMethod):
* bindings/v8/custom/V8ArrayBufferViewCustom.h:
(WebCore::constructWebGLArray):
(WebCore::setWebGLArrayHelper):
* bindings/v8/custom/V8CustomXPathNSResolver.cpp:
(WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::DialogHandler::dialogCreated):
(WebCore::DialogHandler::returnValue):
* bindings/v8/custom/V8GeolocationCustom.cpp:
(WebCore::createPositionOptions):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::V8HTMLDocument::wrapInShadowObject):
(WebCore::V8HTMLDocument::openCallback):
* bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
(WebCore::V8HTMLImageElementConstructor::GetTemplate):
* bindings/v8/custom/V8SQLTransactionCustom.cpp:
(WebCore::V8SQLTransaction::executeSqlCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136644 => 136645)


--- trunk/Source/WebCore/ChangeLog	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/ChangeLog	2012-12-05 08:01:33 UTC (rev 136645)
@@ -1,3 +1,35 @@
+2012-12-04  Kentaro Hara  <[email protected]>
+
+        [V8] Replace String::New("symbol") with String::NewSymbol("symbol") (part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=104082
+
+        Reviewed by Adam Barth.
+
+        V8 can look up symbols faster than strings.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/custom/V8ArrayBufferViewCustom.cpp:
+        (WebCore::getHiddenCopyMethod):
+        (WebCore::installHiddenCopyMethod):
+        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+        (WebCore::constructWebGLArray):
+        (WebCore::setWebGLArrayHelper):
+        * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+        (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::DialogHandler::dialogCreated):
+        (WebCore::DialogHandler::returnValue):
+        * bindings/v8/custom/V8GeolocationCustom.cpp:
+        (WebCore::createPositionOptions):
+        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+        (WebCore::V8HTMLDocument::wrapInShadowObject):
+        (WebCore::V8HTMLDocument::openCallback):
+        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+        (WebCore::V8HTMLImageElementConstructor::GetTemplate):
+        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+        (WebCore::V8SQLTransaction::executeSqlCallback):
+
 2012-12-04  Elliott Sprehn  <[email protected]>
 
         Clicking a scrollbar unfocuses the current activeElement

Modified: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -37,7 +37,7 @@
 
 v8::Handle<v8::Value> getHiddenCopyMethod(v8::Handle<v8::Object> prototype)
 {
-    v8::Handle<v8::String> key = v8::String::New(hiddenCopyMethodName);
+    v8::Handle<v8::String> key = v8::String::NewSymbol(hiddenCopyMethodName);
     return prototype->GetHiddenValue(key);
 }
 
@@ -48,7 +48,7 @@
                   sizeof(V8ArrayBufferViewCustomScript_js));
     v8::Handle<v8::Script> script = v8::Script::Compile(v8String(source));
     v8::Handle<v8::Value> value = script->Run();
-    v8::Handle<v8::String> key = v8::String::New(hiddenCopyMethodName);
+    v8::Handle<v8::String> key = v8::String::NewSymbol(hiddenCopyMethodName);
     prototype->SetHiddenValue(key, value);
     return value;
 }

Modified: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2012-12-05 08:01:33 UTC (rev 136645)
@@ -171,7 +171,7 @@
         srcArray = args[0]->ToObject();
         if (srcArray.IsEmpty())
             return throwTypeError("Could not convert argument 0 to an array", args.GetIsolate());
-        len = toUInt32(srcArray->Get(v8::String::New("length")));
+        len = toUInt32(srcArray->Get(v8::String::NewSymbol("length")));
         doInstantiation = true;
     } else {
         bool ok = false;
@@ -244,7 +244,7 @@
         uint32_t offset = 0;
         if (args.Length() == 2)
             offset = toUInt32(args[1]);
-        uint32_t length = toUInt32(array->Get(v8::String::New("length")));
+        uint32_t length = toUInt32(array->Get(v8::String::NewSymbol("length")));
         if (!impl->checkInboundData(offset, length))
             return throwError(v8RangeError, outOfRangeLengthAndOffset, args.GetIsolate());
         bool copied = copyElements(args.Holder(), array, length, offset, args.GetIsolate());

Modified: trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -58,7 +58,7 @@
 String V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
 {
     v8::Handle<v8::Function> lookupNamespaceURIFunc;
-    v8::Handle<v8::String> lookupNamespaceURIName = v8::String::New("lookupNamespaceURI");
+    v8::Handle<v8::String> lookupNamespaceURIName = v8::String::NewSymbol("lookupNamespaceURI");
 
     // Check if the resolver has a function property named lookupNamespaceURI.
     if (m_resolver->Has(lookupNamespaceURIName)) {

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -403,7 +403,7 @@
     if (m_dialogArguments.IsEmpty())
         return;
     v8::Context::Scope scope(m_dialogContext);
-    m_dialogContext->Global()->Set(v8::String::New("dialogArguments"), m_dialogArguments);
+    m_dialogContext->Global()->Set(v8::String::NewSymbol("dialogArguments"), m_dialogArguments);
 }
 
 inline v8::Handle<v8::Value> DialogHandler::returnValue() const
@@ -411,7 +411,7 @@
     if (m_dialogContext.IsEmpty())
         return v8::Undefined();
     v8::Context::Scope scope(m_dialogContext);
-    v8::Handle<v8::Value> returnValue = m_dialogContext->Global()->Get(v8::String::New("returnValue"));
+    v8::Handle<v8::Value> returnValue = m_dialogContext->Global()->Get(v8::String::NewSymbol("returnValue"));
     if (returnValue.IsEmpty())
         return v8::Undefined();
     return returnValue;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -61,7 +61,7 @@
     // - If the getter or the property's valueOf method throws an exception, we
     //   quit so as not to risk overwriting the exception.
     // - If the value is absent or undefined, we don't override the default.
-    v8::Local<v8::Value> enableHighAccuracyValue = object->Get(v8::String::New("enableHighAccuracy"));
+    v8::Local<v8::Value> enableHighAccuracyValue = object->Get(v8::String::NewSymbol("enableHighAccuracy"));
     if (enableHighAccuracyValue.IsEmpty()) {
         succeeded = false;
         return 0;
@@ -75,7 +75,7 @@
         options->setEnableHighAccuracy(enableHighAccuracyBoolean->Value());
     }
 
-    v8::Local<v8::Value> timeoutValue = object->Get(v8::String::New("timeout"));
+    v8::Local<v8::Value> timeoutValue = object->Get(v8::String::NewSymbol("timeout"));
     if (timeoutValue.IsEmpty()) {
         succeeded = false;
         return 0;
@@ -99,7 +99,7 @@
         }
     }
 
-    v8::Local<v8::Value> maximumAgeValue = object->Get(v8::String::New("maximumAge"));
+    v8::Local<v8::Value> maximumAgeValue = object->Get(v8::String::NewSymbol("maximumAge"));
     if (maximumAgeValue.IsEmpty()) {
         succeeded = false;
         return 0;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -59,7 +59,7 @@
         shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
         if (shadowTemplate.IsEmpty())
             return v8::Local<v8::Object>();
-        shadowTemplate->SetClassName(v8::String::New("HTMLDocument"));
+        shadowTemplate->SetClassName(v8::String::NewSymbol("HTMLDocument"));
         shadowTemplate->Inherit(V8HTMLDocument::GetTemplate());
         shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount);
     }
@@ -145,7 +145,7 @@
                 return v8::Undefined();
             v8::Local<v8::Object> global = context->Global();
             // Get the open property of the global object.
-            v8::Local<v8::Value> function = global->Get(v8::String::New("open"));
+            v8::Local<v8::Value> function = global->Get(v8::String::NewSymbol("open"));
             // If the open property is not a function throw a type error.
             if (!function->IsFunction())
                 return throwTypeError("open is not a function", args.GetIsolate());

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -94,7 +94,7 @@
 
     v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
     instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
-    result->SetClassName(v8::String::New("HTMLImageElement"));
+    result->SetClassName(v8::String::NewSymbol("HTMLImageElement"));
     result->Inherit(V8HTMLImageElement::GetTemplate());
 
     cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);

Modified: trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp (136644 => 136645)


--- trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp	2012-12-05 07:07:51 UTC (rev 136644)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp	2012-12-05 08:01:33 UTC (rev 136645)
@@ -63,7 +63,7 @@
 
         uint32_t sqlArgsLength = 0;
         v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject();
-        V8TRYCATCH(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8::String::New("length")));
+        V8TRYCATCH(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8::String::NewSymbol("length")));
 
         if (isUndefinedOrNull(length))
             sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to