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

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

Issue 1418863003: Precompilation: Generate instance calls as IC calls that can switch to Megamoprhic calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 intptr_t argument_count, 1258 intptr_t argument_count,
1259 intptr_t deopt_id, 1259 intptr_t deopt_id,
1260 intptr_t token_pos, 1260 intptr_t token_pos,
1261 LocationSummary* locs) { 1261 LocationSummary* locs) {
1262 const String& name = String::Handle(zone(), ic_data.target_name()); 1262 const String& name = String::Handle(zone(), ic_data.target_name());
1263 const Array& arguments_descriptor = 1263 const Array& arguments_descriptor =
1264 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); 1264 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1265 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); 1265 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
1266 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), 1266 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1267 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); 1267 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1268 const Register receiverR = R0;
1269 const Register cacheR = R1;
1270 const Register targetR = R1;
1271 __ LoadFromOffset(kWord, receiverR, SP, (argument_count - 1) * kWordSize);
1272 __ LoadObject(cacheR, cache);
1273 1268
1269 __ Comment("MegamorphicCall");
1270 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize);
1271 __ LoadObject(R9, cache);
1274 if (FLAG_use_megamorphic_stub) { 1272 if (FLAG_use_megamorphic_stub) {
1275 __ BranchLink(*StubCode::MegamorphicLookup_entry()); 1273 __ BranchLink(*StubCode::MegamorphicLookup_entry());
1276 } else { 1274 } else {
1277 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); 1275 StubCode::EmitMegamorphicLookup(assembler());
1278 } 1276 }
1279 __ LoadObject(R9, ic_data); 1277 __ blx(R1);
1280 __ LoadObject(R4, arguments_descriptor); 1278
1281 __ blx(targetR);
1282 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos); 1279 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos);
1283 RecordSafepoint(locs); 1280 RecordSafepoint(locs);
1284 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1281 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1282 if (is_optimizing()) {
1283 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1284 } else {
1285 // Add deoptimization continuation point after the call and before the
1286 // arguments are removed.
1287 AddCurrentDescriptor(RawPcDescriptors::kDeopt,
1288 deopt_id_after, token_pos);
1289 }
1290 __ Drop(argument_count);
1291 }
1292
1293
1294 void FlowGraphCompiler::EmitSwitchableInstanceCall(
1295 const ICData& ic_data,
1296 intptr_t argument_count,
1297 intptr_t deopt_id,
1298 intptr_t token_pos,
1299 LocationSummary* locs) {
1300 __ Comment("SwitchableCall");
1301 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize);
1302 if (ic_data.NumArgsTested() == 1) {
1303 __ LoadUniqueObject(R9, ic_data);
1304 __ BranchLinkPatchable(*StubCode::ICLookup_entry());
1305 } else {
1306 const String& name = String::Handle(zone(), ic_data.target_name());
1307 const Array& arguments_descriptor =
1308 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1309 ASSERT(!arguments_descriptor.IsNull() &&
1310 (arguments_descriptor.Length() > 0));
1311 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1312 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1313
1314 __ LoadUniqueObject(R9, cache);
1315 __ BranchLinkPatchable(*StubCode::MegamorphicLookup_entry());
1316 }
1317 __ blx(R1);
1318
1319 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos);
1320 RecordSafepoint(locs);
1321 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1285 if (is_optimizing()) { 1322 if (is_optimizing()) {
1286 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1323 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1287 } else { 1324 } else {
1288 // Add deoptimization continuation point after the call and before the 1325 // Add deoptimization continuation point after the call and before the
1289 // arguments are removed. 1326 // arguments are removed.
1290 AddCurrentDescriptor(RawPcDescriptors::kDeopt, 1327 AddCurrentDescriptor(RawPcDescriptors::kDeopt,
1291 deopt_id_after, token_pos); 1328 deopt_id_after, token_pos);
1292 } 1329 }
1293 __ Drop(argument_count); 1330 __ Drop(argument_count);
1294 } 1331 }
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 DRegister dreg = EvenDRegisterOf(reg); 1910 DRegister dreg = EvenDRegisterOf(reg);
1874 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1911 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1875 } 1912 }
1876 1913
1877 1914
1878 #undef __ 1915 #undef __
1879 1916
1880 } // namespace dart 1917 } // namespace dart
1881 1918
1882 #endif // defined TARGET_ARCH_ARM 1919 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698