Changeset 87837 in webkit


Ignore:
Timestamp:
Jun 1, 2011, 12:52:13 PM (14 years ago)
Author:
kbr@google.com
Message:

2011-06-01 Kenneth Russell <kbr@google.com>

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):
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87828 r87837  
     12011-06-01  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Nate Chapin.
     4
     5        [V8] Optimize fetches of indexed properties in custom bindings
     6        https://bugs.webkit.org/show_bug.cgi?id=61821
     7
     8        Avoid allocating garbage in affected custom bindings. This speeds
     9        up one test case by at least a factor of two. No new tests;
     10        covered by existing layout tests (typed array and otherwise).
     11
     12        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
     13        (WebCore::constructWebGLArray):
     14        (WebCore::setWebGLArrayHelper):
     15        * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
     16        (WebCore::V8InspectorFrontendHost::showContextMenuCallback):
     17        * bindings/v8/custom/V8MessagePortCustom.cpp:
     18        (WebCore::getMessagePortArray):
     19        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
     20        (WebCore::jsArrayToFloatArray):
     21        (WebCore::jsArrayToIntArray):
     22
    1232011-06-01  Andras Becsi  <abecsi@webkit.org>
    224
  • trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h

    r78407 r87837  
    150150        // Need to copy the incoming array into the newly created ArrayBufferView.
    151151        for (unsigned i = 0; i < len; i++) {
    152             v8::Local<v8::Value> val = srcArray->Get(v8::Integer::NewFromUnsigned(i));
     152            v8::Local<v8::Value> val = srcArray->Get(i);
    153153            array->set(i, val->NumberValue());
    154154        }
     
    197197        else
    198198            for (uint32_t i = 0; i < length; i++)
    199                 impl->set(offset + i, array->Get(v8::Integer::NewFromUnsigned(i))->NumberValue());
     199                impl->set(offset + i, array->Get(i)->NumberValue());
    200200
    201201        return v8::Undefined();
  • trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp

    r84921 r87837  
    8484
    8585    for (size_t i = 0; i < array->Length(); ++i) {
    86         v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(v8::Integer::New(i)));
     86        v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(i));
    8787        v8::Local<v8::Value> type = item->Get(v8::String::New("type"));
    8888        v8::Local<v8::Value> id = item->Get(v8::String::New("id"));
  • trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp

    r86899 r87837  
    9090    // Validate the passed array of ports.
    9191    for (unsigned int i = 0; i < length; ++i) {
    92         v8::Local<v8::Value> port = ports->Get(v8::Integer::New(i));
     92        v8::Local<v8::Value> port = ports->Get(i);
    9393        // Validation of non-null objects, per HTML5 spec 8.3.3.
    9494        if (isUndefinedOrNull(port)) {
  • trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r79011 r87837  
    7878        return 0;
    7979    for (uint32_t i = 0; i < len; i++) {
    80         v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
     80        v8::Local<v8::Value> val = array->Get(i);
    8181        if (!val->IsNumber()) {
    8282            fastFree(data);
     
    9797        return 0;
    9898    for (uint32_t i = 0; i < len; i++) {
    99         v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
     99        v8::Local<v8::Value> val = array->Get(i);
    100100        bool ok;
    101101        int ival = toInt32(val, ok);
Note: See TracChangeset for help on using the changeset viewer.