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

Unified Diff: src/ia32/cfg-ia32.cc

Issue 165056: Add support for (some) assignment expressions to the CFG builder and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 months 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/cfg.cc ('k') | src/x64/cfg-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/cfg-ia32.cc
===================================================================
--- src/ia32/cfg-ia32.cc (revision 2635)
+++ src/ia32/cfg-ia32.cc (working copy)
@@ -121,28 +121,33 @@
}
+void MoveInstr::Compile(MacroAssembler* masm) {
+ location()->Move(masm, value());
+}
+
+
void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator.
- ASSERT(!val1_->is_on_stack());
+ ASSERT(!value1()->is_on_stack());
Comment cmnt(masm, "[ BinaryOpInstr");
// We can overwrite one of the operands if it is a temporary.
OverwriteMode mode = NO_OVERWRITE;
- if (val0_->is_temporary()) {
+ if (value0()->is_temporary()) {
mode = OVERWRITE_LEFT;
- } else if (val1_->is_temporary()) {
+ } else if (value1()->is_temporary()) {
mode = OVERWRITE_RIGHT;
}
// Push both operands and call the specialized stub.
- if (!val0_->is_on_stack()) {
- val0_->Push(masm);
+ if (!value0()->is_on_stack()) {
+ value0()->Push(masm);
}
- val1_->Push(masm);
- GenericBinaryOpStub stub(op_, mode, SMI_CODE_IN_STUB);
+ value1()->Push(masm);
+ GenericBinaryOpStub stub(op(), mode, SMI_CODE_IN_STUB);
__ CallStub(&stub);
- loc_->Set(masm, eax);
+ location()->Set(masm, eax);
}
@@ -181,6 +186,11 @@
}
+void Constant::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ __ mov(ToOperand(loc), Immediate(handle_));
+}
+
+
void SlotLocation::Get(MacroAssembler* masm, Register reg) {
__ mov(reg, ToOperand(this));
}
@@ -196,6 +206,19 @@
}
+void SlotLocation::Move(MacroAssembler* masm, Value* value) {
+ // We dispatch to the value because in some cases (temp or constant)
+ // we can use a single instruction.
+ value->MoveToSlot(masm, this);
+}
+
+void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ // The accumulator is not live across a MoveInstr.
+ __ mov(eax, ToOperand(this));
+ __ mov(ToOperand(loc), eax);
+}
+
+
void TempLocation::Get(MacroAssembler* masm, Register reg) {
switch (where_) {
case ACCUMULATOR:
@@ -204,9 +227,8 @@
case STACK:
__ pop(reg);
break;
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
- break;
}
}
@@ -219,9 +241,8 @@
case STACK:
__ push(reg);
break;
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
- break;
}
}
@@ -232,13 +253,40 @@
__ push(eax);
break;
case STACK:
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
+ }
+}
+
+
+void TempLocation::Move(MacroAssembler* masm, Value* value) {
+ switch (where_) {
+ case ACCUMULATOR:
+ value->Get(masm, eax);
break;
+ case STACK:
+ value->Push(masm);
+ break;
+ case NOT_ALLOCATED:
+ UNREACHABLE();
}
}
+void TempLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ switch (where_) {
+ case ACCUMULATOR:
+ __ mov(ToOperand(loc), eax);
+ break;
+ case STACK:
+ __ pop(ToOperand(loc));
+ break;
+ case NOT_ALLOCATED:
+ UNREACHABLE();
+ }
+}
+
+
#undef __
} } // namespace v8::internal
« no previous file with comments | « src/cfg.cc ('k') | src/x64/cfg-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698