| 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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 } | 1138 } |
| 1138 } | 1139 } |
| 1139 } | 1140 } |
| 1140 | 1141 |
| 1141 ASSERT(!block_order().is_empty()); | 1142 ASSERT(!block_order().is_empty()); |
| 1142 VisitBlocks(); | 1143 VisitBlocks(); |
| 1143 | 1144 |
| 1144 __ int3(); | 1145 __ int3(); |
| 1145 GenerateDeferredCode(); | 1146 GenerateDeferredCode(); |
| 1146 | 1147 |
| 1147 if (is_optimizing() && !FLAG_precompiled_mode) { | 1148 if (is_optimizing() && !FLAG_precompilation) { |
| 1148 // Leave enough space for patching in case of lazy deoptimization from | 1149 // Leave enough space for patching in case of lazy deoptimization from |
| 1149 // deferred code. | 1150 // deferred code. |
| 1150 __ nop(CallPattern::pattern_length_in_bytes()); | 1151 __ nop(CallPattern::pattern_length_in_bytes()); |
| 1151 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1152 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1152 __ Jmp(*StubCode::DeoptimizeLazy_entry()); | 1153 __ Jmp(*StubCode::DeoptimizeLazy_entry()); |
| 1153 } | 1154 } |
| 1154 } | 1155 } |
| 1155 | 1156 |
| 1156 | 1157 |
| 1157 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1158 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 } else { | 1304 } else { |
| 1304 StubCode::EmitMegamorphicLookup(assembler()); | 1305 StubCode::EmitMegamorphicLookup(assembler()); |
| 1305 } | 1306 } |
| 1306 __ call(EBX); | 1307 __ call(EBX); |
| 1307 | 1308 |
| 1308 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1309 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1309 Thread::kNoDeoptId, token_pos); | 1310 Thread::kNoDeoptId, token_pos); |
| 1310 RecordSafepoint(locs); | 1311 RecordSafepoint(locs); |
| 1311 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1312 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1312 // Precompilation not implemented on ia32 platform. | 1313 // Precompilation not implemented on ia32 platform. |
| 1313 ASSERT(!FLAG_precompiled_mode); | 1314 ASSERT(!FLAG_precompilation); |
| 1314 if (is_optimizing()) { | 1315 if (is_optimizing()) { |
| 1315 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1316 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1316 } else { | 1317 } else { |
| 1317 // Add deoptimization continuation point after the call and before the | 1318 // Add deoptimization continuation point after the call and before the |
| 1318 // arguments are removed. | 1319 // arguments are removed. |
| 1319 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1320 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1320 } | 1321 } |
| 1321 __ Drop(argument_count); | 1322 __ Drop(argument_count); |
| 1322 } | 1323 } |
| 1323 | 1324 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 __ movups(reg, Address(ESP, 0)); | 1847 __ movups(reg, Address(ESP, 0)); |
| 1847 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1848 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1848 } | 1849 } |
| 1849 | 1850 |
| 1850 | 1851 |
| 1851 #undef __ | 1852 #undef __ |
| 1852 | 1853 |
| 1853 } // namespace dart | 1854 } // namespace dart |
| 1854 | 1855 |
| 1855 #endif // defined TARGET_ARCH_IA32 | 1856 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |