OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "lib/error.h" | 10 #include "lib/error.h" |
11 #include "vm/ast_printer.h" | 11 #include "vm/ast_printer.h" |
12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
13 #include "vm/il_printer.h" | 13 #include "vm/il_printer.h" |
14 #include "vm/locations.h" | 14 #include "vm/locations.h" |
15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
16 #include "vm/parser.h" | 16 #include "vm/parser.h" |
17 #include "vm/stub_code.h" | 17 #include "vm/stub_code.h" |
18 #include "vm/symbols.h" | 18 #include "vm/symbols.h" |
19 | 19 |
20 namespace dart { | 20 namespace dart { |
21 | 21 |
22 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 22 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
23 DECLARE_FLAG(int, optimization_counter_threshold); | 23 DECLARE_FLAG(int, optimization_counter_threshold); |
24 DECLARE_FLAG(bool, print_ast); | 24 DECLARE_FLAG(bool, print_ast); |
25 DECLARE_FLAG(bool, print_scopes); | 25 DECLARE_FLAG(bool, print_scopes); |
| 26 DECLARE_FLAG(bool, enable_type_checks); |
26 DECLARE_FLAG(bool, eliminate_type_checks); | 27 DECLARE_FLAG(bool, eliminate_type_checks); |
27 | 28 |
28 | 29 |
29 FlowGraphCompiler::~FlowGraphCompiler() { | 30 FlowGraphCompiler::~FlowGraphCompiler() { |
30 // BlockInfos are zone-allocated, so their destructors are not called. | 31 // BlockInfos are zone-allocated, so their destructors are not called. |
31 // Verify the labels explicitly here. | 32 // Verify the labels explicitly here. |
32 for (int i = 0; i < block_info_.length(); ++i) { | 33 for (int i = 0; i < block_info_.length(); ++i) { |
33 ASSERT(!block_info_[i]->label.IsLinked()); | 34 ASSERT(!block_info_[i]->label.IsLinked()); |
34 ASSERT(!block_info_[i]->label.HasNear()); | 35 ASSERT(!block_info_[i]->label.HasNear()); |
35 } | 36 } |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 __ popq(RAX); | 614 __ popq(RAX); |
614 | 615 |
615 __ Bind(&is_assignable); | 616 __ Bind(&is_assignable); |
616 __ popq(RDX); // Remove pushed instantiator type arguments. | 617 __ popq(RDX); // Remove pushed instantiator type arguments. |
617 __ popq(RCX); // Remove pushed instantiator. | 618 __ popq(RCX); // Remove pushed instantiator. |
618 } | 619 } |
619 | 620 |
620 | 621 |
621 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { | 622 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
622 if (!is_optimizing()) { | 623 if (!is_optimizing()) { |
| 624 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) { |
| 625 AssertAssignableInstr* assert = instr->AsAssertAssignable(); |
| 626 AddCurrentDescriptor(PcDescriptors::kDeoptBefore, |
| 627 assert->deopt_id(), |
| 628 assert->token_pos()); |
| 629 } |
623 AllocateRegistersLocally(instr); | 630 AllocateRegistersLocally(instr); |
624 } | 631 } |
625 } | 632 } |
626 | 633 |
627 | 634 |
628 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { | 635 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { |
629 if (is_optimizing()) return; | 636 if (is_optimizing()) return; |
630 Definition* defn = instr->AsDefinition(); | 637 Definition* defn = instr->AsDefinition(); |
631 if ((defn != NULL) && defn->is_used()) { | 638 if ((defn != NULL) && defn->is_used()) { |
632 __ pushq(defn->locs()->out().reg()); | 639 __ pushq(defn->locs()->out().reg()); |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1695 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
1689 __ Exchange(mem1, mem2); | 1696 __ Exchange(mem1, mem2); |
1690 } | 1697 } |
1691 | 1698 |
1692 | 1699 |
1693 #undef __ | 1700 #undef __ |
1694 | 1701 |
1695 } // namespace dart | 1702 } // namespace dart |
1696 | 1703 |
1697 #endif // defined TARGET_ARCH_X64 | 1704 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |