Commit 4e4169d5 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Try to use Push instead of push sequences whenever possible.

Port r17466 (e519285)

BUG=
R=plind44@gmail.com

Review URL: https://codereview.chromium.org/58853003

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17507 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4539c6ba
......@@ -301,17 +301,12 @@ static void CallRuntimePassFunction(MacroAssembler* masm,
Runtime::FunctionId function_id) {
FrameScope scope(masm, StackFrame::INTERNAL);
// Push a copy of the function onto the stack.
__ push(a1);
// Push call kind information.
__ push(t1);
// Function is also the parameter to the runtime call.
__ push(a1);
// Push call kind information and function as parameter to the runtime call.
__ Push(a1, t1, a1);
__ CallRuntime(function_id, 1);
// Restore call kind information.
__ pop(t1);
// Restore receiver.
__ pop(a1);
// Restore call kind information and receiver.
__ Pop(a1, t1);
}
......@@ -421,14 +416,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ sb(t0, constructor_count);
__ Branch(&allocate, ne, t0, Operand(zero_reg));
__ Push(a1, a2);
__ push(a1); // Constructor.
__ Push(a1, a2, a1); // a1 = Constructor.
// The call will replace the stub, so the countdown is only done once.
__ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
__ pop(a2);
__ pop(a1);
__ Pop(a1, a2);
__ bind(&allocate);
}
......@@ -1245,8 +1237,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
// Out of stack space.
__ lw(a1, MemOperand(fp, kFunctionOffset));
__ push(a1);
__ push(v0);
__ Push(a1, v0);
__ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
// End of stack check.
......@@ -1327,8 +1318,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
// a0: current argument index
__ bind(&loop);
__ lw(a1, MemOperand(fp, kArgsOffset));
__ push(a1);
__ push(a0);
__ Push(a1, a0);
// Call the runtime to access the property in the arguments array.
__ CallRuntime(Runtime::kGetProperty, 2);
......
......@@ -5156,8 +5156,7 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate());
FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(a1, a0);
__ push(ra);
__ Push(a1, a0);
__ Push(ra, a1, a0);
__ li(t0, Operand(Smi::FromInt(op_)));
__ addiu(sp, sp, -kPointerSize);
__ CallExternalReference(miss, 3, USE_DELAY_SLOT);
......
......@@ -631,12 +631,11 @@ void FullCodeGenerator::StackValueContext::Plug(
Label done;
__ bind(materialize_true);
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ push(at);
__ Branch(&done);
__ bind(materialize_false);
__ LoadRoot(at, Heap::kFalseValueRootIndex);
__ push(at);
__ bind(&done);
__ push(at);
}
......@@ -1617,9 +1616,8 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
__ jmp(&allocated);
__ bind(&runtime_allocate);
__ push(t1);
__ li(a0, Operand(Smi::FromInt(size)));
__ push(a0);
__ Push(t1, a0);
__ CallRuntime(Runtime::kAllocateInNewSpace, 1);
__ pop(t1);
......@@ -2060,8 +2058,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
__ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
__ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
__ push(a3); // iter
__ push(a0); // exception
__ Push(a3, a0); // iter, exception
__ jmp(&l_call);
// try { received = %yield result }
......@@ -2099,8 +2096,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ bind(&l_next);
__ LoadRoot(a2, Heap::knext_stringRootIndex); // "next"
__ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
__ push(a3); // iter
__ push(a0); // received
__ Push(a3, a0); // iter, received
// result = receiver[f](arg);
__ bind(&l_call);
......@@ -2176,11 +2172,13 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ Call(&resume_frame);
__ jmp(&done);
__ bind(&resume_frame);
__ push(ra); // Return address.
__ push(fp); // Caller's frame pointer.
__ mov(fp, sp);
__ push(cp); // Callee's context.
__ push(t0); // Callee's JS Function.
// ra = return address.
// fp = caller's frame pointer.
// cp = callee's context,
// t0 = callee's JS function.
__ Push(ra, fp, cp, t0);
// Adjust FP to point to saved FP.
__ Addu(fp, sp, 2 * kPointerSize);
// Load the operand stack size.
__ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset));
......@@ -2211,8 +2209,8 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ push(a2);
__ Branch(&push_operand_holes);
__ bind(&call_resume);
__ push(a1);
__ push(result_register());
ASSERT(!result_register().is(a1));
__ Push(a1, result_register());
__ Push(Smi::FromInt(resume_mode));
__ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
// Not reached: the runtime call returns elsewhere.
......@@ -2442,8 +2440,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
VisitForStackValue(prop->obj());
VisitForAccumulatorValue(prop->key());
__ mov(a1, result_register());
__ pop(a2);
__ pop(a0); // Restore value.
__ Pop(a0, a2); // a0 = restored value.
Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
......@@ -2585,8 +2582,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
// - a1 is the key,
// - a2 is the receiver.
__ mov(a0, result_register());
__ pop(a1); // Key.
__ pop(a2);
__ Pop(a2, a1); // a1 = key.
Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize()
......@@ -2714,27 +2710,25 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
// Push copy of the first argument or undefined if it doesn't exist.
// t2: copy of the first argument or undefined if it doesn't exist.
if (arg_count > 0) {
__ lw(a1, MemOperand(sp, arg_count * kPointerSize));
__ lw(t2, MemOperand(sp, arg_count * kPointerSize));
} else {
__ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
__ LoadRoot(t2, Heap::kUndefinedValueRootIndex);
}
__ push(a1);
// Push the receiver of the enclosing function.
// t1: the receiver of the enclosing function.
int receiver_offset = 2 + info_->scope()->num_parameters();
__ lw(a1, MemOperand(fp, receiver_offset * kPointerSize));
__ push(a1);
// Push the language mode.
__ li(a1, Operand(Smi::FromInt(language_mode())));
__ push(a1);
__ lw(t1, MemOperand(fp, receiver_offset * kPointerSize));
// t0: the language mode.
__ li(t0, Operand(Smi::FromInt(language_mode())));
// Push the start position of the scope the calls resides in.
// a1: the start position of the scope the calls resides in.
__ li(a1, Operand(Smi::FromInt(scope()->start_position())));
__ push(a1);
// Do the runtime call.
__ Push(t2, t1, t0, a1);
__ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
}
......@@ -2807,9 +2801,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ bind(&slow);
// Call the runtime to find the function to call (returned in v0)
// and the object holding it (returned in v1).
__ push(context_register());
ASSERT(!context_register().is(a2));
__ li(a2, Operand(proxy->name()));
__ push(a2);
__ Push(context_register(), a2);
__ CallRuntime(Runtime::kLoadContextSlot, 2);
__ Push(v0, v1); // Function, receiver.
......@@ -3521,8 +3515,7 @@ void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
VisitForStackValue(args->at(1)); // index
VisitForStackValue(args->at(2)); // value
__ pop(value);
__ pop(index);
__ Pop(index, value);
VisitForAccumulatorValue(args->at(0)); // string
if (FLAG_debug_code) {
......@@ -3551,8 +3544,7 @@ void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) {
VisitForStackValue(args->at(1)); // index
VisitForStackValue(args->at(2)); // value
__ pop(value);
__ pop(index);
__ Pop(index, value);
VisitForAccumulatorValue(args->at(0)); // string
if (FLAG_debug_code) {
......@@ -4313,9 +4305,9 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
} else {
// Non-global variable. Call the runtime to try to delete from the
// context where the variable was introduced.
__ push(context_register());
ASSERT(!context_register().is(a2));
__ li(a2, Operand(var->name()));
__ push(a2);
__ Push(context_register(), a2);
__ CallRuntime(Runtime::kDeleteContextSlot, 2);
context()->Plug(v0);
}
......@@ -4547,8 +4539,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
}
case KEYED_PROPERTY: {
__ mov(a0, result_register()); // Value.
__ pop(a1); // Key.
__ pop(a2); // Receiver.
__ Pop(a2, a1); // a1 = key, a2 = receiver.
Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
......
......@@ -578,8 +578,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ IncrementCounter(counters->keyed_call_generic_slow_load(), 1, a0, a3);
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ push(a2); // Save the key.
__ Push(a1, a2); // Pass the receiver and the key.
__ Push(a2, a1, a2); // Save the key and pass the receiver and the key.
__ CallRuntime(Runtime::kKeyedGetProperty, 2);
__ pop(a2); // Restore the key.
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment