Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.cc

Issue 1513883002: Polymorphic calls in precompilation invoke megamorphic calls when tests fail (instead of deoptimizi… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: g Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 13 matching lines...) Expand all
24 24
25 namespace dart { 25 namespace dart {
26 26
27 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 27 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
28 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); 28 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic.");
29 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic."); 29 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic.");
30 DECLARE_FLAG(bool, enable_simd_inline); 30 DECLARE_FLAG(bool, enable_simd_inline);
31 DECLARE_FLAG(bool, use_megamorphic_stub); 31 DECLARE_FLAG(bool, use_megamorphic_stub);
32 32
33 33
34 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) {
35 Assembler* assem = compiler->assembler();
Florian Schneider 2015/12/14 16:07:03 s/assem/assembler/
srdjan 2015/12/15 17:52:03 Done here and below (old code).
36 #define __ assem->
37 __ Bind(entry_label());
38 __ Comment("MegamorphicSlowPath");
39 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_,
40 token_pos_, locs_, try_index_);
41 __ b(exit_label());
42 #undef __
43 }
44
45
34 FlowGraphCompiler::~FlowGraphCompiler() { 46 FlowGraphCompiler::~FlowGraphCompiler() {
35 // BlockInfos are zone-allocated, so their destructors are not called. 47 // BlockInfos are zone-allocated, so their destructors are not called.
36 // Verify the labels explicitly here. 48 // Verify the labels explicitly here.
37 for (int i = 0; i < block_info_.length(); ++i) { 49 for (int i = 0; i < block_info_.length(); ++i) {
38 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 50 ASSERT(!block_info_[i]->jump_label()->IsLinked());
39 } 51 }
40 } 52 }
41 53
42 54
43 bool FlowGraphCompiler::SupportsUnboxedDoubles() { 55 bool FlowGraphCompiler::SupportsUnboxedDoubles() {
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 locs); 1263 locs);
1252 __ Drop(argument_count); 1264 __ Drop(argument_count);
1253 } 1265 }
1254 1266
1255 1267
1256 void FlowGraphCompiler::EmitMegamorphicInstanceCall( 1268 void FlowGraphCompiler::EmitMegamorphicInstanceCall(
1257 const ICData& ic_data, 1269 const ICData& ic_data,
1258 intptr_t argument_count, 1270 intptr_t argument_count,
1259 intptr_t deopt_id, 1271 intptr_t deopt_id,
1260 intptr_t token_pos, 1272 intptr_t token_pos,
1261 LocationSummary* locs) { 1273 LocationSummary* locs,
1274 intptr_t try_index) {
1262 const String& name = String::Handle(zone(), ic_data.target_name()); 1275 const String& name = String::Handle(zone(), ic_data.target_name());
1263 const Array& arguments_descriptor = 1276 const Array& arguments_descriptor =
1264 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); 1277 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1265 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); 1278 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
1266 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), 1279 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1267 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); 1280 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1268 1281
1269 __ Comment("MegamorphicCall"); 1282 __ Comment("MegamorphicCall");
1270 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); 1283 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize);
1271 __ LoadObject(R9, cache); 1284 __ LoadObject(R9, cache);
1272 if (FLAG_use_megamorphic_stub) { 1285 if (FLAG_use_megamorphic_stub) {
1273 __ BranchLink(*StubCode::MegamorphicLookup_entry()); 1286 __ BranchLink(*StubCode::MegamorphicLookup_entry());
1274 } else { 1287 } else {
1275 StubCode::EmitMegamorphicLookup(assembler()); 1288 StubCode::EmitMegamorphicLookup(assembler());
1276 } 1289 }
1277 __ blx(R1); 1290 __ blx(R1);
1278 1291
1279 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos); 1292 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos);
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.
1280 RecordSafepoint(locs); 1293 RecordSafepoint(locs);
1281 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1294 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1282 if (is_optimizing()) { 1295 if (Compiler::always_optimize()) {
1296 // Megamorphic calls may occur in slow path stubs.
1297 // If valid use try_index argument.
1298 if (try_index == CatchClauseNode::kInvalidTryIndex) {
1299 try_index = CurrentTryIndex();
1300 }
1301 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther,
1302 assembler()->CodeSize(),
1303 Thread::kNoDeoptId,
1304 token_pos,
1305 try_index);
1306 } else if (is_optimizing()) {
1283 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1307 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1284 } else { 1308 } else {
1285 // Add deoptimization continuation point after the call and before the 1309 // Add deoptimization continuation point after the call and before the
1286 // arguments are removed. 1310 // arguments are removed.
1287 AddCurrentDescriptor(RawPcDescriptors::kDeopt, 1311 AddCurrentDescriptor(RawPcDescriptors::kDeopt,
1288 deopt_id_after, token_pos); 1312 deopt_id_after, token_pos);
1289 } 1313 }
1290 __ Drop(argument_count); 1314 __ Drop(argument_count);
1291 } 1315 }
1292 1316
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 DRegister dreg = EvenDRegisterOf(reg); 1934 DRegister dreg = EvenDRegisterOf(reg);
1911 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1935 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1912 } 1936 }
1913 1937
1914 1938
1915 #undef __ 1939 #undef __
1916 1940
1917 } // namespace dart 1941 } // namespace dart
1918 1942
1919 #endif // defined TARGET_ARCH_ARM 1943 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698