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

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

Issue 25604003: Take representation into account in ConstantPropagator::VisitInstanceOfInstr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | no next file » | 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/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 6306 matching lines...) Expand 10 before | Expand all | Expand 10 after
6317 if (IsNonConstant(value)) { 6317 if (IsNonConstant(value)) {
6318 SetValue(instr, non_constant_); 6318 SetValue(instr, non_constant_);
6319 } else if (IsConstant(value)) { 6319 } else if (IsConstant(value)) {
6320 bool val = value.raw() != Bool::True().raw(); 6320 bool val = value.raw() != Bool::True().raw();
6321 SetValue(instr, Bool::Get(val)); 6321 SetValue(instr, Bool::Get(val));
6322 } 6322 }
6323 } 6323 }
6324 6324
6325 6325
6326 void ConstantPropagator::VisitInstanceOf(InstanceOfInstr* instr) { 6326 void ConstantPropagator::VisitInstanceOf(InstanceOfInstr* instr) {
6327 const Object& value = instr->value()->definition()->constant_value(); 6327 const Definition* def = instr->value()->definition();
6328 const Object& value = def->constant_value();
6328 if (IsNonConstant(value)) { 6329 if (IsNonConstant(value)) {
6329 SetValue(instr, non_constant_); 6330 const AbstractType& checked_type = instr->type();
6331 Representation rep = def->representation();
6332 if ((checked_type.IsFloat32x4Type() && (rep == kUnboxedFloat32x4)) ||
6333 (checked_type.IsUint32x4Type() && (rep == kUnboxedUint32x4)) ||
6334 (checked_type.IsDoubleType() && (rep == kUnboxedDouble)) ||
6335 (checked_type.IsIntType() && (rep == kUnboxedMint))) {
6336 // The representation guarantees the type check to be true.
Florian Schneider 2013/10/03 09:06:55 Maybe add an ASSERT that the compile-type of instr
Cutch 2013/11/06 23:04:43 Done.
6337 SetValue(instr, instr->negate_result() ? Bool::False() : Bool::True());
6338 } else {
6339 SetValue(instr, non_constant_);
6340 }
6330 } else if (IsConstant(value)) { 6341 } else if (IsConstant(value)) {
6331 // TODO(kmillikin): Handle instanceof on constants. 6342 // TODO(kmillikin): Handle instanceof on constants.
6332 SetValue(instr, non_constant_); 6343 SetValue(instr, non_constant_);
6333 } 6344 }
6334 } 6345 }
6335 6346
6336 6347
6337 void ConstantPropagator::VisitCreateArray(CreateArrayInstr* instr) { 6348 void ConstantPropagator::VisitCreateArray(CreateArrayInstr* instr) {
6338 SetValue(instr, non_constant_); 6349 SetValue(instr, non_constant_);
6339 } 6350 }
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
7755 } 7766 }
7756 7767
7757 // Insert materializations at environment uses. 7768 // Insert materializations at environment uses.
7758 for (intptr_t i = 0; i < exits.length(); i++) { 7769 for (intptr_t i = 0; i < exits.length(); i++) {
7759 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7770 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7760 } 7771 }
7761 } 7772 }
7762 7773
7763 7774
7764 } // namespace dart 7775 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698