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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 intptr_t argument_count, 1278 intptr_t argument_count,
1279 intptr_t deopt_id, 1279 intptr_t deopt_id,
1280 intptr_t token_pos, 1280 intptr_t token_pos,
1281 LocationSummary* locs) { 1281 LocationSummary* locs) {
1282 const String& name = String::Handle(zone(), ic_data.target_name()); 1282 const String& name = String::Handle(zone(), ic_data.target_name());
1283 const Array& arguments_descriptor = 1283 const Array& arguments_descriptor =
1284 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); 1284 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1285 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); 1285 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
1286 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), 1286 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1287 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); 1287 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1288 const Register receiverR = ECX;
1289 const Register cacheR = EBX;
1290 const Register targetR = EBX;
1291 __ movl(receiverR, Address(ESP, (argument_count - 1) * kWordSize));
1292 __ LoadObject(cacheR, cache);
1293 1288
1289 __ Comment("MegamorphicCall");
1290 __ movl(EBX, Address(ESP, (argument_count - 1) * kWordSize));
1291 __ LoadObject(ECX, cache);
1294 if (FLAG_use_megamorphic_stub) { 1292 if (FLAG_use_megamorphic_stub) {
1295 __ Call(*StubCode::MegamorphicLookup_entry()); 1293 __ Call(*StubCode::MegamorphicLookup_entry());
1296 } else { 1294 } else {
1297 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); 1295 StubCode::EmitMegamorphicLookup(assembler());
1298 } 1296 }
1297 __ call(EBX);
1299 1298
1300 __ LoadObject(ECX, ic_data);
1301 __ LoadObject(EDX, arguments_descriptor);
1302 __ call(targetR);
1303 AddCurrentDescriptor(RawPcDescriptors::kOther, 1299 AddCurrentDescriptor(RawPcDescriptors::kOther,
1304 Thread::kNoDeoptId, token_pos); 1300 Thread::kNoDeoptId, token_pos);
1305 RecordSafepoint(locs); 1301 RecordSafepoint(locs);
1302 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1303 if (is_optimizing()) {
1304 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1305 } else {
1306 // Add deoptimization continuation point after the call and before the
1307 // arguments are removed.
1308 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
1309 }
1310 __ Drop(argument_count);
1311 }
1312
1313
1314 void FlowGraphCompiler::EmitSwitchableInstanceCall(
1315 const ICData& ic_data,
1316 intptr_t argument_count,
1317 intptr_t deopt_id,
1318 intptr_t token_pos,
1319 LocationSummary* locs) {
1320 __ Comment("SwitchableCall");
1321 __ movl(EBX, Address(ESP, (argument_count - 1) * kWordSize));
1322 if (ic_data.NumArgsTested() == 1) {
1323 __ LoadObject(ECX, ic_data);
1324 __ Call(*StubCode::ICLookup_entry());
1325 } else {
1326 const String& name = String::Handle(zone(), ic_data.target_name());
1327 const Array& arguments_descriptor =
1328 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1329 ASSERT(!arguments_descriptor.IsNull() &&
1330 (arguments_descriptor.Length() > 0));
1331 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1332 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1333
1334 __ LoadObject(ECX, cache);
1335 __ Call(*StubCode::MegamorphicLookup_entry());
1336 }
1337 __ call(EBX);
1338
1339 AddCurrentDescriptor(RawPcDescriptors::kOther,
1340 Thread::kNoDeoptId, token_pos);
1341 RecordSafepoint(locs);
1306 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1342 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1307 if (is_optimizing()) { 1343 if (is_optimizing()) {
1308 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1344 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1309 } else { 1345 } else {
1310 // Add deoptimization continuation point after the call and before the 1346 // Add deoptimization continuation point after the call and before the
1311 // arguments are removed. 1347 // arguments are removed.
1312 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); 1348 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
1313 } 1349 }
1314 __ Drop(argument_count); 1350 __ Drop(argument_count);
1315 } 1351 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 __ movups(reg, Address(ESP, 0)); 1863 __ movups(reg, Address(ESP, 0));
1828 __ addl(ESP, Immediate(kFpuRegisterSize)); 1864 __ addl(ESP, Immediate(kFpuRegisterSize));
1829 } 1865 }
1830 1866
1831 1867
1832 #undef __ 1868 #undef __
1833 1869
1834 } // namespace dart 1870 } // namespace dart
1835 1871
1836 #endif // defined TARGET_ARCH_IA32 1872 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698