| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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/cpu.h" | 12 #include "vm/cpu.h" |
| 13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
| 14 #include "vm/deopt_instructions.h" | 14 #include "vm/deopt_instructions.h" |
| 15 #include "vm/il_printer.h" | 15 #include "vm/il_printer.h" |
| 16 #include "vm/instructions.h" | 16 #include "vm/instructions.h" |
| 17 #include "vm/locations.h" | 17 #include "vm/locations.h" |
| 18 #include "vm/object_store.h" | 18 #include "vm/object_store.h" |
| 19 #include "vm/parser.h" | 19 #include "vm/parser.h" |
| 20 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
| 21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 #include "vm/symbols.h" | 22 #include "vm/symbols.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 DECLARE_FLAG(bool, enable_simd_inline); | 27 DECLARE_FLAG(bool, enable_simd_inline); |
| 28 DECLARE_FLAG(bool, use_megamorphic_stub); | 28 DECLARE_FLAG(bool, use_megamorphic_stub); |
| 29 DECLARE_FLAG(bool, precompilation); |
| 29 | 30 |
| 30 | 31 |
| 31 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 32 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 32 Assembler* assembler = compiler->assembler(); | 33 Assembler* assembler = compiler->assembler(); |
| 33 #define __ assembler-> | 34 #define __ assembler-> |
| 34 __ Bind(entry_label()); | 35 __ Bind(entry_label()); |
| 35 __ Comment("MegamorphicSlowPath"); | 36 __ Comment("MegamorphicSlowPath"); |
| 36 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 37 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 37 token_pos_, locs_, try_index_); | 38 token_pos_, locs_, try_index_); |
| 38 __ b(exit_label()); | 39 __ b(exit_label()); |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 } | 1111 } |
| 1111 } | 1112 } |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 VisitBlocks(); | 1115 VisitBlocks(); |
| 1115 | 1116 |
| 1116 __ brk(0); | 1117 __ brk(0); |
| 1117 ASSERT(assembler()->constant_pool_allowed()); | 1118 ASSERT(assembler()->constant_pool_allowed()); |
| 1118 GenerateDeferredCode(); | 1119 GenerateDeferredCode(); |
| 1119 | 1120 |
| 1120 if (is_optimizing() && Compiler::allow_recompilation()) { | 1121 if (is_optimizing() && !FLAG_precompilation) { |
| 1121 // Leave enough space for patching in case of lazy deoptimization from | 1122 // Leave enough space for patching in case of lazy deoptimization from |
| 1122 // deferred code. | 1123 // deferred code. |
| 1123 for (intptr_t i = 0; | 1124 for (intptr_t i = 0; |
| 1124 i < CallPattern::kDeoptCallLengthInInstructions; | 1125 i < CallPattern::kDeoptCallLengthInInstructions; |
| 1125 ++i) { | 1126 ++i) { |
| 1126 __ orr(R0, ZR, Operand(R0)); // nop | 1127 __ orr(R0, ZR, Operand(R0)); // nop |
| 1127 } | 1128 } |
| 1128 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1129 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1129 __ BranchPatchable(*StubCode::DeoptimizeLazy_entry()); | 1130 __ BranchPatchable(*StubCode::DeoptimizeLazy_entry()); |
| 1130 } | 1131 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 __ LoadObject(R5, cache); | 1264 __ LoadObject(R5, cache); |
| 1264 if (FLAG_use_megamorphic_stub) { | 1265 if (FLAG_use_megamorphic_stub) { |
| 1265 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1266 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1266 } else { | 1267 } else { |
| 1267 StubCode::EmitMegamorphicLookup(assembler()); | 1268 StubCode::EmitMegamorphicLookup(assembler()); |
| 1268 } | 1269 } |
| 1269 __ blr(R1); | 1270 __ blr(R1); |
| 1270 | 1271 |
| 1271 RecordSafepoint(locs); | 1272 RecordSafepoint(locs); |
| 1272 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1273 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1273 if (Compiler::always_optimize()) { | 1274 if (FLAG_precompilation) { |
| 1274 // Megamorphic calls may occur in slow path stubs. | 1275 // Megamorphic calls may occur in slow path stubs. |
| 1275 // If valid use try_index argument. | 1276 // If valid use try_index argument. |
| 1276 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1277 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1277 try_index = CurrentTryIndex(); | 1278 try_index = CurrentTryIndex(); |
| 1278 } | 1279 } |
| 1279 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1280 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
| 1280 assembler()->CodeSize(), | 1281 assembler()->CodeSize(), |
| 1281 Thread::kNoDeoptId, | 1282 Thread::kNoDeoptId, |
| 1282 token_pos, | 1283 token_pos, |
| 1283 try_index); | 1284 try_index); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1873 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1873 __ PopDouble(reg); | 1874 __ PopDouble(reg); |
| 1874 } | 1875 } |
| 1875 | 1876 |
| 1876 | 1877 |
| 1877 #undef __ | 1878 #undef __ |
| 1878 | 1879 |
| 1879 } // namespace dart | 1880 } // namespace dart |
| 1880 | 1881 |
| 1881 #endif // defined TARGET_ARCH_ARM64 | 1882 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |