Factor out some platform-independent code into the shared cfg.cc.

Review URL: http://codereview.chromium.org/165127

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2647 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 28511859
......@@ -100,19 +100,6 @@ void ExitNode::Compile(MacroAssembler* masm) {
}
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
__ RecordStatementPosition(pos_);
__ RecordPosition(pos_);
}
}
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.
......
......@@ -230,6 +230,19 @@ void ReturnInstr::FastAllocate(TempLocation* temp) {
}
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
masm->RecordStatementPosition(pos_);
masm->RecordPosition(pos_);
}
}
void MoveInstr::Compile(MacroAssembler* masm) {
location()->Move(masm, value());
}
// The expression builder should not be used for declarations or statements.
void ExpressionCfgBuilder::VisitDeclaration(Declaration* decl) {
UNREACHABLE();
......
......@@ -113,19 +113,6 @@ void ExitNode::Compile(MacroAssembler* masm) {
}
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
__ RecordStatementPosition(pos_);
__ RecordPosition(pos_);
}
}
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.
......@@ -212,6 +199,7 @@ void SlotLocation::Move(MacroAssembler* masm, Value* value) {
value->MoveToSlot(masm, this);
}
void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
// The accumulator is not live across a MoveInstr.
__ mov(eax, ToOperand(this));
......
......@@ -103,7 +103,6 @@ void EntryNode::Compile(MacroAssembler* masm) {
void ExitNode::Compile(MacroAssembler* masm) {
ASSERT(!is_marked());
is_marked_ = true;
Comment cmnt(masm, "[ ExitNode");
if (FLAG_trace) {
__ push(rax);
......@@ -123,19 +122,6 @@ void ExitNode::Compile(MacroAssembler* masm) {
}
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
__ RecordStatementPosition(pos_);
__ RecordPosition(pos_);
}
}
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.
......@@ -211,6 +197,11 @@ void SlotLocation::Set(MacroAssembler* masm, Register reg) {
}
void SlotLocation::Push(MacroAssembler* masm) {
__ push(ToOperand(this));
}
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.
......@@ -224,11 +215,6 @@ void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
}
void SlotLocation::Push(MacroAssembler* masm) {
__ push(ToOperand(this));
}
void TempLocation::Get(MacroAssembler* masm, Register reg) {
switch (where_) {
case ACCUMULATOR:
......
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