| 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,
|
|
|