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

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 18053010: Equality can be converted to a strict equality with checks. If the number of checks exceeds the thr… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/intermediate_language.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 5680 matching lines...) Expand 10 before | Expand all | Expand 10 after
5691 } 5691 }
5692 5692
5693 5693
5694 void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) { 5694 void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) {
5695 const Object& left = instr->left()->definition()->constant_value(); 5695 const Object& left = instr->left()->definition()->constant_value();
5696 const Object& right = instr->right()->definition()->constant_value(); 5696 const Object& right = instr->right()->definition()->constant_value();
5697 5697
5698 if (instr->left()->definition() == instr->right()->definition()) { 5698 if (instr->left()->definition() == instr->right()->definition()) {
5699 // Fold x == x, and x != x to true/false for numbers and checked strict 5699 // Fold x == x, and x != x to true/false for numbers and checked strict
5700 // comparisons. 5700 // comparisons.
5701 if (instr->is_checked_strict_equal() || 5701 if (instr->IsCheckedStrictEqual() ||
5702 RawObject::IsIntegerClassId(instr->receiver_class_id())) { 5702 RawObject::IsIntegerClassId(instr->receiver_class_id())) {
5703 return SetValue(instr, 5703 return SetValue(instr,
5704 (instr->kind() == Token::kEQ) 5704 (instr->kind() == Token::kEQ)
5705 ? Bool::True() 5705 ? Bool::True()
5706 : Bool::False()); 5706 : Bool::False());
5707 } 5707 }
5708 } 5708 }
5709 5709
5710 if (IsNonConstant(left) || IsNonConstant(right)) { 5710 if (IsNonConstant(left) || IsNonConstant(right)) {
5711 SetValue(instr, non_constant_); 5711 SetValue(instr, non_constant_);
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
7129 7129
7130 // Insert materializations at environment uses. 7130 // Insert materializations at environment uses.
7131 const Class& cls = Class::Handle(alloc->constructor().Owner()); 7131 const Class& cls = Class::Handle(alloc->constructor().Owner());
7132 for (intptr_t i = 0; i < exits.length(); i++) { 7132 for (intptr_t i = 0; i < exits.length(); i++) {
7133 CreateMaterializationAt(exits[i], alloc, cls, *fields); 7133 CreateMaterializationAt(exits[i], alloc, cls, *fields);
7134 } 7134 }
7135 } 7135 }
7136 7136
7137 7137
7138 } // namespace dart 7138 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698