Index: src/ic/mips/handler-compiler-mips.cc |
diff --git a/src/ic/mips/handler-compiler-mips.cc b/src/ic/mips/handler-compiler-mips.cc |
index 6e2903d428fd0131ffb3c1be8244d0b7f02630e1..ba81dfe3a05b82320305e9adee4f1454b20e90dd 100644 |
--- a/src/ic/mips/handler-compiler-mips.cc |
+++ b/src/ic/mips/handler-compiler-mips.cc |
@@ -559,12 +559,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback( |
DCHECK(!scratch3().is(reg)); |
DCHECK(!scratch4().is(reg)); |
__ push(receiver()); |
- if (heap()->InNewSpace(callback->data())) { |
- __ li(scratch3(), callback); |
- __ lw(scratch3(), |
- FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); |
+ Handle<Object> data(callback->data(), isolate()); |
+ if (data->IsUndefined() || data->IsSmi()) { |
+ __ li(scratch3(), data); |
} else { |
- __ li(scratch3(), Handle<Object>(callback->data(), isolate())); |
+ 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(scratch3(), cell); |
} |
__ Subu(sp, sp, 6 * kPointerSize); |
__ sw(scratch3(), MemOperand(sp, 5 * kPointerSize)); |