| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index c4f12f0a7c387a7fe858bb58e90a70391aefe9e2..2caae0dd8b9c07f67e631e2ad0f5014f4a2fe907 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -2693,7 +2693,8 @@ void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
|
| void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| int arity,
|
| LInstruction* instr,
|
| - CallKind call_kind) {
|
| + CallKind call_kind,
|
| + RDIState rdi_state) {
|
| bool can_invoke_directly = !function->NeedsArgumentsAdaption() ||
|
| function->shared()->formal_parameter_count() == arity;
|
|
|
| @@ -2701,7 +2702,9 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| RecordPosition(pointers->position());
|
|
|
| if (can_invoke_directly) {
|
| - __ LoadHeapObject(rdi, function);
|
| + if (rdi_state == RDI_UNINITIALIZED) {
|
| + __ LoadHeapObject(rdi, function);
|
| + }
|
|
|
| // Change context if needed.
|
| bool change_context =
|
| @@ -2746,7 +2749,8 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
|
| CallKnownFunction(instr->function(),
|
| instr->arity(),
|
| instr,
|
| - CALL_AS_METHOD);
|
| + CALL_AS_METHOD,
|
| + RDI_UNINITIALIZED);
|
| }
|
|
|
|
|
| @@ -3184,12 +3188,21 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
|
| ASSERT(ToRegister(instr->function()).is(rdi));
|
| 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(rdi, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
|
| - __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| +
|
| + 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(rdi, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
|
| + __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| + } else {
|
| + CallKnownFunction(instr->known_function(),
|
| + instr->arity(),
|
| + instr,
|
| + CALL_AS_METHOD,
|
| + RDI_CONTAINS_TARGET);
|
| + }
|
| }
|
|
|
|
|
| @@ -3243,7 +3256,11 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
|
|
|
| void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
|
| ASSERT(ToRegister(instr->result()).is(rax));
|
| - CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
|
| + CallKnownFunction(instr->target(),
|
| + instr->arity(),
|
| + instr,
|
| + CALL_AS_FUNCTION,
|
| + RDI_UNINITIALIZED);
|
| }
|
|
|
|
|
|
|