Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index 744a9c394b567cfed52f41bb2b41291a894f2045..8977d9384aba445338867695bc9d91bd89fe61d5 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -1304,6 +1304,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
void MacroAssembler::InvokeCode(Register code, |
+ Register new_target, |
const ParameterCount& expected, |
const ParameterCount& actual, |
InvokeFlag flag, |
@@ -1311,6 +1312,13 @@ void MacroAssembler::InvokeCode(Register code, |
// You can't call a function without a valid frame. |
DCHECK(flag == JUMP_FUNCTION || has_frame()); |
+ // 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(r3)); |
+ if (!new_target.is_valid()) { |
+ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
+ } |
+ |
Label done; |
bool definitely_mismatches = false; |
InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
@@ -1333,6 +1341,7 @@ void MacroAssembler::InvokeCode(Register code, |
void MacroAssembler::InvokeFunction(Register fun, |
+ Register new_target, |
const ParameterCount& actual, |
InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
@@ -1343,7 +1352,7 @@ void MacroAssembler::InvokeFunction(Register fun, |
DCHECK(fun.is(r1)); |
Register expected_reg = r2; |
- Register code_reg = r3; |
+ Register code_reg = r4; |
ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
@@ -1355,7 +1364,7 @@ void MacroAssembler::InvokeFunction(Register fun, |
FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
ParameterCount expected(expected_reg); |
- InvokeCode(code_reg, expected, actual, flag, call_wrapper); |
+ InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper); |
} |
@@ -1376,8 +1385,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. |
- ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
- InvokeCode(r3, expected, actual, flag, call_wrapper); |
+ ldr(r4, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
+ InvokeCode(r4, no_reg, expected, actual, flag, call_wrapper); |
} |