| Index: src/mips/lithium-codegen-mips.cc
|
| diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
|
| index c56188bb37602aff466ba5aded4f1c0ce5665bb6..1ed7db8037c395bfe45a42083f62f67f0666749a 100644
|
| --- a/src/mips/lithium-codegen-mips.cc
|
| +++ b/src/mips/lithium-codegen-mips.cc
|
| @@ -2848,7 +2848,8 @@ void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
|
| void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| int arity,
|
| LInstruction* instr,
|
| - CallKind call_kind) {
|
| + CallKind call_kind,
|
| + A1State a1_state) {
|
| bool can_invoke_directly = !function->NeedsArgumentsAdaption() ||
|
| function->shared()->formal_parameter_count() == arity;
|
|
|
| @@ -2856,7 +2857,10 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| RecordPosition(pointers->position());
|
|
|
| if (can_invoke_directly) {
|
| - __ LoadHeapObject(a1, function);
|
| + if (a1_state == A1_UNINITIALIZED) {
|
| + __ LoadHeapObject(a1, function);
|
| + }
|
| +
|
| // Change context if needed.
|
| bool change_context =
|
| (info()->closure()->context() != function->context()) ||
|
| @@ -2893,7 +2897,11 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
|
| ASSERT(ToRegister(instr->result()).is(v0));
|
| __ mov(a0, v0);
|
| - CallKnownFunction(instr->function(), instr->arity(), instr, CALL_AS_METHOD);
|
| + CallKnownFunction(instr->function(),
|
| + instr->arity(),
|
| + instr,
|
| + CALL_AS_METHOD,
|
| + A1_UNINITIALIZED);
|
| }
|
|
|
|
|
| @@ -3330,12 +3338,21 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
|
| ASSERT(ToRegister(instr->function()).is(a1));
|
| 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(a1, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
|
| - __ lw(cp, MemOperand(fp, 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(a1, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
|
| + __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| + } else {
|
| + CallKnownFunction(instr->known_function(),
|
| + instr->arity(),
|
| + instr,
|
| + CALL_AS_METHOD,
|
| + A1_CONTAINS_TARGET);
|
| + }
|
| }
|
|
|
|
|
| @@ -3390,7 +3407,11 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
|
|
|
| void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
|
| ASSERT(ToRegister(instr->result()).is(v0));
|
| - CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
|
| + CallKnownFunction(instr->target(),
|
| + instr->arity(),
|
| + instr,
|
| + CALL_AS_FUNCTION,
|
| + A1_UNINITIALIZED);
|
| }
|
|
|
|
|
|
|