Title: [149249] trunk/Source/WebCore
Revision
149249
Author
[email protected]
Date
2013-04-27 17:09:21 -0700 (Sat, 27 Apr 2013)

Log Message

WebGL shouldn't allocate a "length" Identifier just to move some numbers around
https://bugs.webkit.org/show_bug.cgi?id=115317

Reviewed by Dean Jackson.

Saw this while debugging an ammo.js bug.

* bindings/js/JSArrayBufferViewHelper.h:
(WebCore::setWebGLArrayWithTypedArrayArgument):
(WebCore::setWebGLArrayHelper):
(WebCore::constructArrayBufferViewWithTypedArrayArgument):
(WebCore::constructArrayBufferView):
* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::toVector): Use the pre-computed "length" identifier instead of
allocating a new one for each vector operation. There are lots more
optimizations we could do here. This is a start.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149248 => 149249)


--- trunk/Source/WebCore/ChangeLog	2013-04-27 23:14:41 UTC (rev 149248)
+++ trunk/Source/WebCore/ChangeLog	2013-04-28 00:09:21 UTC (rev 149249)
@@ -1,3 +1,22 @@
+2013-04-27  Geoffrey Garen  <[email protected]>
+
+        WebGL shouldn't allocate a "length" Identifier just to move some numbers around
+        https://bugs.webkit.org/show_bug.cgi?id=115317
+
+        Reviewed by Dean Jackson.
+
+        Saw this while debugging an ammo.js bug.
+
+        * bindings/js/JSArrayBufferViewHelper.h:
+        (WebCore::setWebGLArrayWithTypedArrayArgument):
+        (WebCore::setWebGLArrayHelper):
+        (WebCore::constructArrayBufferViewWithTypedArrayArgument):
+        (WebCore::constructArrayBufferView):
+        * bindings/js/JSWebGLRenderingContextCustom.cpp:
+        (WebCore::toVector): Use the pre-computed "length" identifier instead of
+        allocating a new one for each vector operation. There are lots more
+        optimizations we could do here. This is a start.
+
 2013-04-27  Anders Carlsson  <[email protected]>
 
         Remove two more StorageTask types

Modified: trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h (149248 => 149249)


--- trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h	2013-04-27 23:14:41 UTC (rev 149248)
+++ trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h	2013-04-28 00:09:21 UTC (rev 149249)
@@ -114,7 +114,7 @@
     if (exec->argumentCount() == 2)
         offset = exec->argument(1).toInt32(exec);
 
-    uint32_t length = asObject(exec->argument(0))->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
+    uint32_t length = asObject(exec->argument(0))->get(exec, exec->vm().propertyNames->length).toUInt32(exec);
 
     if (!(copyTypedArrayBuffer<C, T>(impl, array.get(), length, offset)))
         throwError(exec, createRangeError(exec, "Index is out of range."));
@@ -138,7 +138,7 @@
         uint32_t offset = 0;
         if (exec->argumentCount() == 2)
             offset = exec->argument(1).toInt32(exec);
-        uint32_t length = array->get(exec, JSC::Identifier(exec, "length")).toInt32(exec);
+        uint32_t length = array->get(exec, exec->vm().propertyNames->length).toInt32(exec);
         if (!impl->checkInboundData(offset, length))
             throwError(exec, createRangeError(exec, "Index is out of range."));
         else {
@@ -169,7 +169,7 @@
     if (sourceType == ArrayBufferView::TypeDataView)
         return 0;
 
-    uint32_t length = asObject(exec->argument(0))->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
+    uint32_t length = asObject(exec->argument(0))->get(exec, exec->vm().propertyNames->length).toUInt32(exec);
     RefPtr<C> array = C::createUninitialized(length);
     if (!array) {
         throwError(exec, createRangeError(exec, tooLargeSize));
@@ -244,7 +244,7 @@
             return view;
 
         JSC::JSObject* srcArray = asObject(exec->argument(0));
-        uint32_t length = srcArray->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
+        uint32_t length = srcArray->get(exec, exec->vm().propertyNames->length).toUInt32(exec);
         RefPtr<C> array = C::createUninitialized(length);
         if (!array) {
             throwError(exec, createRangeError(exec, tooLargeSize));

Modified: trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp (149248 => 149249)


--- trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp	2013-04-27 23:14:41 UTC (rev 149248)
+++ trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp	2013-04-28 00:09:21 UTC (rev 149249)
@@ -429,7 +429,7 @@
         return false;
 
     JSC::JSObject* object = asObject(value);
-    int32_t length = object->get(exec, JSC::Identifier(exec, "length")).toInt32(exec);
+    int32_t length = object->get(exec, exec->vm().propertyNames->length).toInt32(exec);
 
     if (!vector.tryReserveCapacity(length))
         return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to