Reviewers: Christian Plesner Hansen, antonm,

Description:
Stub Cache: speed up load callback accessor by allocating data handle on
stack.

Please review this at http://codereview.chromium.org/160041

Affected files:
   M src/arm/stub-cache-arm.cc
   M src/ia32/stub-cache-ia32.cc
   M src/stub-cache.cc


Index: src/arm/stub-cache-arm.cc
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc
index  
d6650c9862572a9a8a1a9014324b0491e39daa29..cfb75b2609d5c4fe36fb130b5d79bd873501426b
  
100644
--- a/src/arm/stub-cache-arm.cc
+++ b/src/arm/stub-cache-arm.cc
@@ -467,15 +467,17 @@ void StubCompiler::GenerateLoadCallback(JSObject*  
object,

    // Push the arguments on the JS stack of the caller.
    __ push(receiver);  // receiver
+  __ push(reg);  // holder
    __ mov(ip, Operand(Handle<AccessorInfo>(callback)));  // callback data
    __ push(ip);
+  __ ldr(reg, FieldMemOperand(ip, AccessorInfo::kDataOffset));
+  __ push(reg);
    __ push(name_reg);  // name
-  __ push(reg);  // holder

    // Do tail-call to the runtime system.
    ExternalReference load_callback_property =
        ExternalReference(IC_Utility(IC::kLoadCallbackProperty));
-  __ TailCallRuntime(load_callback_property, 4);
+  __ TailCallRuntime(load_callback_property, 5);
  }


Index: src/ia32/stub-cache-ia32.cc
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
index  
e47ad1c072ff22603fee86e2e03fee7ea73295c9..fed2ef5cf4a9834f2eb904f27c463939088ef932
  
100644
--- a/src/ia32/stub-cache-ia32.cc
+++ b/src/ia32/stub-cache-ia32.cc
@@ -447,15 +447,17 @@ void StubCompiler::GenerateLoadCallback(JSObject*  
object,
    // Push the arguments on the JS stack of the caller.
    __ pop(scratch2);  // remove return address
    __ push(receiver);  // receiver
-  __ push(Immediate(Handle<AccessorInfo>(callback)));  // callback data
-  __ push(name_reg);  // name
    __ push(reg);  // holder
+  __ mov(reg, Immediate(Handle<AccessorInfo>(callback)));  // callback data
+  __ push(reg);
+  __ push(FieldOperand(reg, AccessorInfo::kDataOffset));
+  __ push(name_reg);  // name
    __ push(scratch2);  // restore return address

    // Do tail-call to the runtime system.
    ExternalReference load_callback_property =
        ExternalReference(IC_Utility(IC::kLoadCallbackProperty));
-  __ TailCallRuntime(load_callback_property, 4);
+  __ TailCallRuntime(load_callback_property, 5);
  }


Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index  
7ca2677d58bba1c9f7b002f7203d5b4d560152db..859514885af73bc90352a1164a6c6b853ffd8248
  
100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -736,22 +736,22 @@ Handle<Code> ComputeCallMiss(int argc) {

  Object* LoadCallbackProperty(Arguments args) {
    Handle<JSObject> recv = args.at<JSObject>(0);
-  AccessorInfo* callback = AccessorInfo::cast(args[1]);
+  Handle<JSObject> holder = args.at<JSObject>(1);
+  AccessorInfo* callback = AccessorInfo::cast(args[2]);
+  Handle<Object> data = args.at<Object>(3);
    Address getter_address = v8::ToCData<Address>(callback->getter());
    v8::AccessorGetter fun =  
FUNCTION_CAST<v8::AccessorGetter>(getter_address);
    ASSERT(fun != NULL);
-  Handle<String> name = args.at<String>(2);
-  Handle<JSObject> holder = args.at<JSObject>(3);
-  HandleScope scope;
-  Handle<Object> data(callback->data());
-  LOG(ApiNamedPropertyAccess("load", *recv, *name));
+  Handle<String> name = args.at<String>(4);
    // NOTE: If we can align the structure of an AccessorInfo with the
    // locations of the arguments to this function maybe we don't have
    // to explicitly create the structure but can just pass a pointer
    // into the stack.
+  LOG(ApiNamedPropertyAccess("load", *recv, *name));
    v8::AccessorInfo info(v8::Utils::ToLocal(recv),
                          v8::Utils::ToLocal(data),
                          v8::Utils::ToLocal(holder));
+  HandleScope scope;
    v8::Handle<v8::Value> result;
    {
      // Leaving JavaScript.



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to