Index: src/x87/macro-assembler-x87.cc |
diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc |
index a743380c603b3996287a12fb96cc852a4a770bc5..4651f57847aac8cfb0877c9731007595d7b7bc6c 100644 |
--- a/src/x87/macro-assembler-x87.cc |
+++ b/src/x87/macro-assembler-x87.cc |
@@ -1952,14 +1952,20 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
} |
-void MacroAssembler::InvokeCode(const Operand& code, |
+void MacroAssembler::InvokeCode(const Operand& code, Register new_target, |
const ParameterCount& expected, |
- const ParameterCount& actual, |
- InvokeFlag flag, |
+ const ParameterCount& actual, InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
// 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(edx)); |
+ if (!new_target.is_valid()) { |
+ mov(edx, isolate()->factory()->undefined_value()); |
+ } |
+ |
Label done; |
bool definitely_mismatches = false; |
InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
@@ -1978,7 +1984,7 @@ void MacroAssembler::InvokeCode(const Operand& code, |
} |
-void MacroAssembler::InvokeFunction(Register fun, |
+void MacroAssembler::InvokeFunction(Register fun, Register new_target, |
const ParameterCount& actual, |
InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
@@ -1986,13 +1992,13 @@ void MacroAssembler::InvokeFunction(Register fun, |
DCHECK(flag == JUMP_FUNCTION || has_frame()); |
DCHECK(fun.is(edi)); |
- mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
+ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
- mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
+ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset)); |
SmiUntag(ebx); |
ParameterCount expected(ebx); |
- InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
+ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), new_target, |
expected, actual, flag, call_wrapper); |
} |
@@ -2008,8 +2014,8 @@ void MacroAssembler::InvokeFunction(Register fun, |
DCHECK(fun.is(edi)); |
mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
- InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
- expected, actual, flag, call_wrapper); |
+ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, expected, |
+ actual, flag, call_wrapper); |
} |
@@ -2033,8 +2039,8 @@ void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
// parameter count to avoid emitting code to do the check. |
ParameterCount expected(0); |
GetBuiltinFunction(edi, native_context_index); |
- InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
- expected, expected, flag, call_wrapper); |
+ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, expected, |
+ expected, flag, call_wrapper); |
} |