| Index: src/x64/stub-cache-x64.cc
|
| ===================================================================
|
| --- src/x64/stub-cache-x64.cc (revision 5484)
|
| +++ src/x64/stub-cache-x64.cc (working copy)
|
| @@ -216,7 +216,12 @@
|
|
|
|
|
| void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
|
| - MacroAssembler* masm, int index, Register prototype) {
|
| + MacroAssembler* masm, int index, Register prototype, Label* miss) {
|
| + // Check we're still in the same context.
|
| + __ Move(prototype, Top::global());
|
| + __ cmpq(Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)),
|
| + prototype);
|
| + __ j(not_equal, miss);
|
| // Get the global function with the given index.
|
| JSFunction* function = JSFunction::cast(Top::global_context()->get(index));
|
| // Load its initial map. The global functions all have initial maps.
|
| @@ -913,7 +918,7 @@
|
| __ j(above_equal, &miss);
|
| // Check that the maps starting from the prototype haven't changed.
|
| GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::STRING_FUNCTION_INDEX, rax);
|
| + masm(), Context::STRING_FUNCTION_INDEX, rax, &miss);
|
| CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder,
|
| rbx, rdx, rdi, name, &miss);
|
| }
|
| @@ -932,7 +937,7 @@
|
| __ bind(&fast);
|
| // Check that the maps starting from the prototype haven't changed.
|
| GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::NUMBER_FUNCTION_INDEX, rax);
|
| + masm(), Context::NUMBER_FUNCTION_INDEX, rax, &miss);
|
| CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder,
|
| rbx, rdx, rdi, name, &miss);
|
| }
|
| @@ -953,7 +958,7 @@
|
| __ bind(&fast);
|
| // Check that the maps starting from the prototype haven't changed.
|
| GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::BOOLEAN_FUNCTION_INDEX, rax);
|
| + masm(), Context::BOOLEAN_FUNCTION_INDEX, rax, &miss);
|
| CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder,
|
| rbx, rdx, rdi, name, &miss);
|
| }
|
| @@ -1313,7 +1318,8 @@
|
| // Check that the maps starting from the prototype haven't changed.
|
| GenerateDirectLoadGlobalFunctionPrototype(masm(),
|
| Context::STRING_FUNCTION_INDEX,
|
| - rax);
|
| + rax,
|
| + &miss);
|
| ASSERT(object != holder);
|
| CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder,
|
| rbx, rdx, rdi, name, &miss);
|
| @@ -1383,7 +1389,8 @@
|
| // Check that the maps starting from the prototype haven't changed.
|
| GenerateDirectLoadGlobalFunctionPrototype(masm(),
|
| Context::STRING_FUNCTION_INDEX,
|
| - rax);
|
| + rax,
|
| + &miss);
|
| ASSERT(object != holder);
|
| CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder,
|
| rbx, rdx, rdi, name, &miss);
|
|
|