| 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 DECLARE_FLAG(bool, precompilation); | |
| 31 | 30 |
| 32 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 31 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 33 Assembler* assembler = compiler->assembler(); | 32 Assembler* assembler = compiler->assembler(); |
| 34 #define __ assembler-> | 33 #define __ assembler-> |
| 35 __ Bind(entry_label()); | 34 __ Bind(entry_label()); |
| 36 __ Comment("MegamorphicSlowPath"); | 35 __ Comment("MegamorphicSlowPath"); |
| 37 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 36 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 38 token_pos_, locs_, try_index_); | 37 token_pos_, locs_, try_index_); |
| 39 __ jmp(exit_label()); | 38 __ jmp(exit_label()); |
| 40 #undef __ | 39 #undef __ |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 | 1138 |
| 1140 ASSERT(!block_order().is_empty()); | 1139 ASSERT(!block_order().is_empty()); |
| 1141 VisitBlocks(); | 1140 VisitBlocks(); |
| 1142 | 1141 |
| 1143 __ int3(); | 1142 __ int3(); |
| 1144 ASSERT(assembler()->constant_pool_allowed()); | 1143 ASSERT(assembler()->constant_pool_allowed()); |
| 1145 GenerateDeferredCode(); | 1144 GenerateDeferredCode(); |
| 1146 // Emit function patching code. This will be swapped with the first 13 bytes | 1145 // Emit function patching code. This will be swapped with the first 13 bytes |
| 1147 // at entry point. | 1146 // at entry point. |
| 1148 | 1147 |
| 1149 if (is_optimizing() && !FLAG_precompilation) { | 1148 if (is_optimizing() && !FLAG_precompiled_mode) { |
| 1150 // Leave enough space for patching in case of lazy deoptimization from | 1149 // Leave enough space for patching in case of lazy deoptimization from |
| 1151 // deferred code. | 1150 // deferred code. |
| 1152 __ nop(ShortCallPattern::pattern_length_in_bytes()); | 1151 __ nop(ShortCallPattern::pattern_length_in_bytes()); |
| 1153 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1152 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1154 __ Jmp(*StubCode::DeoptimizeLazy_entry(), PP); | 1153 __ Jmp(*StubCode::DeoptimizeLazy_entry(), PP); |
| 1155 } | 1154 } |
| 1156 } | 1155 } |
| 1157 | 1156 |
| 1158 | 1157 |
| 1159 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1158 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 __ LoadObject(RBX, cache); | 1330 __ LoadObject(RBX, cache); |
| 1332 if (FLAG_use_megamorphic_stub) { | 1331 if (FLAG_use_megamorphic_stub) { |
| 1333 __ Call(*StubCode::MegamorphicLookup_entry()); | 1332 __ Call(*StubCode::MegamorphicLookup_entry()); |
| 1334 } else { | 1333 } else { |
| 1335 StubCode::EmitMegamorphicLookup(assembler()); | 1334 StubCode::EmitMegamorphicLookup(assembler()); |
| 1336 } | 1335 } |
| 1337 __ call(RCX); | 1336 __ call(RCX); |
| 1338 | 1337 |
| 1339 RecordSafepoint(locs); | 1338 RecordSafepoint(locs); |
| 1340 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1339 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1341 if (FLAG_precompilation) { | 1340 if (FLAG_precompiled_mode) { |
| 1342 // Megamorphic calls may occur in slow path stubs. | 1341 // Megamorphic calls may occur in slow path stubs. |
| 1343 // If valid use try_index argument. | 1342 // If valid use try_index argument. |
| 1344 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1343 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1345 try_index = CurrentTryIndex(); | 1344 try_index = CurrentTryIndex(); |
| 1346 } | 1345 } |
| 1347 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1346 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
| 1348 assembler()->CodeSize(), | 1347 assembler()->CodeSize(), |
| 1349 Thread::kNoDeoptId, | 1348 Thread::kNoDeoptId, |
| 1350 token_pos, | 1349 token_pos, |
| 1351 try_index); | 1350 try_index); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 __ movups(reg, Address(RSP, 0)); | 1847 __ movups(reg, Address(RSP, 0)); |
| 1849 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1848 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
| 1850 } | 1849 } |
| 1851 | 1850 |
| 1852 | 1851 |
| 1853 #undef __ | 1852 #undef __ |
| 1854 | 1853 |
| 1855 } // namespace dart | 1854 } // namespace dart |
| 1856 | 1855 |
| 1857 #endif // defined TARGET_ARCH_X64 | 1856 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |