Index: src/ic/ia32/handler-compiler-ia32.cc |
diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc |
index 2d2251ee421251663da844be3ae236c28d28e236..5ce3f0249206602dd3ae9d98690eec2b24f1b363 100644 |
--- a/src/ic/ia32/handler-compiler-ia32.cc |
+++ b/src/ic/ia32/handler-compiler-ia32.cc |
@@ -18,16 +18,21 @@ namespace internal { |
void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
- Register holder, int accessor_index, int expected_arguments) { |
+ Register holder, int accessor_index, int expected_arguments, |
+ Register scratch) { |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
if (accessor_index >= 0) { |
+ DCHECK(!holder.is(scratch)); |
+ DCHECK(!receiver.is(scratch)); |
// Call the JavaScript getter with the receiver on the stack. |
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
// Swap in the global receiver. |
- __ mov(receiver, |
+ // Do not overwrite receiver register, it can alias to holder register. |
+ __ mov(scratch, |
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
+ receiver = scratch; |
} |
__ push(receiver); |
ParameterCount actual(0); |
@@ -231,7 +236,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
- Register holder, int accessor_index, int expected_arguments) { |
+ Register holder, int accessor_index, int expected_arguments, |
+ Register scratch) { |
// ----------- S t a t e ------------- |
// -- esp[0] : return address |
// ----------------------------------- |
@@ -242,11 +248,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
__ push(value()); |
if (accessor_index >= 0) { |
+ DCHECK(!holder.is(scratch)); |
+ DCHECK(!receiver.is(scratch)); |
+ DCHECK(!value().is(scratch)); |
// Call the JavaScript setter with receiver and value on the stack. |
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
- // Swap in the global receiver. |
- __ mov(receiver, |
+ // Do not overwrite receiver register, it can alias to holder register. |
Igor Sheludko
2015/01/29 08:43:19
I think you can leave the
// Swap in the global
ulan
2015/01/29 09:08:07
Done.
|
+ __ mov(scratch, |
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
+ receiver = scratch; |
} |
__ push(receiver); |
__ push(value()); |