Index: src/stub-cache-arm.cc |
=================================================================== |
--- src/stub-cache-arm.cc (revision 599) |
+++ src/stub-cache-arm.cc (working copy) |
@@ -220,15 +220,15 @@ |
const int argc = arguments().immediate(); |
- // Get the receiver of the function from the stack into r1. |
- __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
+ // Get the receiver of the function from the stack into r0. |
+ __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
// Check that the receiver isn't a smi. |
- __ tst(r1, Operand(kSmiTagMask)); |
+ __ tst(r0, Operand(kSmiTagMask)); |
__ b(eq, &miss); |
// Do the right check and compute the holder register. |
Register reg = |
- __ CheckMaps(JSObject::cast(object), r1, holder, r3, r2, &miss); |
+ __ CheckMaps(JSObject::cast(object), r0, holder, r3, r2, &miss); |
GenerateFastPropertyLoad(masm(), r1, reg, holder, index); |
// Check that the function really is a function. |
@@ -240,8 +240,11 @@ |
__ cmp(r2, Operand(JS_FUNCTION_TYPE)); |
__ b(ne, &miss); |
+ // Patch the receiver on the stack with the global proxy if |
+ // necessary. |
if (object->IsGlobalObject()) { |
- // TODO(120): Patch receiver with the global proxy. |
+ __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
+ __ str(r3, MemOperand(sp, argc * kPointerSize)); |
} |
// Invoke the function. |
@@ -278,10 +281,21 @@ |
__ b(eq, &miss); |
} |
+ // Make sure that it's okay not to patch the on stack receiver |
+ // unless we're doing a receiver map check. |
+ ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); |
+ |
switch (check) { |
case RECEIVER_MAP_CHECK: |
// Check that the maps haven't changed. |
__ CheckMaps(JSObject::cast(object), r1, holder, r3, r2, &miss); |
+ |
+ // Patch the receiver on the stack with the global proxy if |
+ // necessary. |
+ if (object->IsGlobalObject()) { |
+ __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
+ __ str(r3, MemOperand(sp, argc * kPointerSize)); |
+ } |
break; |
case STRING_CHECK: |
@@ -353,10 +367,6 @@ |
__ mov(r1, Operand(Handle<JSFunction>(function))); |
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
- if (object->IsGlobalObject()) { |
- // TODO(120): Patch receiver with the global proxy. |
- } |
- |
// Jump to the cached code (tail call). |
Handle<Code> code(function->code()); |
ParameterCount expected(function->shared()->formal_parameter_count()); |