| 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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "vm/symbols.h" | 24 #include "vm/symbols.h" |
| 25 #include "vm/verified_memory.h" | 25 #include "vm/verified_memory.h" |
| 26 | 26 |
| 27 namespace dart { | 27 namespace dart { |
| 28 | 28 |
| 29 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 29 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 30 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 30 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
| 31 | 31 |
| 32 DECLARE_FLAG(bool, enable_simd_inline); | 32 DECLARE_FLAG(bool, enable_simd_inline); |
| 33 DECLARE_FLAG(bool, use_megamorphic_stub); | 33 DECLARE_FLAG(bool, use_megamorphic_stub); |
| 34 DECLARE_FLAG(bool, precompilation); |
| 34 | 35 |
| 35 | 36 |
| 36 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 37 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 37 Assembler* assembler = compiler->assembler(); | 38 Assembler* assembler = compiler->assembler(); |
| 38 #define __ assembler-> | 39 #define __ assembler-> |
| 39 __ Bind(entry_label()); | 40 __ Bind(entry_label()); |
| 40 __ Comment("MegamorphicSlowPath"); | 41 __ Comment("MegamorphicSlowPath"); |
| 41 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 42 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 42 token_pos_, locs_, try_index_); | 43 token_pos_, locs_, try_index_); |
| 43 __ jmp(exit_label()); | 44 __ jmp(exit_label()); |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 } | 1131 } |
| 1131 } | 1132 } |
| 1132 } | 1133 } |
| 1133 | 1134 |
| 1134 ASSERT(!block_order().is_empty()); | 1135 ASSERT(!block_order().is_empty()); |
| 1135 VisitBlocks(); | 1136 VisitBlocks(); |
| 1136 | 1137 |
| 1137 __ int3(); | 1138 __ int3(); |
| 1138 GenerateDeferredCode(); | 1139 GenerateDeferredCode(); |
| 1139 | 1140 |
| 1140 if (is_optimizing() && Compiler::allow_recompilation()) { | 1141 if (is_optimizing() && !FLAG_precompilation) { |
| 1141 // Leave enough space for patching in case of lazy deoptimization from | 1142 // Leave enough space for patching in case of lazy deoptimization from |
| 1142 // deferred code. | 1143 // deferred code. |
| 1143 __ nop(CallPattern::pattern_length_in_bytes()); | 1144 __ nop(CallPattern::pattern_length_in_bytes()); |
| 1144 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1145 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1145 __ Jmp(*StubCode::DeoptimizeLazy_entry()); | 1146 __ Jmp(*StubCode::DeoptimizeLazy_entry()); |
| 1146 } | 1147 } |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 | 1150 |
| 1150 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1151 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 } else { | 1297 } else { |
| 1297 StubCode::EmitMegamorphicLookup(assembler()); | 1298 StubCode::EmitMegamorphicLookup(assembler()); |
| 1298 } | 1299 } |
| 1299 __ call(EBX); | 1300 __ call(EBX); |
| 1300 | 1301 |
| 1301 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1302 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1302 Thread::kNoDeoptId, token_pos); | 1303 Thread::kNoDeoptId, token_pos); |
| 1303 RecordSafepoint(locs); | 1304 RecordSafepoint(locs); |
| 1304 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1305 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1305 // Precompilation not implemented on ia32 platform. | 1306 // Precompilation not implemented on ia32 platform. |
| 1306 ASSERT(!Compiler::always_optimize()); | 1307 ASSERT(!FLAG_precompilation); |
| 1307 if (is_optimizing()) { | 1308 if (is_optimizing()) { |
| 1308 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1309 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1309 } else { | 1310 } else { |
| 1310 // Add deoptimization continuation point after the call and before the | 1311 // Add deoptimization continuation point after the call and before the |
| 1311 // arguments are removed. | 1312 // arguments are removed. |
| 1312 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1313 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1313 } | 1314 } |
| 1314 __ Drop(argument_count); | 1315 __ Drop(argument_count); |
| 1315 } | 1316 } |
| 1316 | 1317 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 __ movups(reg, Address(ESP, 0)); | 1839 __ movups(reg, Address(ESP, 0)); |
| 1839 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1840 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1840 } | 1841 } |
| 1841 | 1842 |
| 1842 | 1843 |
| 1843 #undef __ | 1844 #undef __ |
| 1844 | 1845 |
| 1845 } // namespace dart | 1846 } // namespace dart |
| 1846 | 1847 |
| 1847 #endif // defined TARGET_ARCH_IA32 | 1848 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |