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

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

Issue 16853005: Fix bug in constant propagation with double-equality. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | tests/language/arithmetic_test.dart » ('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 5168 matching lines...) Expand 10 before | Expand all | Expand 10 after
5179 5179
5180 5180
5181 void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) { 5181 void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) {
5182 const Object& left = instr->left()->definition()->constant_value(); 5182 const Object& left = instr->left()->definition()->constant_value();
5183 const Object& right = instr->right()->definition()->constant_value(); 5183 const Object& right = instr->right()->definition()->constant_value();
5184 5184
5185 if (instr->left()->definition() == instr->right()->definition()) { 5185 if (instr->left()->definition() == instr->right()->definition()) {
5186 // Fold x == x, and x != x to true/false for numbers and checked strict 5186 // Fold x == x, and x != x to true/false for numbers and checked strict
5187 // comparisons. 5187 // comparisons.
5188 if (instr->is_checked_strict_equal() || 5188 if (instr->is_checked_strict_equal() ||
5189 RawObject::IsNumberClassId(instr->receiver_class_id())) { 5189 RawObject::IsIntegerClassId(instr->receiver_class_id())) {
5190 return SetValue(instr, 5190 return SetValue(instr,
5191 (instr->kind() == Token::kEQ) 5191 (instr->kind() == Token::kEQ)
5192 ? Bool::True() 5192 ? Bool::True()
5193 : Bool::False()); 5193 : Bool::False());
5194 } 5194 }
5195 } 5195 }
5196 5196
5197 if (IsNonConstant(left) || IsNonConstant(right)) { 5197 if (IsNonConstant(left) || IsNonConstant(right)) {
5198 SetValue(instr, non_constant_); 5198 SetValue(instr, non_constant_);
5199 } else if (IsConstant(left) && IsConstant(right)) { 5199 } else if (IsConstant(left) && IsConstant(right)) {
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
6586 6586
6587 // Insert materializations at environment uses. 6587 // Insert materializations at environment uses.
6588 const Class& cls = Class::Handle(alloc->constructor().Owner()); 6588 const Class& cls = Class::Handle(alloc->constructor().Owner());
6589 for (intptr_t i = 0; i < exits.length(); i++) { 6589 for (intptr_t i = 0; i < exits.length(); i++) {
6590 CreateMaterializationAt(exits[i], alloc, cls, *fields); 6590 CreateMaterializationAt(exits[i], alloc, cls, *fields);
6591 } 6591 }
6592 } 6592 }
6593 6593
6594 6594
6595 } // namespace dart 6595 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/arithmetic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698