| 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); | |
| 30 | 29 |
| 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 __ b(exit_label()); | 38 __ b(exit_label()); |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 } | 1119 } |
| 1121 } | 1120 } |
| 1122 } | 1121 } |
| 1123 | 1122 |
| 1124 VisitBlocks(); | 1123 VisitBlocks(); |
| 1125 | 1124 |
| 1126 __ brk(0); | 1125 __ brk(0); |
| 1127 ASSERT(assembler()->constant_pool_allowed()); | 1126 ASSERT(assembler()->constant_pool_allowed()); |
| 1128 GenerateDeferredCode(); | 1127 GenerateDeferredCode(); |
| 1129 | 1128 |
| 1130 if (is_optimizing() && !FLAG_precompilation) { | 1129 if (is_optimizing() && !FLAG_precompiled_mode) { |
| 1131 // Leave enough space for patching in case of lazy deoptimization from | 1130 // Leave enough space for patching in case of lazy deoptimization from |
| 1132 // deferred code. | 1131 // deferred code. |
| 1133 for (intptr_t i = 0; | 1132 for (intptr_t i = 0; |
| 1134 i < CallPattern::kDeoptCallLengthInInstructions; | 1133 i < CallPattern::kDeoptCallLengthInInstructions; |
| 1135 ++i) { | 1134 ++i) { |
| 1136 __ orr(R0, ZR, Operand(R0)); // nop | 1135 __ orr(R0, ZR, Operand(R0)); // nop |
| 1137 } | 1136 } |
| 1138 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1137 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1139 __ BranchPatchable(*StubCode::DeoptimizeLazy_entry()); | 1138 __ BranchPatchable(*StubCode::DeoptimizeLazy_entry()); |
| 1140 } | 1139 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 __ LoadObject(R5, cache); | 1300 __ LoadObject(R5, cache); |
| 1302 if (FLAG_use_megamorphic_stub) { | 1301 if (FLAG_use_megamorphic_stub) { |
| 1303 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1302 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1304 } else { | 1303 } else { |
| 1305 StubCode::EmitMegamorphicLookup(assembler()); | 1304 StubCode::EmitMegamorphicLookup(assembler()); |
| 1306 } | 1305 } |
| 1307 __ blr(R1); | 1306 __ blr(R1); |
| 1308 | 1307 |
| 1309 RecordSafepoint(locs); | 1308 RecordSafepoint(locs); |
| 1310 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1309 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1311 if (FLAG_precompilation) { | 1310 if (FLAG_precompiled_mode) { |
| 1312 // Megamorphic calls may occur in slow path stubs. | 1311 // Megamorphic calls may occur in slow path stubs. |
| 1313 // If valid use try_index argument. | 1312 // If valid use try_index argument. |
| 1314 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1313 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1315 try_index = CurrentTryIndex(); | 1314 try_index = CurrentTryIndex(); |
| 1316 } | 1315 } |
| 1317 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1316 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
| 1318 assembler()->CodeSize(), | 1317 assembler()->CodeSize(), |
| 1319 Thread::kNoDeoptId, | 1318 Thread::kNoDeoptId, |
| 1320 token_pos, | 1319 token_pos, |
| 1321 try_index); | 1320 try_index); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1910 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1912 __ PopDouble(reg); | 1911 __ PopDouble(reg); |
| 1913 } | 1912 } |
| 1914 | 1913 |
| 1915 | 1914 |
| 1916 #undef __ | 1915 #undef __ |
| 1917 | 1916 |
| 1918 } // namespace dart | 1917 } // namespace dart |
| 1919 | 1918 |
| 1920 #endif // defined TARGET_ARCH_ARM64 | 1919 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |