Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: src/mips/full-codegen-mips.cc

Issue 58853003: MIPS: Try to use Push instead of push sequences whenever possible. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 1f3a8169707a858cf30e335008f02a267e1411ab..b217e06db4abd6a3aabe6605b32d0d7601a179f1 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -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();
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698