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

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

Issue 16780009: When canonicalize instances check if all fields are canonical. If a field is a non-canonical number… (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
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 5418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 const Integer& left_int = Integer::Cast(left); 5429 const Integer& left_int = Integer::Cast(left);
5430 const Integer& right_int = Integer::Cast(right); 5430 const Integer& right_int = Integer::Cast(right);
5431 switch (op_kind) { 5431 switch (op_kind) {
5432 case Token::kADD: 5432 case Token::kADD:
5433 case Token::kSUB: 5433 case Token::kSUB:
5434 case Token::kMUL: 5434 case Token::kMUL:
5435 case Token::kTRUNCDIV: 5435 case Token::kTRUNCDIV:
5436 case Token::kMOD: { 5436 case Token::kMOD: {
5437 Instance& result = Integer::ZoneHandle( 5437 Instance& result = Integer::ZoneHandle(
5438 left_int.ArithmeticOp(op_kind, right_int)); 5438 left_int.ArithmeticOp(op_kind, right_int));
5439 result = result.Canonicalize(); 5439 result = result.CheckAndCanonicalize(NULL);
5440 ASSERT(!result.IsNull());
5440 SetValue(instr, result); 5441 SetValue(instr, result);
5441 break; 5442 break;
5442 } 5443 }
5443 case Token::kSHL: 5444 case Token::kSHL:
5444 case Token::kSHR: 5445 case Token::kSHR:
5445 if (left.IsSmi() && right.IsSmi()) { 5446 if (left.IsSmi() && right.IsSmi()) {
5446 Instance& result = Integer::ZoneHandle( 5447 Instance& result = Integer::ZoneHandle(
5447 Smi::Cast(left_int).ShiftOp(op_kind, Smi::Cast(right_int))); 5448 Smi::Cast(left_int).ShiftOp(op_kind, Smi::Cast(right_int)));
5448 result = result.Canonicalize(); 5449 result = result.CheckAndCanonicalize(NULL);
5450 ASSERT(!result.IsNull());
5449 SetValue(instr, result); 5451 SetValue(instr, result);
5450 } else { 5452 } else {
5451 SetValue(instr, non_constant_); 5453 SetValue(instr, non_constant_);
5452 } 5454 }
5453 break; 5455 break;
5454 case Token::kBIT_AND: 5456 case Token::kBIT_AND:
5455 case Token::kBIT_OR: 5457 case Token::kBIT_OR:
5456 case Token::kBIT_XOR: { 5458 case Token::kBIT_XOR: {
5457 Instance& result = Integer::ZoneHandle( 5459 Instance& result = Integer::ZoneHandle(
5458 left_int.BitOp(op_kind, right_int)); 5460 left_int.BitOp(op_kind, right_int));
5459 result = result.Canonicalize(); 5461 result = result.CheckAndCanonicalize(NULL);
5462 ASSERT(!result.IsNull());
5460 SetValue(instr, result); 5463 SetValue(instr, result);
5461 break; 5464 break;
5462 } 5465 }
5463 case Token::kDIV: 5466 case Token::kDIV:
5464 SetValue(instr, non_constant_); 5467 SetValue(instr, non_constant_);
5465 break; 5468 break;
5466 default: 5469 default:
5467 UNREACHABLE(); 5470 UNREACHABLE();
5468 } 5471 }
5469 } else { 5472 } else {
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6592 6595
6593 // Insert materializations at environment uses. 6596 // Insert materializations at environment uses.
6594 const Class& cls = Class::Handle(alloc->constructor().Owner()); 6597 const Class& cls = Class::Handle(alloc->constructor().Owner());
6595 for (intptr_t i = 0; i < exits.length(); i++) { 6598 for (intptr_t i = 0; i < exits.length(); i++) {
6596 CreateMaterializationAt(exits[i], alloc, cls, *fields); 6599 CreateMaterializationAt(exits[i], alloc, cls, *fields);
6597 } 6600 }
6598 } 6601 }
6599 6602
6600 6603
6601 } // namespace dart 6604 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698