Title: [96135] trunk
Revision
96135
Author
commit-qu...@webkit.org
Date
2011-09-27 11:19:01 -0700 (Tue, 27 Sep 2011)

Log Message

[v8] Code calling the typed array optimization script is fragile, depends on typed array hierarchy.

Install the flag, which indicates whether or not the optimization
script was executed, on the global object.

https://bugs.webkit.org/show_bug.cgi?id=68890

Patch by Ulan Degenbaev <u...@chromium.org> on 2011-09-27
Reviewed by Kenneth Russell.

* Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp:

Modified Paths

Diff

Modified: trunk/ChangeLog (96134 => 96135)


--- trunk/ChangeLog	2011-09-27 18:17:32 UTC (rev 96134)
+++ trunk/ChangeLog	2011-09-27 18:19:01 UTC (rev 96135)
@@ -1,3 +1,16 @@
+2011-09-27  Ulan Degenbaev  <u...@chromium.org>
+
+        [v8] Code calling the typed array optimization script is fragile, depends on typed array hierarchy.
+
+        Install the flag, which indicates whether or not the optimization
+        script was executed, on the global object.
+
+        https://bugs.webkit.org/show_bug.cgi?id=68890
+
+        Reviewed by Kenneth Russell.
+
+        * Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp:
+
 2011-09-27  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r96108, r96111, r96113, and r96116.

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


--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp	2011-09-27 18:17:32 UTC (rev 96134)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp	2011-09-27 18:19:01 UTC (rev 96135)
@@ -32,25 +32,24 @@
 
 namespace WebCore {
 
-const char fastSetFlagName[] = "webgl::FastSetFlag";
+// The random suffix helps to avoid name collision.
+const char fastSetFlagName[] = "TypedArray::FastSet::8NkZVq";
 
 bool fastSetInstalled(v8::Handle<v8::Object> array)
 {
-    // Use a hidden flag in the common prototype (ArrayBufferView) of all typed
-    // arrays as an indicator of whether the fast 'set' is installed or not.
-    v8::Handle<v8::Object> prototype = array->GetPrototype().As<v8::Object>();
-    v8::Handle<v8::Object> arrayBufferView = prototype->GetPrototype().As<v8::Object>();
+    // Use a hidden flag in the global object an indicator of whether the fast
+    // 'set' is installed or not.
+    v8::Handle<v8::Object> global = array->CreationContext()->Global();
     v8::Handle<v8::String> key = v8::String::New(fastSetFlagName);
-    v8::Handle<v8::Value> fastSetFlag = arrayBufferView->GetHiddenValue(key);
+    v8::Handle<v8::Value> fastSetFlag = global->GetHiddenValue(key);
     return !fastSetFlag.IsEmpty();
 }
 
 void installFastSet(v8::Handle<v8::Object> array)
 {
-    v8::Handle<v8::Object> prototype = array->GetPrototype().As<v8::Object>();
-    v8::Handle<v8::Object> arrayBufferView = prototype->GetPrototype().As<v8::Object>();
+    v8::Handle<v8::Object> global = array->CreationContext()->Global();
     v8::Handle<v8::String> key = v8::String::New(fastSetFlagName);
-    arrayBufferView->SetHiddenValue(key, v8::Boolean::New(true));
+    global->SetHiddenValue(key, v8::Boolean::New(true));
 
     String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js),
                   sizeof(V8ArrayBufferViewCustomScript_js));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to