| 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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| 11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
| 14 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
| 15 #include "vm/instructions.h" | 15 #include "vm/instructions.h" |
| 16 #include "vm/locations.h" | 16 #include "vm/locations.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 19 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
| 20 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
| 22 #include "vm/verified_memory.h" | 22 #include "vm/verified_memory.h" |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
| 28 DECLARE_FLAG(bool, enable_simd_inline); | 28 DECLARE_FLAG(bool, enable_simd_inline); |
| 29 DECLARE_FLAG(bool, use_megamorphic_stub); | 29 DECLARE_FLAG(bool, use_megamorphic_stub); |
| 30 | 30 DECLARE_FLAG(bool, precompilation); |
| 31 | 31 |
| 32 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 32 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 33 Assembler* assembler = compiler->assembler(); | 33 Assembler* assembler = compiler->assembler(); |
| 34 #define __ assembler-> | 34 #define __ assembler-> |
| 35 __ Bind(entry_label()); | 35 __ Bind(entry_label()); |
| 36 __ Comment("MegamorphicSlowPath"); | 36 __ Comment("MegamorphicSlowPath"); |
| 37 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 37 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 38 token_pos_, locs_, try_index_); | 38 token_pos_, locs_, try_index_); |
| 39 __ jmp(exit_label()); | 39 __ jmp(exit_label()); |
| 40 #undef __ | 40 #undef __ |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 | 1132 |
| 1133 ASSERT(!block_order().is_empty()); | 1133 ASSERT(!block_order().is_empty()); |
| 1134 VisitBlocks(); | 1134 VisitBlocks(); |
| 1135 | 1135 |
| 1136 __ int3(); | 1136 __ int3(); |
| 1137 ASSERT(assembler()->constant_pool_allowed()); | 1137 ASSERT(assembler()->constant_pool_allowed()); |
| 1138 GenerateDeferredCode(); | 1138 GenerateDeferredCode(); |
| 1139 // Emit function patching code. This will be swapped with the first 13 bytes | 1139 // Emit function patching code. This will be swapped with the first 13 bytes |
| 1140 // at entry point. | 1140 // at entry point. |
| 1141 | 1141 |
| 1142 if (is_optimizing() && Compiler::allow_recompilation()) { | 1142 if (is_optimizing() && !FLAG_precompilation) { |
| 1143 // Leave enough space for patching in case of lazy deoptimization from | 1143 // Leave enough space for patching in case of lazy deoptimization from |
| 1144 // deferred code. | 1144 // deferred code. |
| 1145 __ nop(ShortCallPattern::pattern_length_in_bytes()); | 1145 __ nop(ShortCallPattern::pattern_length_in_bytes()); |
| 1146 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1146 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1147 __ Jmp(*StubCode::DeoptimizeLazy_entry(), PP); | 1147 __ Jmp(*StubCode::DeoptimizeLazy_entry(), PP); |
| 1148 } | 1148 } |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 | 1151 |
| 1152 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1152 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 __ LoadObject(RBX, cache); | 1296 __ LoadObject(RBX, cache); |
| 1297 if (FLAG_use_megamorphic_stub) { | 1297 if (FLAG_use_megamorphic_stub) { |
| 1298 __ Call(*StubCode::MegamorphicLookup_entry()); | 1298 __ Call(*StubCode::MegamorphicLookup_entry()); |
| 1299 } else { | 1299 } else { |
| 1300 StubCode::EmitMegamorphicLookup(assembler()); | 1300 StubCode::EmitMegamorphicLookup(assembler()); |
| 1301 } | 1301 } |
| 1302 __ call(RCX); | 1302 __ call(RCX); |
| 1303 | 1303 |
| 1304 RecordSafepoint(locs); | 1304 RecordSafepoint(locs); |
| 1305 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1305 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1306 if (Compiler::always_optimize()) { | 1306 if (FLAG_precompilation) { |
| 1307 // Megamorphic calls may occur in slow path stubs. | 1307 // Megamorphic calls may occur in slow path stubs. |
| 1308 // If valid use try_index argument. | 1308 // If valid use try_index argument. |
| 1309 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1309 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1310 try_index = CurrentTryIndex(); | 1310 try_index = CurrentTryIndex(); |
| 1311 } | 1311 } |
| 1312 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1312 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
| 1313 assembler()->CodeSize(), | 1313 assembler()->CodeSize(), |
| 1314 Thread::kNoDeoptId, | 1314 Thread::kNoDeoptId, |
| 1315 token_pos, | 1315 token_pos, |
| 1316 try_index); | 1316 try_index); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 __ movups(reg, Address(RSP, 0)); | 1812 __ movups(reg, Address(RSP, 0)); |
| 1813 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1813 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 | 1816 |
| 1817 #undef __ | 1817 #undef __ |
| 1818 | 1818 |
| 1819 } // namespace dart | 1819 } // namespace dart |
| 1820 | 1820 |
| 1821 #endif // defined TARGET_ARCH_X64 | 1821 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |