Index: src/arm64/macro-assembler-arm64.cc |
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc |
index 0bd28aa8b38d739ce8aa2323dca4af3f1bfa381a..86efc4d5df74950faaa751a886c826aa5e855964 100644 |
--- a/src/arm64/macro-assembler-arm64.cc |
+++ b/src/arm64/macro-assembler-arm64.cc |
@@ -2551,6 +2551,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
void MacroAssembler::InvokeCode(Register code, |
+ Register new_target, |
const ParameterCount& expected, |
const ParameterCount& actual, |
InvokeFlag flag, |
@@ -2558,8 +2559,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(x3)); |
+ if (!new_target.is_valid()) { |
+ LoadRoot(x3, Heap::kUndefinedValueRootIndex); |
+ } |
+ Label done; |
bool definitely_mismatches = false; |
InvokePrologue(expected, actual, &done, flag, &definitely_mismatches, |
call_wrapper); |
@@ -2585,6 +2592,7 @@ void MacroAssembler::InvokeCode(Register code, |
void MacroAssembler::InvokeFunction(Register function, |
+ Register new_target, |
const ParameterCount& actual, |
InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
@@ -2596,7 +2604,7 @@ void MacroAssembler::InvokeFunction(Register function, |
DCHECK(function.is(x1)); |
Register expected_reg = x2; |
- Register code_reg = x3; |
+ Register code_reg = x4; |
Ldr(cp, FieldMemOperand(function, JSFunction::kContextOffset)); |
// The number of arguments is stored as an int32_t, and -1 is a marker |
@@ -2611,7 +2619,7 @@ void MacroAssembler::InvokeFunction(Register function, |
FieldMemOperand(function, JSFunction::kCodeEntryOffset)); |
ParameterCount expected(expected_reg); |
- InvokeCode(code_reg, expected, actual, flag, call_wrapper); |
+ InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper); |
} |
@@ -2627,7 +2635,7 @@ void MacroAssembler::InvokeFunction(Register function, |
// (See FullCodeGenerator::Generate().) |
DCHECK(function.Is(x1)); |
- Register code_reg = x3; |
+ Register code_reg = x4; |
// Set up the context. |
Ldr(cp, FieldMemOperand(function, JSFunction::kContextOffset)); |
@@ -2636,7 +2644,7 @@ void MacroAssembler::InvokeFunction(Register function, |
// allow recompilation to take effect without changing any of the |
// call sites. |
Ldr(code_reg, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); |
- InvokeCode(code_reg, expected, actual, flag, call_wrapper); |
+ InvokeCode(code_reg, no_reg, expected, actual, flag, call_wrapper); |
} |