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

Unified Diff: runtime/vm/aot_optimizer.cc

Issue 3003793002: [vm,aot] Improve performance of certain 'is' operations (Closed)
Patch Set: Created 3 years, 4 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 | runtime/vm/flow_graph_type_propagator.cc » ('j') | runtime/vm/flow_graph_type_propagator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/aot_optimizer.cc
diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc
index 31897ebdd07c4b9b21ee6078db9a2dc75e44f63d..684c64a7f3a54e8d84ea066f1a8837dd6bd45402 100644
--- a/runtime/vm/aot_optimizer.cc
+++ b/runtime/vm/aot_optimizer.cc
@@ -1354,6 +1354,16 @@ void AotOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
ConstantInstr* lower_cid =
flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
+
+ if (lower_limit == upper_limit) {
Vyacheslav Egorov (Google) 2017/08/25 07:59:15 Does it make sense to do a similar optimization fo
alexmarkov 2017/08/29 22:45:32 I think you're right - 'as' and 'is' checks should
+ StrictCompareInstr* check_cid = new (Z) StrictCompareInstr(
+ call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left_cid),
+ new (Z) Value(lower_cid), /* number_check = */ false,
+ Thread::kNoDeoptId);
+ ReplaceCall(call, check_cid);
+ return;
+ }
+
ConstantInstr* upper_cid =
flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(upper_limit)));
« no previous file with comments | « no previous file | runtime/vm/flow_graph_type_propagator.cc » ('j') | runtime/vm/flow_graph_type_propagator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698