| 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 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 __ sw(V0, Address(FP, (slot_base - i) * kWordSize)); | 1140 __ sw(V0, Address(FP, (slot_base - i) * kWordSize)); |
| 1140 } | 1141 } |
| 1141 } | 1142 } |
| 1142 } | 1143 } |
| 1143 | 1144 |
| 1144 VisitBlocks(); | 1145 VisitBlocks(); |
| 1145 | 1146 |
| 1146 __ break_(0); | 1147 __ break_(0); |
| 1147 GenerateDeferredCode(); | 1148 GenerateDeferredCode(); |
| 1148 | 1149 |
| 1149 if (is_optimizing() && !FLAG_precompiled_mode) { | 1150 if (is_optimizing() && !FLAG_precompilation) { |
| 1150 // Leave enough space for patching in case of lazy deoptimization from | 1151 // Leave enough space for patching in case of lazy deoptimization from |
| 1151 // deferred code. | 1152 // deferred code. |
| 1152 for (intptr_t i = 0; | 1153 for (intptr_t i = 0; |
| 1153 i < CallPattern::kDeoptCallLengthInInstructions; | 1154 i < CallPattern::kDeoptCallLengthInInstructions; |
| 1154 ++i) { | 1155 ++i) { |
| 1155 __ nop(); | 1156 __ nop(); |
| 1156 } | 1157 } |
| 1157 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1158 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1158 __ Branch(*StubCode::DeoptimizeLazy_entry()); | 1159 __ Branch(*StubCode::DeoptimizeLazy_entry()); |
| 1159 } | 1160 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 __ LoadObject(S5, cache); | 1328 __ LoadObject(S5, cache); |
| 1328 if (FLAG_use_megamorphic_stub) { | 1329 if (FLAG_use_megamorphic_stub) { |
| 1329 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1330 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1330 } else { | 1331 } else { |
| 1331 StubCode::EmitMegamorphicLookup(assembler()); | 1332 StubCode::EmitMegamorphicLookup(assembler()); |
| 1332 } | 1333 } |
| 1333 __ jalr(T1); | 1334 __ jalr(T1); |
| 1334 | 1335 |
| 1335 RecordSafepoint(locs); | 1336 RecordSafepoint(locs); |
| 1336 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1337 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1337 if (FLAG_precompiled_mode) { | 1338 if (FLAG_precompilation) { |
| 1338 // Megamorphic calls may occur in slow path stubs. | 1339 // Megamorphic calls may occur in slow path stubs. |
| 1339 // If valid use try_index argument. | 1340 // If valid use try_index argument. |
| 1340 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1341 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1341 try_index = CurrentTryIndex(); | 1342 try_index = CurrentTryIndex(); |
| 1342 } | 1343 } |
| 1343 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1344 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
| 1344 assembler()->CodeSize(), | 1345 assembler()->CodeSize(), |
| 1345 Thread::kNoDeoptId, | 1346 Thread::kNoDeoptId, |
| 1346 token_pos, | 1347 token_pos, |
| 1347 try_index); | 1348 try_index); |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 __ AddImmediate(SP, kDoubleSize); | 1939 __ AddImmediate(SP, kDoubleSize); |
| 1939 } | 1940 } |
| 1940 | 1941 |
| 1941 | 1942 |
| 1942 #undef __ | 1943 #undef __ |
| 1943 | 1944 |
| 1944 | 1945 |
| 1945 } // namespace dart | 1946 } // namespace dart |
| 1946 | 1947 |
| 1947 #endif // defined TARGET_ARCH_MIPS | 1948 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |