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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 11234047: Convert 'identical' to strict equal. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 13915)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -1531,6 +1531,29 @@
// <Expression> ::= StaticCall { function: Function
// arguments: <ArgumentList> }
void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
+ if (node->function().name() == Symbols::Identical()) {
+ // Attempt to replace identical with strcit equal early on.
+ // TODO(hausner): Evaluate if this can happen at AST building time.
+ const Class& cls = Class::Handle(node->function().Owner());
+ if (cls.IsTopLevel()) {
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
+ if (cls.library() == core_lib.raw()) {
+ ASSERT(node->arguments()->length() == 2);
+ ValueGraphVisitor for_left_value(owner(), temp_index());
+ node->arguments()->NodeAt(0)->Visit(&for_left_value);
+ Append(for_left_value);
+ ValueGraphVisitor for_right_value(owner(), temp_index());
+ node->arguments()->NodeAt(1)->Visit(&for_right_value);
+ Append(for_right_value);
+ StrictCompareInstr* comp = new StrictCompareInstr(
+ Token::kEQ_STRICT,
+ for_left_value.value(),
+ for_right_value.value());
+ ReturnDefinition(comp);
+ return;
+ }
+ }
+ }
ZoneGrowableArray<PushArgumentInstr*>* arguments =
new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
BuildPushArguments(*node->arguments(), arguments);
« no previous file with comments | « no previous file | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698