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

Unified Diff: runtime/vm/flow_graph_compiler_x64.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/instructions_arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_x64.cc
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 2a80633d890a0e31ddade5801d90ad33788bb3c8..42b3677bc82c3adf48a372fd084373708321f716 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -1286,20 +1286,17 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
- const Register receiverR = RDI;
- const Register cacheR = RBX;
- const Register targetR = RCX;
- __ movq(receiverR, Address(RSP, (argument_count - 1) * kWordSize));
- __ LoadObject(cacheR, cache);
+ __ Comment("MegamorphicCall");
+ __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize));
+ __ LoadObject(RBX, cache);
if (FLAG_use_megamorphic_stub) {
__ Call(*StubCode::MegamorphicLookup_entry());
} else {
- StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR);
+ StubCode::EmitMegamorphicLookup(assembler());
}
- __ LoadObject(RBX, ic_data);
- __ LoadObject(R10, arguments_descriptor);
- __ call(targetR);
+ __ call(RCX);
+
AddCurrentDescriptor(RawPcDescriptors::kOther,
Thread::kNoDeoptId, token_pos);
RecordSafepoint(locs);
@@ -1315,6 +1312,46 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
}
+void FlowGraphCompiler::EmitSwitchableInstanceCall(
+ const ICData& ic_data,
+ intptr_t argument_count,
+ intptr_t deopt_id,
+ intptr_t token_pos,
+ LocationSummary* locs) {
+ __ Comment("SwitchableCall");
+ __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize));
+ if (ic_data.NumArgsTested() == 1) {
+ __ LoadUniqueObject(RBX, ic_data);
+ __ CallPatchable(*StubCode::ICLookup_entry());
+ } else {
+ const String& name = String::Handle(zone(), ic_data.target_name());
+ const Array& arguments_descriptor =
+ Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
+ ASSERT(!arguments_descriptor.IsNull() &&
+ (arguments_descriptor.Length() > 0));
+ const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
+ MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
+
+ __ LoadUniqueObject(RBX, cache);
+ __ CallPatchable(*StubCode::MegamorphicLookup_entry());
+ }
+ __ call(RCX);
+
+ AddCurrentDescriptor(RawPcDescriptors::kOther,
+ Thread::kNoDeoptId, token_pos);
+ RecordSafepoint(locs);
+ const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
+ if (is_optimizing()) {
+ AddDeoptIndexAtCall(deopt_id_after, token_pos);
+ } else {
+ // Add deoptimization continuation point after the call and before the
+ // arguments are removed.
+ AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
+ }
+ __ Drop(argument_count, RCX);
+}
+
+
void FlowGraphCompiler::EmitOptimizedStaticCall(
const Function& function,
const Array& arguments_descriptor,
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/instructions_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698