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 356244ee5377184face7d53615706f60e2ddb406..67552bd6b982ad52c3d5dc2c3375820d3e3caa52 100644 |
--- a/src/ic/ia32/handler-compiler-ia32.cc |
+++ b/src/ic/ia32/handler-compiler-ia32.cc |
@@ -88,22 +88,27 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
- MacroAssembler* masm, int index, Register prototype, Label* miss) { |
+ MacroAssembler* masm, int index, Register prototype, Register scratch, |
+ Label* miss) { |
// Get the global function with the given index. |
- Handle<JSFunction> function( |
- JSFunction::cast(masm->isolate()->native_context()->get(index))); |
+ Isolate* isolate = masm->isolate(); |
+ Handle<JSFunction> jsfunction( |
+ JSFunction::cast(isolate->native_context()->get(index))); |
+ Handle<WeakCell> cell = isolate->factory()->NewWeakCell(jsfunction); |
// Check we're still in the same context. |
- Register scratch = prototype; |
+ Register function = prototype; |
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); |
__ mov(scratch, Operand(esi, offset)); |
__ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
- __ cmp(Operand(scratch, Context::SlotOffset(index)), function); |
+ __ mov(function, Operand(scratch, Context::SlotOffset(index))); |
+ __ CmpWeakValue(function, cell, scratch); |
__ j(not_equal, miss); |
// Load its initial map. The global functions all have initial maps. |
- __ Move(prototype, Immediate(Handle<Map>(function->initial_map()))); |
+ __ mov(scratch, |
+ FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
// Load the prototype from the initial map. |
- __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); |
+ __ mov(prototype, FieldOperand(scratch, Map::kPrototypeOffset)); |
} |