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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 23 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
24 DECLARE_FLAG(int, optimization_counter_threshold); | 24 DECLARE_FLAG(int, optimization_counter_threshold); |
25 DECLARE_FLAG(bool, print_ast); | 25 DECLARE_FLAG(bool, print_ast); |
26 DECLARE_FLAG(bool, print_scopes); | 26 DECLARE_FLAG(bool, print_scopes); |
| 27 DECLARE_FLAG(bool, enable_type_checks); |
27 DECLARE_FLAG(bool, eliminate_type_checks); | 28 DECLARE_FLAG(bool, eliminate_type_checks); |
28 | 29 |
29 | 30 |
30 FlowGraphCompiler::~FlowGraphCompiler() { | 31 FlowGraphCompiler::~FlowGraphCompiler() { |
31 // BlockInfos are zone-allocated, so their destructors are not called. | 32 // BlockInfos are zone-allocated, so their destructors are not called. |
32 // Verify the labels explicitly here. | 33 // Verify the labels explicitly here. |
33 for (int i = 0; i < block_info_.length(); ++i) { | 34 for (int i = 0; i < block_info_.length(); ++i) { |
34 ASSERT(!block_info_[i]->label.IsLinked()); | 35 ASSERT(!block_info_[i]->label.IsLinked()); |
35 ASSERT(!block_info_[i]->label.HasNear()); | 36 ASSERT(!block_info_[i]->label.HasNear()); |
36 } | 37 } |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 __ popl(EAX); | 618 __ popl(EAX); |
618 | 619 |
619 __ Bind(&is_assignable); | 620 __ Bind(&is_assignable); |
620 __ popl(EDX); // Remove pushed instantiator type arguments. | 621 __ popl(EDX); // Remove pushed instantiator type arguments. |
621 __ popl(ECX); // Remove pushed instantiator. | 622 __ popl(ECX); // Remove pushed instantiator. |
622 } | 623 } |
623 | 624 |
624 | 625 |
625 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { | 626 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
626 if (!is_optimizing()) { | 627 if (!is_optimizing()) { |
| 628 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) { |
| 629 AssertAssignableInstr* assert = instr->AsAssertAssignable(); |
| 630 AddCurrentDescriptor(PcDescriptors::kDeoptBefore, |
| 631 assert->deopt_id(), |
| 632 assert->token_pos()); |
| 633 } |
627 AllocateRegistersLocally(instr); | 634 AllocateRegistersLocally(instr); |
628 } | 635 } |
629 } | 636 } |
630 | 637 |
631 | 638 |
632 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { | 639 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { |
633 if (is_optimizing()) return; | 640 if (is_optimizing()) return; |
634 Definition* defn = instr->AsDefinition(); | 641 Definition* defn = instr->AsDefinition(); |
635 if ((defn != NULL) && defn->is_used()) { | 642 if ((defn != NULL) && defn->is_used()) { |
636 __ pushl(defn->locs()->out().reg()); | 643 __ pushl(defn->locs()->out().reg()); |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 __ popl(ECX); | 1721 __ popl(ECX); |
1715 __ popl(EAX); | 1722 __ popl(EAX); |
1716 } | 1723 } |
1717 | 1724 |
1718 | 1725 |
1719 #undef __ | 1726 #undef __ |
1720 | 1727 |
1721 } // namespace dart | 1728 } // namespace dart |
1722 | 1729 |
1723 #endif // defined TARGET_ARCH_IA32 | 1730 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |