| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 intptr_t token_index, | 66 intptr_t token_index, |
| 67 const AbstractType& dst_type, | 67 const AbstractType& dst_type, |
| 68 const String& dst_name) { | 68 const String& dst_name) { |
| 69 Bailout("GenerateAssertAssignable"); | 69 Bailout("GenerateAssertAssignable"); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 void FlowGraphCompiler::LoadValue(Value* value) { | 73 void FlowGraphCompiler::LoadValue(Value* value) { |
| 74 if (value->IsConstant()) { | 74 if (value->IsConstant()) { |
| 75 ConstantVal* constant = value->AsConstant(); | 75 ConstantVal* constant = value->AsConstant(); |
| 76 if (constant->instance().IsSmi()) { | 76 if (constant->value().IsSmi()) { |
| 77 int64_t imm = reinterpret_cast<int64_t>(constant->instance().raw()); | 77 int64_t imm = reinterpret_cast<int64_t>(constant->value().raw()); |
| 78 __ movq(RAX, Immediate(imm)); | 78 __ movq(RAX, Immediate(imm)); |
| 79 } else { | 79 } else { |
| 80 __ LoadObject(RAX, value->AsConstant()->instance()); | 80 __ LoadObject(RAX, value->AsConstant()->value()); |
| 81 } | 81 } |
| 82 } else { | 82 } else { |
| 83 ASSERT(value->IsTemp()); | 83 ASSERT(value->IsTemp()); |
| 84 __ popq(RAX); | 84 __ popq(RAX); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 void FlowGraphCompiler::VisitTemp(TempVal* val) { | 89 void FlowGraphCompiler::VisitTemp(TempVal* val) { |
| 90 LoadValue(val); | 90 LoadValue(val); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 __ LoadObject(RAX, bool_false); | 328 __ LoadObject(RAX, bool_false); |
| 329 __ Bind(&done); | 329 __ Bind(&done); |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 void FlowGraphCompiler::VisitInstanceOf(InstanceOfComp* comp) { | 333 void FlowGraphCompiler::VisitInstanceOf(InstanceOfComp* comp) { |
| 334 Bailout("InstanceOf"); | 334 Bailout("InstanceOf"); |
| 335 } | 335 } |
| 336 | 336 |
| 337 | 337 |
| 338 void FlowGraphCompiler::VisitAllocateObject(AllocateObjectComp* comp) { |
| 339 const Class& cls = Class::ZoneHandle(comp->constructor().owner()); |
| 340 const bool requires_type_arguments = cls.HasTypeArguments(); |
| 341 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); |
| 342 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); |
| 343 GenerateCall(comp->token_index(), &label, PcDescriptors::kOther); |
| 344 if (requires_type_arguments) { |
| 345 __ popq(RCX); // Discard type arguments. |
| 346 __ popq(RCX); // Discard instantiator type arguments. |
| 347 } |
| 348 } |
| 349 |
| 350 |
| 338 void FlowGraphCompiler::VisitBlocks( | 351 void FlowGraphCompiler::VisitBlocks( |
| 339 const GrowableArray<BlockEntryInstr*>& blocks) { | 352 const GrowableArray<BlockEntryInstr*>& blocks) { |
| 340 for (intptr_t i = blocks.length() - 1; i >= 0; --i) { | 353 for (intptr_t i = blocks.length() - 1; i >= 0; --i) { |
| 341 // Compile the block entry. | 354 // Compile the block entry. |
| 342 current_block_ = blocks[i]; | 355 current_block_ = blocks[i]; |
| 343 Instruction* instr = current_block()->Accept(this); | 356 Instruction* instr = current_block()->Accept(this); |
| 344 // Compile all successors until an exit, branch, or a block entry. | 357 // Compile all successors until an exit, branch, or a block entry. |
| 345 while ((instr != NULL) && !instr->IsBlockEntry()) { | 358 while ((instr != NULL) && !instr->IsBlockEntry()) { |
| 346 instr = instr->Accept(this); | 359 instr = instr->Accept(this); |
| 347 } | 360 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 614 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
| 602 // We don't compile exception handlers yet. | 615 // We don't compile exception handlers yet. |
| 603 code.set_exception_handlers( | 616 code.set_exception_handlers( |
| 604 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); | 617 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); |
| 605 } | 618 } |
| 606 | 619 |
| 607 | 620 |
| 608 } // namespace dart | 621 } // namespace dart |
| 609 | 622 |
| 610 #endif // defined TARGET_ARCH_X64 | 623 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |