Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 67c23efdba87aebd20a703417d900fd968335530..110a35aa497008a413fcb00b16a98c286edf6b8d 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2738,7 +2738,8 @@ void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { |
void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
int arity, |
LInstruction* instr, |
- CallKind call_kind) { |
+ CallKind call_kind, |
+ EDIState edi_state) { |
bool can_invoke_directly = !function->NeedsArgumentsAdaption() || |
function->shared()->formal_parameter_count() == arity; |
@@ -2746,7 +2747,9 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
RecordPosition(pointers->position()); |
if (can_invoke_directly) { |
- __ LoadHeapObject(edi, function); |
+ if (edi_state == EDI_UNINITIALIZED) { |
+ __ LoadHeapObject(edi, function); |
+ } |
// Change context if needed. |
bool change_context = |
@@ -2789,7 +2792,8 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { |
CallKnownFunction(instr->function(), |
instr->arity(), |
instr, |
- CALL_AS_METHOD); |
+ CALL_AS_METHOD, |
+ EDI_UNINITIALIZED); |
} |
@@ -3236,12 +3240,21 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
ASSERT(ToRegister(instr->function()).is(edi)); |
ASSERT(instr->HasPointerMap()); |
ASSERT(instr->HasDeoptimizationEnvironment()); |
- LPointerMap* pointers = instr->pointer_map(); |
- RecordPosition(pointers->position()); |
- SafepointGenerator generator( |
- this, pointers, Safepoint::kLazyDeopt); |
- ParameterCount count(instr->arity()); |
- __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_METHOD); |
+ |
+ if (instr->known_function().is_null()) { |
+ LPointerMap* pointers = instr->pointer_map(); |
+ RecordPosition(pointers->position()); |
+ SafepointGenerator generator( |
+ this, pointers, Safepoint::kLazyDeopt); |
+ ParameterCount count(instr->arity()); |
+ __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_METHOD); |
+ } else { |
+ CallKnownFunction(instr->known_function(), |
+ instr->arity(), |
+ instr, |
+ CALL_AS_METHOD, |
+ EDI_CONTAINS_TARGET); |
+ } |
} |
@@ -3296,7 +3309,11 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
ASSERT(ToRegister(instr->result()).is(eax)); |
- CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION); |
+ CallKnownFunction(instr->target(), |
+ instr->arity(), |
+ instr, |
+ CALL_AS_FUNCTION, |
+ EDI_UNINITIALIZED); |
} |