Changeset 96135 in webkit


Ignore:
Timestamp:
Sep 27, 2011 11:19:01 AM (13 years ago)
Author:
commit-queue@webkit.org
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 <ulan@chromium.org> on 2011-09-27
Reviewed by Kenneth Russell.

  • Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp:
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r96126 r96135  
     12011-09-27  Ulan Degenbaev  <ulan@chromium.org>
     2
     3        [v8] Code calling the typed array optimization script is fragile, depends on typed array hierarchy.
     4
     5        Install the flag, which indicates whether or not the optimization
     6        script was executed, on the global object.
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=68890
     9
     10        Reviewed by Kenneth Russell.
     11
     12        * Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp:
     13
    1142011-09-27  Sheriff Bot  <webkit.review.bot@gmail.com>
    215
  • trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp

    r95901 r96135  
    3333namespace WebCore {
    3434
    35 const char fastSetFlagName[] = "webgl::FastSetFlag";
     35// The random suffix helps to avoid name collision.
     36const char fastSetFlagName[] = "TypedArray::FastSet::8NkZVq";
    3637
    3738bool fastSetInstalled(v8::Handle<v8::Object> array)
    3839{
    39     // Use a hidden flag in the common prototype (ArrayBufferView) of all typed
    40     // arrays as an indicator of whether the fast 'set' is installed or not.
    41     v8::Handle<v8::Object> prototype = array->GetPrototype().As<v8::Object>();
    42     v8::Handle<v8::Object> arrayBufferView = prototype->GetPrototype().As<v8::Object>();
     40    // Use a hidden flag in the global object an indicator of whether the fast
     41    // 'set' is installed or not.
     42    v8::Handle<v8::Object> global = array->CreationContext()->Global();
    4343    v8::Handle<v8::String> key = v8::String::New(fastSetFlagName);
    44     v8::Handle<v8::Value> fastSetFlag = arrayBufferView->GetHiddenValue(key);
     44    v8::Handle<v8::Value> fastSetFlag = global->GetHiddenValue(key);
    4545    return !fastSetFlag.IsEmpty();
    4646}
     
    4848void installFastSet(v8::Handle<v8::Object> array)
    4949{
    50     v8::Handle<v8::Object> prototype = array->GetPrototype().As<v8::Object>();
    51     v8::Handle<v8::Object> arrayBufferView = prototype->GetPrototype().As<v8::Object>();
     50    v8::Handle<v8::Object> global = array->CreationContext()->Global();
    5251    v8::Handle<v8::String> key = v8::String::New(fastSetFlagName);
    53     arrayBufferView->SetHiddenValue(key, v8::Boolean::New(true));
     52    global->SetHiddenValue(key, v8::Boolean::New(true));
    5453
    5554    String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js),
Note: See TracChangeset for help on using the changeset viewer.