Index: src/builtins/s390/builtins-s390.cc |
diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc |
index 37ab9ee387088db17c351620051e978c2e54c5e2..b2d2352c1bd4bd49815cef524f7c74e826e68289 100644 |
--- a/src/builtins/s390/builtins-s390.cc |
+++ b/src/builtins/s390/builtins-s390.cc |
@@ -1236,12 +1236,14 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
} |
// static |
-void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
+void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
+ MacroAssembler* masm, CallableType construct_type) { |
// ----------- S t a t e ------------- |
// -- r2 : argument count (not including receiver) |
// -- r5 : new target |
// -- r3 : constructor to call |
- // -- r4 : address of the first argument |
+ // -- r4 : allocation site feedback if available, undefined otherwise. |
+ // -- r6 : address of the first argument |
// ----------------------------------- |
// Push a slot for the receiver to be constructed. |
@@ -1252,11 +1254,26 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
Label skip; |
__ CmpP(r2, Operand::Zero()); |
__ beq(&skip); |
- Generate_InterpreterPushArgs(masm, r4, r2, r6); |
+ Generate_InterpreterPushArgs(masm, r6, r2, r7); |
__ bind(&skip); |
- // Call the constructor with r2, r3, and r5 unmodified. |
- __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
+ __ AssertUndefinedOrAllocationSite(r4, r7); |
+ if (construct_type == CallableType::kJSFunction) { |
+ __ AssertFunction(r3); |
+ |
+ // Tail call to the function-specific construct stub (still in the caller |
+ // context at this point). |
+ __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); |
+ __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); |
+ // Jump to the construct function. |
+ __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); |
+ __ Jump(ip); |
+ |
+ } else { |
+ DCHECK_EQ(construct_type, CallableType::kAny); |
+ // Call the constructor with r2, r3, and r5 unmodified. |
+ __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
+ } |
} |
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |