Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index c931e5b7e605cd41a0a1039d2eacf593ae771d11..ff58fbc03e37c382d9d5f3b4563e0997e68749c3 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -4046,6 +4046,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
void MacroAssembler::InvokeCode(Register code, |
+ Register new_target, |
const ParameterCount& expected, |
const ParameterCount& actual, |
InvokeFlag flag, |
@@ -4053,8 +4054,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); |
@@ -4075,6 +4082,7 @@ void MacroAssembler::InvokeCode(Register code, |
void MacroAssembler::InvokeFunction(Register function, |
+ Register new_target, |
const ParameterCount& actual, |
InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
@@ -4084,7 +4092,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; |
lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
@@ -4095,7 +4103,7 @@ void MacroAssembler::InvokeFunction(Register function, |
lw(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); |
} |
@@ -4116,8 +4124,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. |
- lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
- InvokeCode(a3, expected, actual, flag, call_wrapper); |
+ lw(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
+ InvokeCode(t0, no_reg, expected, actual, flag, call_wrapper); |
} |