Index: src/x87/builtins-x87.cc |
diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc |
index 86f82fa4b5c778b59425400a617b1c6155cf1831..12b41084b411487c7a47f3b8f58678e57b0b24bc 100644 |
--- a/src/x87/builtins-x87.cc |
+++ b/src/x87/builtins-x87.cc |
@@ -151,14 +151,13 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0)); |
__ j(not_equal, &rt_call); |
- // Fall back to runtime if the original constructor and function differ. |
- __ cmp(edx, edi); |
+ // Verify that the original constructor is a JSFunction. |
+ __ CmpObjectType(edx, JS_FUNCTION_TYPE, ebx); |
__ j(not_equal, &rt_call); |
- // Verified that the constructor is a JSFunction. |
// Load the initial map and verify that it is in fact a map. |
- // edi: constructor |
- __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
+ // edx: original constructor |
+ __ mov(eax, FieldOperand(edx, JSFunction::kPrototypeOrInitialMapOffset)); |
// Will both indicate a NULL and a Smi |
__ JumpIfSmi(eax, &rt_call); |
// edi: constructor |
@@ -166,6 +165,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ CmpObjectType(eax, MAP_TYPE, ebx); |
__ j(not_equal, &rt_call); |
+ // Fall back to runtime if the expected base constructor and base |
+ // constructor differ. |
+ __ cmp(edi, FieldOperand(eax, Map::kConstructorOrBackPointerOffset)); |
+ __ j(not_equal, &rt_call); |
+ |
// Check that the constructor is not constructing a JSFunction (see |
// comments in Runtime_NewObject in runtime.cc). In which case the |
// initial map's instance type would be JS_FUNCTION_TYPE. |
@@ -194,7 +198,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ push(edx); |
__ push(edi); |
- __ push(edi); // constructor |
+ __ push(eax); // initial map |
__ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
__ pop(edi); |