Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index ef3df659eb7a94d9801d4687f311000a02f9af40..1cb7cbf3f491215128554f8601cd40adbff1c668 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -106,6 +106,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// -- rax: number of arguments |
// -- rdi: constructor function |
// -- rbx: allocation site or undefined |
+ // -- r11: original constructor |
// ----------------------------------- |
// Should never create mementos for api functions. |
@@ -127,9 +128,13 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// Push the function to invoke on the stack. |
__ Push(rdi); |
+ Label rt_call; |
+ __ cmpp(r11, rdi); |
+ __ j(not_equal, &rt_call); |
+ |
// Try to allocate the object without transitioning into C code. If any of |
// the preconditions is not met, the code bails out to the runtime call. |
- Label rt_call, allocated; |
+ Label allocated; |
if (FLAG_inline_new) { |
Label undo_allocation; |
@@ -357,10 +362,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
__ movp(rdi, Operand(rsp, offset)); |
__ Push(rdi); |
+ __ Push(r11); |
if (create_memento) { |
- __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2); |
+ __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 3); |
} else { |
- __ CallRuntime(Runtime::kNewObject, 1); |
+ __ CallRuntime(Runtime::kNewObject, 2); |
} |
__ movp(rbx, rax); // store result in rbx |