Index: src/mips64/macro-assembler-mips64.cc |
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc |
index 5fe691bc5c20466aa52b21a37c50f2008ab63bfc..bc86f59ef75665034a04d7f4d7767e10dda0b401 100644 |
--- a/src/mips64/macro-assembler-mips64.cc |
+++ b/src/mips64/macro-assembler-mips64.cc |
@@ -4254,6 +4254,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
void MacroAssembler::InvokeCode(Register code, |
+ Register new_target, |
const ParameterCount& expected, |
const ParameterCount& actual, |
InvokeFlag flag, |
@@ -4261,8 +4262,14 @@ void MacroAssembler::InvokeCode(Register code, |
// You can't call a function without a valid frame. |
DCHECK(flag == JUMP_FUNCTION || has_frame()); |
- Label done; |
+ // Ensure new target is passed in the correct register. Otherwise clear the |
+ // appropriate register in case new target is not given. |
+ DCHECK_IMPLIES(new_target.is_valid(), new_target.is(a3)); |
+ if (!new_target.is_valid()) { |
+ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
+ } |
+ Label done; |
bool definitely_mismatches = false; |
InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
call_wrapper); |
@@ -4283,6 +4290,7 @@ void MacroAssembler::InvokeCode(Register code, |
void MacroAssembler::InvokeFunction(Register function, |
+ Register new_target, |
const ParameterCount& actual, |
InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
@@ -4292,7 +4300,7 @@ void MacroAssembler::InvokeFunction(Register function, |
// Contract with called JS functions requires that function is passed in a1. |
DCHECK(function.is(a1)); |
Register expected_reg = a2; |
- Register code_reg = a3; |
+ Register code_reg = t0; |
ld(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
// The argument count is stored as int32_t on 64-bit platforms. |
@@ -4302,7 +4310,7 @@ void MacroAssembler::InvokeFunction(Register function, |
SharedFunctionInfo::kFormalParameterCountOffset)); |
ld(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
ParameterCount expected(expected_reg); |
- InvokeCode(code_reg, expected, actual, flag, call_wrapper); |
+ InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper); |
} |
@@ -4323,8 +4331,8 @@ void MacroAssembler::InvokeFunction(Register function, |
// We call indirectly through the code field in the function to |
// allow recompilation to take effect without changing any of the |
// call sites. |
- ld(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
- InvokeCode(a3, expected, actual, flag, call_wrapper); |
+ ld(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
+ InvokeCode(t0, no_reg, expected, actual, flag, call_wrapper); |
} |