Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 4d9fc0de036991159a6d9f422bd19b84bac4737c..5350b6bb4e654784ea9b0697cc442593ec1022f8 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -2341,11 +2341,23 @@ void StubCompiler::GenerateBooleanCheck(Register object, Label* miss) { |
} |
-void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { |
+void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, |
+ Handle<JSFunction> function) { |
if (object->IsGlobalObject()) { |
const int argc = arguments().immediate(); |
const int receiver_offset = argc * kPointerSize; |
- __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
+ __ Move(r3, handle(function->context()->global_proxy())); |
+ __ str(r3, MemOperand(sp, receiver_offset)); |
+ } |
+} |
+ |
+ |
+void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, |
+ Register function) { |
+ if (object->IsGlobalObject()) { |
+ FetchGlobalProxy(masm(), r3, function); |
+ const int argc = arguments().immediate(); |
+ const int receiver_offset = argc * kPointerSize; |
__ str(r3, MemOperand(sp, receiver_offset)); |
} |
} |
@@ -2444,7 +2456,7 @@ void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
ASSERT(function.is(r1)); |
// Check that the function really is a function. |
GenerateFunctionCheck(function, r3, miss); |
- PatchGlobalProxy(object); |
+ PatchGlobalProxy(object, function); |
// Invoke the function. |
__ InvokeFunction(r1, arguments(), JUMP_FUNCTION, |
@@ -2562,6 +2574,15 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback( |
#define __ ACCESS_MASM(masm) |
+void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm, |
+ Register target, |
+ Register function) { |
+ __ ldr(target, FieldMemOperand(function, JSFunction::kContextOffset)); |
+ __ ldr(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX)); |
+ __ ldr(target, FieldMemOperand(target, GlobalObject::kGlobalReceiverOffset)); |
+} |
+ |
+ |
void StoreStubCompiler::GenerateStoreViaSetter( |
MacroAssembler* masm, |
Handle<JSFunction> setter) { |