Index: src/ic/x87/handler-compiler-x87.cc |
diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc |
index 1110410771d2d277c65dfe5a251b5952bcdf690d..a707026a14de7776ac8b2c7decd1194eb94543b7 100644 |
--- a/src/ic/x87/handler-compiler-x87.cc |
+++ b/src/ic/x87/handler-compiler-x87.cc |
@@ -568,12 +568,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback( |
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
__ push(receiver()); // receiver |
// Push data from ExecutableAccessorInfo. |
- if (isolate()->heap()->InNewSpace(callback->data())) { |
- DCHECK(!scratch2().is(reg)); |
- __ mov(scratch2(), Immediate(callback)); |
- __ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset)); |
+ Handle<Object> data(callback->data(), isolate()); |
+ if (data->IsUndefined() || data->IsSmi()) { |
+ __ push(Immediate(data)); |
} else { |
- __ push(Immediate(Handle<Object>(callback->data(), isolate()))); |
+ DCHECK(!scratch2().is(reg)); |
+ Handle<WeakCell> cell = |
+ isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
+ // The callback is alive if this instruction is executed, |
+ // so the weak cell is not cleared and points to data. |
+ __ GetWeakValue(scratch2(), cell); |
+ __ push(scratch2()); |
} |
__ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
// ReturnValue default value |