Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index f91cee200d0766f90e6ee3c0da1198b2ecf42297..a5b93b9b22ebf4ffc6ae62cc42114701efb0ea67 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -1287,6 +1287,7 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback( |
void StoreStubCompiler::GenerateStoreViaSetter( |
MacroAssembler* masm, |
+ Handle<HeapType> type, |
Handle<JSFunction> setter) { |
// ----------- S t a t e ------------- |
// -- eax : value |
@@ -1296,14 +1297,21 @@ void StoreStubCompiler::GenerateStoreViaSetter( |
// ----------------------------------- |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ Register receiver = edx; |
+ Register value = eax; |
// Save value register, so we can restore it later. |
- __ push(eax); |
+ __ push(value); |
if (!setter.is_null()) { |
// Call the JavaScript setter with receiver and value on the stack. |
- __ push(edx); |
- __ push(eax); |
+ if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
+ // Swap in the global receiver. |
+ __ mov(receiver, |
+ FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
+ } |
+ __ push(receiver); |
+ __ push(value); |
ParameterCount actual(1); |
ParameterCount expected(setter); |
__ InvokeFunction(setter, expected, actual, |
@@ -1423,6 +1431,7 @@ Register* KeyedStoreStubCompiler::registers() { |
void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
+ Handle<HeapType> type, |
Register receiver, |
Handle<JSFunction> getter) { |
{ |
@@ -1430,6 +1439,11 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
if (!getter.is_null()) { |
// Call the JavaScript getter with the receiver on the stack. |
+ if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
+ // Swap in the global receiver. |
+ __ mov(receiver, |
+ FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
+ } |
__ push(receiver); |
ParameterCount actual(0); |
ParameterCount expected(getter); |