Index: src/ia32/stub-cache-ia32.cc |
=================================================================== |
--- src/ia32/stub-cache-ia32.cc (revision 5484) |
+++ src/ia32/stub-cache-ia32.cc (working copy) |
@@ -273,7 +273,11 @@ |
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. |
+ __ cmp(Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)), |
+ Top::global()); |
+ __ 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. |
@@ -1600,7 +1604,8 @@ |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype(masm(), |
Context::STRING_FUNCTION_INDEX, |
- eax); |
+ eax, |
+ &miss); |
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
ebx, edx, edi, name, &miss); |
@@ -1665,7 +1670,8 @@ |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype(masm(), |
Context::STRING_FUNCTION_INDEX, |
- eax); |
+ eax, |
+ &miss); |
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
ebx, edx, edi, name, &miss); |
@@ -1793,7 +1799,7 @@ |
__ j(above_equal, &miss, not_taken); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::STRING_FUNCTION_INDEX, eax); |
+ masm(), Context::STRING_FUNCTION_INDEX, eax, &miss); |
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
ebx, edx, edi, name, &miss); |
} |
@@ -1813,7 +1819,7 @@ |
__ bind(&fast); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::NUMBER_FUNCTION_INDEX, eax); |
+ masm(), Context::NUMBER_FUNCTION_INDEX, eax, &miss); |
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
ebx, edx, edi, name, &miss); |
} |
@@ -1834,7 +1840,7 @@ |
__ bind(&fast); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::BOOLEAN_FUNCTION_INDEX, eax); |
+ masm(), Context::BOOLEAN_FUNCTION_INDEX, eax, &miss); |
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
ebx, edx, edi, name, &miss); |
} |