Chromium Code Reviews| 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" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 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 | 29 |
| 30 | 30 |
| 31 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 32 Assembler* assem = compiler->assembler(); | |
| 33 #define __ assem-> | |
| 34 __ Bind(entry_label()); | |
| 35 __ Comment("MegamorphicSlowPath"); | |
| 36 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | |
| 37 token_pos_, locs_, try_index_); | |
| 38 __ b(exit_label()); | |
| 39 #undef __ | |
| 40 } | |
| 41 | |
| 42 | |
| 31 FlowGraphCompiler::~FlowGraphCompiler() { | 43 FlowGraphCompiler::~FlowGraphCompiler() { |
| 32 // BlockInfos are zone-allocated, so their destructors are not called. | 44 // BlockInfos are zone-allocated, so their destructors are not called. |
| 33 // Verify the labels explicitly here. | 45 // Verify the labels explicitly here. |
| 34 for (int i = 0; i < block_info_.length(); ++i) { | 46 for (int i = 0; i < block_info_.length(); ++i) { |
| 35 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 47 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
| 36 } | 48 } |
| 37 } | 49 } |
| 38 | 50 |
| 39 | 51 |
| 40 bool FlowGraphCompiler::SupportsUnboxedDoubles() { | 52 bool FlowGraphCompiler::SupportsUnboxedDoubles() { |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1241 locs); | 1253 locs); |
| 1242 __ Drop(argument_count); | 1254 __ Drop(argument_count); |
| 1243 } | 1255 } |
| 1244 | 1256 |
| 1245 | 1257 |
| 1246 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1258 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1247 const ICData& ic_data, | 1259 const ICData& ic_data, |
| 1248 intptr_t argument_count, | 1260 intptr_t argument_count, |
| 1249 intptr_t deopt_id, | 1261 intptr_t deopt_id, |
| 1250 intptr_t token_pos, | 1262 intptr_t token_pos, |
| 1251 LocationSummary* locs) { | 1263 LocationSummary* locs, |
| 1264 intptr_t try_index) { | |
| 1252 const String& name = String::Handle(zone(), ic_data.target_name()); | 1265 const String& name = String::Handle(zone(), ic_data.target_name()); |
| 1253 const Array& arguments_descriptor = | 1266 const Array& arguments_descriptor = |
| 1254 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1267 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
| 1255 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1268 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
| 1256 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1269 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
| 1257 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1270 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
| 1258 | 1271 |
| 1259 __ Comment("MegamorphicCall"); | 1272 __ Comment("MegamorphicCall"); |
| 1260 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); | 1273 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); |
| 1261 __ LoadObject(R5, cache); | 1274 __ LoadObject(R5, cache); |
| 1262 if (FLAG_use_megamorphic_stub) { | 1275 if (FLAG_use_megamorphic_stub) { |
| 1263 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1276 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1264 } else { | 1277 } else { |
| 1265 StubCode::EmitMegamorphicLookup(assembler()); | 1278 StubCode::EmitMegamorphicLookup(assembler()); |
| 1266 } | 1279 } |
| 1267 __ blr(R1); | 1280 __ blr(R1); |
| 1268 | 1281 |
| 1269 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1282 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.
| |
| 1270 Thread::kNoDeoptId, token_pos); | 1283 Thread::kNoDeoptId, token_pos); |
| 1271 RecordSafepoint(locs); | 1284 RecordSafepoint(locs); |
| 1272 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1285 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1273 if (is_optimizing()) { | 1286 if (Compiler::always_optimize()) { |
| 1287 // Megamorphic calls may occur in slow path stubs. | |
| 1288 // If valid use try_index argument. | |
| 1289 if (try_index == CatchClauseNode::kInvalidTryIndex) { | |
| 1290 try_index = CurrentTryIndex(); | |
| 1291 } | |
| 1292 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | |
| 1293 assembler()->CodeSize(), | |
| 1294 Thread::kNoDeoptId, | |
| 1295 token_pos, | |
| 1296 try_index); | |
| 1297 } else if (is_optimizing()) { | |
| 1274 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1298 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1275 } else { | 1299 } else { |
| 1276 // Add deoptimization continuation point after the call and before the | 1300 // Add deoptimization continuation point after the call and before the |
| 1277 // arguments are removed. | 1301 // arguments are removed. |
| 1278 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1302 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1279 } | 1303 } |
| 1280 __ Drop(argument_count); | 1304 __ Drop(argument_count); |
| 1281 } | 1305 } |
| 1282 | 1306 |
| 1283 | 1307 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1857 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1881 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1858 __ PopDouble(reg); | 1882 __ PopDouble(reg); |
| 1859 } | 1883 } |
| 1860 | 1884 |
| 1861 | 1885 |
| 1862 #undef __ | 1886 #undef __ |
| 1863 | 1887 |
| 1864 } // namespace dart | 1888 } // namespace dart |
| 1865 | 1889 |
| 1866 #endif // defined TARGET_ARCH_ARM64 | 1890 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |