| 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 d9a11c4c258f9a5043f1e0abb8cfd022296070e1..e044923a6cbfce33366e5aad8c97bcfe8df471e3 100644
|
| --- a/runtime/vm/flow_graph_compiler_x64.cc
|
| +++ b/runtime/vm/flow_graph_compiler_x64.cc
|
| @@ -1534,7 +1534,8 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
| Label* match_found,
|
| intptr_t deopt_id,
|
| TokenPosition token_index,
|
| - LocationSummary* locs) {
|
| + LocationSummary* locs,
|
| + bool complete) {
|
| ASSERT(is_optimizing());
|
|
|
| __ Comment("EmitTestAndCall");
|
| @@ -1552,8 +1553,8 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
| ASSERT(!ic_data.IsNull() && (kNumChecks > 0));
|
|
|
| Label after_smi_test;
|
| - __ testq(RAX, Immediate(kSmiTagMask));
|
| if (kFirstCheckIsSmi) {
|
| + __ testq(RAX, Immediate(kSmiTagMask));
|
| // Jump if receiver is not Smi.
|
| if (kNumChecks == 1) {
|
| __ j(NOT_ZERO, failed);
|
| @@ -1577,7 +1578,10 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
| } else {
|
| // Receiver is Smi, but Smi is not a valid class therefore fail.
|
| // (Smi class must be first in the list).
|
| - __ j(ZERO, failed);
|
| + if (!complete) {
|
| + __ testq(RAX, Immediate(kSmiTagMask));
|
| + __ j(ZERO, failed);
|
| + }
|
| }
|
| __ Bind(&after_smi_test);
|
|
|
| @@ -1596,11 +1600,18 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
| const bool kIsLastCheck = (i == (kSortedLen - 1));
|
| ASSERT(sorted[i].cid != kSmiCid);
|
| Label next_test;
|
| - __ cmpl(RDI, Immediate(sorted[i].cid));
|
| - if (kIsLastCheck) {
|
| - __ j(NOT_EQUAL, failed);
|
| + if (!complete) {
|
| + __ cmpl(RDI, Immediate(sorted[i].cid));
|
| + if (kIsLastCheck) {
|
| + __ j(NOT_EQUAL, failed);
|
| + } else {
|
| + __ j(NOT_EQUAL, &next_test);
|
| + }
|
| } else {
|
| - __ j(NOT_EQUAL, &next_test);
|
| + if (!kIsLastCheck) {
|
| + __ cmpl(RDI, Immediate(sorted[i].cid));
|
| + __ j(NOT_EQUAL, &next_test);
|
| + }
|
| }
|
| // Do not use the code from the function, but let the code be patched so
|
| // that we can record the outgoing edges to other code.
|
|
|