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

Unified Diff: runtime/vm/jit_optimizer.cc

Issue 2918503002: Revert "Prefer single CID test for 'is' operator" (Closed)
Patch Set: Created 3 years, 7 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/jit_optimizer.cc
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
index 842506320317addf7af94b5e340d089a13636fba..91c5e476e8ed5c3880c19bc77f7f1d918a2d1eec 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -1259,21 +1259,6 @@ void JitOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
function_type_args = call->ArgumentAt(2);
type = AbstractType::Cast(call->ArgumentAt(3)->AsConstant()->value()).raw();
}
-
- if (TypeCheckAsClassEquality(type)) {
- LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
- InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
- const intptr_t type_cid = Class::Handle(Z, type.type_class()).id();
- ConstantInstr* cid =
- flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid)));
-
- StrictCompareInstr* check_cid = new (Z) StrictCompareInstr(
- call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left_cid),
- new (Z) Value(cid), /* number_check = */ false, Thread::kNoDeoptId);
- ReplaceCall(call, check_cid);
- return;
- }
-
const ICData& unary_checks =
ICData::ZoneHandle(Z, call->ic_data()->AsUnaryClassChecks());
const intptr_t number_of_checks = unary_checks.NumberOfChecks();
@@ -1311,6 +1296,20 @@ void JitOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
}
}
+ if (TypeCheckAsClassEquality(type)) {
+ LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
+ InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
+ const intptr_t type_cid = Class::Handle(Z, type.type_class()).id();
+ ConstantInstr* cid =
+ flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid)));
+
+ StrictCompareInstr* check_cid = new (Z) StrictCompareInstr(
+ call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left_cid),
+ new (Z) Value(cid), /* number_check = */ false, Thread::kNoDeoptId);
+ ReplaceCall(call, check_cid);
+ return;
+ }
+
InstanceOfInstr* instance_of = new (Z) InstanceOfInstr(
call->token_pos(), new (Z) Value(left),
new (Z) Value(instantiator_type_args), new (Z) Value(function_type_args),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698