Title: [87837] trunk/Source/WebCore
Revision
87837
Author
[email protected]
Date
2011-06-01 12:52:13 -0700 (Wed, 01 Jun 2011)

Log Message

2011-06-01  Kenneth Russell  <[email protected]>

        Reviewed by Nate Chapin.

        [V8] Optimize fetches of indexed properties in custom bindings
        https://bugs.webkit.org/show_bug.cgi?id=61821

        Avoid allocating garbage in affected custom bindings. This speeds
        up one test case by at least a factor of two. No new tests;
        covered by existing layout tests (typed array and otherwise).

        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
        (WebCore::constructWebGLArray):
        (WebCore::setWebGLArrayHelper):
        * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
        (WebCore::V8InspectorFrontendHost::showContextMenuCallback):
        * bindings/v8/custom/V8MessagePortCustom.cpp:
        (WebCore::getMessagePortArray):
        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
        (WebCore::jsArrayToFloatArray):
        (WebCore::jsArrayToIntArray):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87836 => 87837)


--- trunk/Source/WebCore/ChangeLog	2011-06-01 19:20:04 UTC (rev 87836)
+++ trunk/Source/WebCore/ChangeLog	2011-06-01 19:52:13 UTC (rev 87837)
@@ -1,3 +1,25 @@
+2011-06-01  Kenneth Russell  <[email protected]>
+
+        Reviewed by Nate Chapin.
+
+        [V8] Optimize fetches of indexed properties in custom bindings
+        https://bugs.webkit.org/show_bug.cgi?id=61821
+
+        Avoid allocating garbage in affected custom bindings. This speeds
+        up one test case by at least a factor of two. No new tests;
+        covered by existing layout tests (typed array and otherwise).
+
+        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+        (WebCore::constructWebGLArray):
+        (WebCore::setWebGLArrayHelper):
+        * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
+        (WebCore::V8InspectorFrontendHost::showContextMenuCallback):
+        * bindings/v8/custom/V8MessagePortCustom.cpp:
+        (WebCore::getMessagePortArray):
+        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+        (WebCore::jsArrayToFloatArray):
+        (WebCore::jsArrayToIntArray):
+
 2011-06-01  Andras Becsi  <[email protected]>
 
         Reviewed by Csaba Osztrogonác.

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


--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2011-06-01 19:20:04 UTC (rev 87836)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2011-06-01 19:52:13 UTC (rev 87837)
@@ -149,7 +149,7 @@
     if (!srcArray.IsEmpty()) {
         // Need to copy the incoming array into the newly created ArrayBufferView.
         for (unsigned i = 0; i < len; i++) {
-            v8::Local<v8::Value> val = srcArray->Get(v8::Integer::NewFromUnsigned(i));
+            v8::Local<v8::Value> val = srcArray->Get(i);
             array->set(i, val->NumberValue());
         }
     }
@@ -196,7 +196,7 @@
             V8Proxy::setDOMException(INDEX_SIZE_ERR);
         else
             for (uint32_t i = 0; i < length; i++)
-                impl->set(offset + i, array->Get(v8::Integer::NewFromUnsigned(i))->NumberValue());
+                impl->set(offset + i, array->Get(i)->NumberValue());
 
         return v8::Undefined();
     }

Modified: trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp (87836 => 87837)


--- trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp	2011-06-01 19:20:04 UTC (rev 87836)
+++ trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp	2011-06-01 19:52:13 UTC (rev 87837)
@@ -83,7 +83,7 @@
     Vector<ContextMenuItem*> items;
 
     for (size_t i = 0; i < array->Length(); ++i) {
-        v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(v8::Integer::New(i)));
+        v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(i));
         v8::Local<v8::Value> type = item->Get(v8::String::New("type"));
         v8::Local<v8::Value> id = item->Get(v8::String::New("id"));
         v8::Local<v8::Value> label = item->Get(v8::String::New("label"));

Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp (87836 => 87837)


--- trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp	2011-06-01 19:20:04 UTC (rev 87836)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp	2011-06-01 19:52:13 UTC (rev 87837)
@@ -89,7 +89,7 @@
 
     // Validate the passed array of ports.
     for (unsigned int i = 0; i < length; ++i) {
-        v8::Local<v8::Value> port = ports->Get(v8::Integer::New(i));
+        v8::Local<v8::Value> port = ports->Get(i);
         // Validation of non-null objects, per HTML5 spec 8.3.3.
         if (isUndefinedOrNull(port)) {
             throwError(INVALID_STATE_ERR);

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp (87836 => 87837)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp	2011-06-01 19:20:04 UTC (rev 87836)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp	2011-06-01 19:52:13 UTC (rev 87837)
@@ -77,7 +77,7 @@
     if (!tryFastMalloc(len * sizeof(float)).getValue(data))
         return 0;
     for (uint32_t i = 0; i < len; i++) {
-        v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
+        v8::Local<v8::Value> val = array->Get(i);
         if (!val->IsNumber()) {
             fastFree(data);
             return 0;
@@ -96,7 +96,7 @@
     if (!tryFastMalloc(len * sizeof(int)).getValue(data))
         return 0;
     for (uint32_t i = 0; i < len; i++) {
-        v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
+        v8::Local<v8::Value> val = array->Get(i);
         bool ok;
         int ival = toInt32(val, ok);
         if (!ok) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to