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

Unified Diff: src/x64/cfg-x64.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/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/cfg-x64.cc
===================================================================
--- src/x64/cfg-x64.cc (revision 2635)
+++ src/x64/cfg-x64.cc (working copy)
@@ -131,28 +131,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, rax);
+ location()->Set(masm, rax);
}
@@ -191,6 +196,11 @@
}
+void Constant::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ __ Move(ToOperand(loc), handle_);
+}
+
+
void SlotLocation::Get(MacroAssembler* masm, Register reg) {
__ movq(reg, ToOperand(this));
}
@@ -201,6 +211,19 @@
}
+void SlotLocation::Move(MacroAssembler* masm, Value* value) {
+ // We dispatch to the value because in some cases (temp or constant) we
+ // can use special instruction sequences.
+ value->MoveToSlot(masm, this);
+}
+
+
+void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ __ movq(kScratchRegister, ToOperand(this));
+ __ movq(ToOperand(loc), kScratchRegister);
+}
+
+
void SlotLocation::Push(MacroAssembler* masm) {
__ push(ToOperand(this));
}
@@ -214,9 +237,8 @@
case STACK:
__ pop(reg);
break;
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
- break;
}
}
@@ -229,9 +251,8 @@
case STACK:
__ push(reg);
break;
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
- break;
}
}
@@ -242,13 +263,40 @@
__ push(rax);
break;
case STACK:
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
+ }
+}
+
+
+void TempLocation::Move(MacroAssembler* masm, Value* value) {
+ switch (where_) {
+ case ACCUMULATOR:
+ value->Get(masm, rax);
break;
+ case STACK:
+ value->Push(masm);
+ break;
+ case NOT_ALLOCATED:
+ UNREACHABLE();
}
}
+void TempLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ switch (where_) {
+ case ACCUMULATOR:
+ __ movq(ToOperand(loc), rax);
+ break;
+ case STACK:
+ __ pop(ToOperand(loc));
+ break;
+ case NOT_ALLOCATED:
+ UNREACHABLE();
+ }
+}
+
+
#undef __
} } // namespace v8::internal
« no previous file with comments | « src/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698