| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 26 DECLARE_FLAG(bool, use_megamorphic_stub); | 26 DECLARE_FLAG(bool, use_megamorphic_stub); |
| 27 DECLARE_FLAG(bool, precompilation); |
| 27 | 28 |
| 28 | 29 |
| 29 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 30 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 30 Assembler* assembler = compiler->assembler(); | 31 Assembler* assembler = compiler->assembler(); |
| 31 #define __ assembler-> | 32 #define __ assembler-> |
| 32 __ Bind(entry_label()); | 33 __ Bind(entry_label()); |
| 33 __ Comment("MegamorphicSlowPath"); | 34 __ Comment("MegamorphicSlowPath"); |
| 34 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 35 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 35 token_pos_, locs_, try_index_); | 36 token_pos_, locs_, try_index_); |
| 36 __ b(exit_label()); | 37 __ b(exit_label()); |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 __ sw(V0, Address(FP, (slot_base - i) * kWordSize)); | 1131 __ sw(V0, Address(FP, (slot_base - i) * kWordSize)); |
| 1131 } | 1132 } |
| 1132 } | 1133 } |
| 1133 } | 1134 } |
| 1134 | 1135 |
| 1135 VisitBlocks(); | 1136 VisitBlocks(); |
| 1136 | 1137 |
| 1137 __ break_(0); | 1138 __ break_(0); |
| 1138 GenerateDeferredCode(); | 1139 GenerateDeferredCode(); |
| 1139 | 1140 |
| 1140 if (is_optimizing() && Compiler::allow_recompilation()) { | 1141 if (is_optimizing() && !FLAG_precompilation) { |
| 1141 // Leave enough space for patching in case of lazy deoptimization from | 1142 // Leave enough space for patching in case of lazy deoptimization from |
| 1142 // deferred code. | 1143 // deferred code. |
| 1143 for (intptr_t i = 0; | 1144 for (intptr_t i = 0; |
| 1144 i < CallPattern::kDeoptCallLengthInInstructions; | 1145 i < CallPattern::kDeoptCallLengthInInstructions; |
| 1145 ++i) { | 1146 ++i) { |
| 1146 __ nop(); | 1147 __ nop(); |
| 1147 } | 1148 } |
| 1148 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1149 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1149 __ Branch(*StubCode::DeoptimizeLazy_entry()); | 1150 __ Branch(*StubCode::DeoptimizeLazy_entry()); |
| 1150 } | 1151 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 __ LoadObject(S5, cache); | 1289 __ LoadObject(S5, cache); |
| 1289 if (FLAG_use_megamorphic_stub) { | 1290 if (FLAG_use_megamorphic_stub) { |
| 1290 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1291 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1291 } else { | 1292 } else { |
| 1292 StubCode::EmitMegamorphicLookup(assembler()); | 1293 StubCode::EmitMegamorphicLookup(assembler()); |
| 1293 } | 1294 } |
| 1294 __ jalr(T1); | 1295 __ jalr(T1); |
| 1295 | 1296 |
| 1296 RecordSafepoint(locs); | 1297 RecordSafepoint(locs); |
| 1297 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1298 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1298 if (Compiler::always_optimize()) { | 1299 if (FLAG_precompilation) { |
| 1299 // Megamorphic calls may occur in slow path stubs. | 1300 // Megamorphic calls may occur in slow path stubs. |
| 1300 // If valid use try_index argument. | 1301 // If valid use try_index argument. |
| 1301 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1302 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1302 try_index = CurrentTryIndex(); | 1303 try_index = CurrentTryIndex(); |
| 1303 } | 1304 } |
| 1304 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1305 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
| 1305 assembler()->CodeSize(), | 1306 assembler()->CodeSize(), |
| 1306 Thread::kNoDeoptId, | 1307 Thread::kNoDeoptId, |
| 1307 token_pos, | 1308 token_pos, |
| 1308 try_index); | 1309 try_index); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 __ AddImmediate(SP, kDoubleSize); | 1899 __ AddImmediate(SP, kDoubleSize); |
| 1899 } | 1900 } |
| 1900 | 1901 |
| 1901 | 1902 |
| 1902 #undef __ | 1903 #undef __ |
| 1903 | 1904 |
| 1904 | 1905 |
| 1905 } // namespace dart | 1906 } // namespace dart |
| 1906 | 1907 |
| 1907 #endif // defined TARGET_ARCH_MIPS | 1908 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |