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 | 27 |
28 | 28 |
29 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | |
30 Assembler* assem = compiler->assembler(); | |
31 #define __ assem-> | |
32 __ Bind(entry_label()); | |
33 __ Comment("MegamorphicSlowPath"); | |
34 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | |
35 token_pos_, locs_, try_index_); | |
36 __ b(exit_label()); | |
37 #undef __ | |
38 } | |
39 | |
40 | |
29 FlowGraphCompiler::~FlowGraphCompiler() { | 41 FlowGraphCompiler::~FlowGraphCompiler() { |
30 // BlockInfos are zone-allocated, so their destructors are not called. | 42 // BlockInfos are zone-allocated, so their destructors are not called. |
31 // Verify the labels explicitly here. | 43 // Verify the labels explicitly here. |
32 for (int i = 0; i < block_info_.length(); ++i) { | 44 for (int i = 0; i < block_info_.length(); ++i) { |
33 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 45 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
34 } | 46 } |
35 } | 47 } |
36 | 48 |
37 | 49 |
38 bool FlowGraphCompiler::SupportsUnboxedDoubles() { | 50 bool FlowGraphCompiler::SupportsUnboxedDoubles() { |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1262 __ Comment("InstanceCall return"); | 1274 __ Comment("InstanceCall return"); |
1263 __ Drop(argument_count); | 1275 __ Drop(argument_count); |
1264 } | 1276 } |
1265 | 1277 |
1266 | 1278 |
1267 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1279 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
1268 const ICData& ic_data, | 1280 const ICData& ic_data, |
1269 intptr_t argument_count, | 1281 intptr_t argument_count, |
1270 intptr_t deopt_id, | 1282 intptr_t deopt_id, |
1271 intptr_t token_pos, | 1283 intptr_t token_pos, |
1272 LocationSummary* locs) { | 1284 LocationSummary* locs, |
1285 intptr_t try_index) { | |
1273 const String& name = String::Handle(zone(), ic_data.target_name()); | 1286 const String& name = String::Handle(zone(), ic_data.target_name()); |
1274 const Array& arguments_descriptor = | 1287 const Array& arguments_descriptor = |
1275 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1288 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
1276 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1289 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
1277 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1290 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
1278 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1291 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
1279 | 1292 |
1280 __ Comment("MegamorphicCall"); | 1293 __ Comment("MegamorphicCall"); |
1281 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); | 1294 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
1282 __ LoadObject(S5, cache); | 1295 __ LoadObject(S5, cache); |
1283 if (FLAG_use_megamorphic_stub) { | 1296 if (FLAG_use_megamorphic_stub) { |
1284 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1297 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
1285 } else { | 1298 } else { |
1286 StubCode::EmitMegamorphicLookup(assembler()); | 1299 StubCode::EmitMegamorphicLookup(assembler()); |
1287 } | 1300 } |
1288 __ jalr(T1); | 1301 __ jalr(T1); |
1289 | 1302 |
1290 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1303 AddCurrentDescriptor(RawPcDescriptors::kOther, |
Florian Schneider
2015/12/14 16:07:03
Move this into the else-branches below, so that we
srdjan
2015/12/15 17:52:03
Done.
| |
1291 Thread::kNoDeoptId, token_pos); | 1304 Thread::kNoDeoptId, token_pos); |
1292 RecordSafepoint(locs); | 1305 RecordSafepoint(locs); |
1293 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1306 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1294 if (is_optimizing()) { | 1307 if (Compiler::always_optimize()) { |
1308 // Megamorphic calls may occur in slow path stubs. | |
1309 // If valid use try_index argument. | |
1310 if (try_index == CatchClauseNode::kInvalidTryIndex) { | |
1311 try_index = CurrentTryIndex(); | |
1312 } | |
1313 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | |
1314 assembler()->CodeSize(), | |
1315 Thread::kNoDeoptId, | |
1316 token_pos, | |
1317 try_index); | |
1318 } else if (is_optimizing()) { | |
1295 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1319 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
1296 } else { | 1320 } else { |
1297 // Add deoptimization continuation point after the call and before the | 1321 // Add deoptimization continuation point after the call and before the |
1298 // arguments are removed. | 1322 // arguments are removed. |
1299 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1323 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1300 } | 1324 } |
1301 __ Drop(argument_count); | 1325 __ Drop(argument_count); |
1302 } | 1326 } |
1303 | 1327 |
1304 | 1328 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1879 __ AddImmediate(SP, kDoubleSize); | 1903 __ AddImmediate(SP, kDoubleSize); |
1880 } | 1904 } |
1881 | 1905 |
1882 | 1906 |
1883 #undef __ | 1907 #undef __ |
1884 | 1908 |
1885 | 1909 |
1886 } // namespace dart | 1910 } // namespace dart |
1887 | 1911 |
1888 #endif // defined TARGET_ARCH_MIPS | 1912 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |