Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index a3a8415db2c936f2c31a458c72a362fc85a37972..7a5fa6c169cee6262ddfdfb03948e896cc8dc535 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1987,6 +1987,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
void MacroAssembler::InvokeCode(const Operand& code, |
+ Register new_target, |
const ParameterCount& expected, |
const ParameterCount& actual, |
InvokeFlag flag, |
@@ -1994,6 +1995,13 @@ void MacroAssembler::InvokeCode(const Operand& 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(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, |
@@ -2013,6 +2021,7 @@ void MacroAssembler::InvokeCode(const Operand& code, |
void MacroAssembler::InvokeFunction(Register fun, |
+ Register new_target, |
const ParameterCount& actual, |
InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
@@ -2020,13 +2029,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); |
} |
@@ -2042,7 +2051,7 @@ void MacroAssembler::InvokeFunction(Register fun, |
DCHECK(fun.is(edi)); |
mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
- InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
+ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, |
expected, actual, flag, call_wrapper); |
} |
@@ -2067,7 +2076,7 @@ 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), |
+ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, |
expected, expected, flag, call_wrapper); |
} |