Chromium Code Reviews| Index: runtime/vm/flow_graph_compiler_x64.cc |
| diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc |
| index 0b846fa3547541f68c7f9dd7fc36c05142214b34..75a1e7dc26c8816865d415c965ea7ad8ee01ff35 100644 |
| --- a/runtime/vm/flow_graph_compiler_x64.cc |
| +++ b/runtime/vm/flow_graph_compiler_x64.cc |
| @@ -15,6 +15,7 @@ |
| #include "vm/disassembler.h" |
| #include "vm/il_printer.h" |
| #include "vm/intrinsifier.h" |
| +#include "vm/locations.h" |
| #include "vm/longjump.h" |
| #include "vm/object_store.h" |
| #include "vm/parser.h" |
| @@ -547,22 +548,7 @@ void FlowGraphCompiler::VisitInstanceCall(InstanceCallComp* comp) { |
| void FlowGraphCompiler::VisitStrictCompare(StrictCompareComp* comp) { |
| - const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| - const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
| - LoadValue(RDX, comp->right()); |
| - LoadValue(RAX, comp->left()); |
| - __ cmpq(RAX, RDX); |
| - Label load_true, done; |
| - if (comp->kind() == Token::kEQ_STRICT) { |
| - __ j(EQUAL, &load_true, Assembler::kNearJump); |
| - } else { |
| - __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); |
| - } |
| - __ LoadObject(RAX, bool_false); |
| - __ jmp(&done, Assembler::kNearJump); |
| - __ Bind(&load_true); |
| - __ LoadObject(RAX, bool_true); |
| - __ Bind(&done); |
| + UNREACHABLE(); |
|
srdjan
2012/05/21 16:05:22
Why is that (add comment)? Wait, this is part of t
Vyacheslav Egorov (Google)
2012/05/21 19:53:46
Yes, native template were moved. I added a comment
|
| } |
| @@ -1122,6 +1108,23 @@ void FlowGraphCompiler::VisitCatchEntry(CatchEntryComp* comp) { |
| } |
| +void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
| + LocationSummary* locs = instr->locs(); |
| + ASSERT(locs != NULL); |
| + |
| + // TODO(vegorov): share this !!! |
| + locs->AllocateRegisters(); |
| + |
| + // Load instruction inputs into allocated registers. |
| + for (intptr_t i = locs->count() - 1; i >= 0; i--) { |
| + Location loc = locs->in(i); |
| + if (loc.kind() == Location::kRegister) { |
| + __ popq(loc.AsRegister()); |
| + } |
|
srdjan
2012/05/21 16:05:22
else? UNIMPLEMENTED? check location is stack OK?
Vyacheslav Egorov (Google)
2012/05/21 19:53:46
Added assert.
|
| + } |
| +} |
| + |
| + |
| void FlowGraphCompiler::VisitBlocks() { |
| for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| __ Comment("B%d", i); |
| @@ -1131,7 +1134,13 @@ void FlowGraphCompiler::VisitBlocks() { |
| // Compile all successors until an exit, branch, or a block entry. |
| while ((instr != NULL) && !instr->IsBlockEntry()) { |
| if (FLAG_code_comments) EmitComment(instr); |
| - instr = instr->Accept(this); |
| + if (instr->locs() != NULL) { |
| + EmitInstructionPrologue(instr); |
| + instr->EmitNativeCode(this); |
| + instr = instr->StraightLineSuccessor(); |
| + } else { |
| + instr = instr->Accept(this); |
| + } |
| } |
| BlockEntryInstr* successor = |
| @@ -1181,6 +1190,10 @@ void FlowGraphCompiler::VisitDo(DoInstr* instr) { |
| void FlowGraphCompiler::VisitBind(BindInstr* instr) { |
| + ASSERT(instr->locs() == NULL); |
| + |
| + // If instruction does not have special location requirements |
| + // then it returns result in register RAX. |
| instr->computation()->Accept(this); |
| __ pushq(RAX); |
| } |