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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/code_descriptors.h" 8 #include "vm/code_descriptors.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 node->token_pos(), 1524 node->token_pos(),
1525 node->function_name(), Token::kILLEGAL, arguments, 1525 node->function_name(), Token::kILLEGAL, arguments,
1526 node->arguments()->names(), 1); 1526 node->arguments()->names(), 1);
1527 ReturnDefinition(call); 1527 ReturnDefinition(call);
1528 } 1528 }
1529 1529
1530 1530
1531 // <Expression> ::= StaticCall { function: Function 1531 // <Expression> ::= StaticCall { function: Function
1532 // arguments: <ArgumentList> } 1532 // arguments: <ArgumentList> }
1533 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { 1533 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
1534 if (node->function().name() == Symbols::Identical()) {
1535 // Attempt to replace identical with strcit equal early on.
1536 // TODO(hausner): Evaluate if this can happen at AST building time.
1537 const Class& cls = Class::Handle(node->function().Owner());
1538 if (cls.IsTopLevel()) {
1539 const Library& core_lib = Library::Handle(Library::CoreLibrary());
1540 if (cls.library() == core_lib.raw()) {
1541 ASSERT(node->arguments()->length() == 2);
1542 ValueGraphVisitor for_left_value(owner(), temp_index());
1543 node->arguments()->NodeAt(0)->Visit(&for_left_value);
1544 Append(for_left_value);
1545 ValueGraphVisitor for_right_value(owner(), temp_index());
1546 node->arguments()->NodeAt(1)->Visit(&for_right_value);
1547 Append(for_right_value);
1548 StrictCompareInstr* comp = new StrictCompareInstr(
1549 Token::kEQ_STRICT,
1550 for_left_value.value(),
1551 for_right_value.value());
1552 ReturnDefinition(comp);
1553 return;
1554 }
1555 }
1556 }
1534 ZoneGrowableArray<PushArgumentInstr*>* arguments = 1557 ZoneGrowableArray<PushArgumentInstr*>* arguments =
1535 new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); 1558 new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
1536 BuildPushArguments(*node->arguments(), arguments); 1559 BuildPushArguments(*node->arguments(), arguments);
1537 StaticCallInstr* call = 1560 StaticCallInstr* call =
1538 new StaticCallInstr(node->token_pos(), 1561 new StaticCallInstr(node->token_pos(),
1539 node->function(), 1562 node->function(),
1540 node->arguments()->names(), 1563 node->arguments()->names(),
1541 arguments); 1564 arguments);
1542 ReturnDefinition(call); 1565 ReturnDefinition(call);
1543 } 1566 }
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 2694 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
2672 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 2695 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
2673 OS::SNPrint(chars, len, kFormat, function_name, reason); 2696 OS::SNPrint(chars, len, kFormat, function_name, reason);
2674 const Error& error = Error::Handle( 2697 const Error& error = Error::Handle(
2675 LanguageError::New(String::Handle(String::New(chars)))); 2698 LanguageError::New(String::Handle(String::New(chars))));
2676 Isolate::Current()->long_jump_base()->Jump(1, error); 2699 Isolate::Current()->long_jump_base()->Jump(1, error);
2677 } 2700 }
2678 2701
2679 2702
2680 } // namespace dart 2703 } // namespace dart
OLDNEW
« 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