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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 2379733002: Recognize and optimize a.runtimeType == b.runtimeType pattern. (Closed)
Patch Set: Done Created 4 years, 3 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
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index ab7c878e846a2b9d1be3bdb19ac5608f1ed6a5f1..f4278a505c37358de2f83b9749aa8ef5d5489f68 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -3226,6 +3226,23 @@ void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
#endif
+Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) {
+ if (!FLAG_precompiled_mode) {
+ return this;
+ }
+
+ if (function().recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
+ if (input_use_list() == NULL) {
+ // This function has only environment uses. In precompiled mode it is
+ // fine to remove it - because we will never deoptimize.
+ return flow_graph->constant_dead();
+ }
+ }
+
+ return this;
+}
+
+
LocationSummary* StaticCallInstr::MakeLocationSummary(Zone* zone,
bool optimizing) const {
return MakeCallSummary(zone);

Powered by Google App Engine
This is Rietveld 408576698