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

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

Issue 70133004: Constant propagation support for type asserts. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 6179 matching lines...) Expand 10 before | Expand all | Expand 10 after
6190 } 6190 }
6191 6191
6192 6192
6193 void ConstantPropagator::VisitAssertAssignable(AssertAssignableInstr* instr) { 6193 void ConstantPropagator::VisitAssertAssignable(AssertAssignableInstr* instr) {
6194 const Object& value = instr->value()->definition()->constant_value(); 6194 const Object& value = instr->value()->definition()->constant_value();
6195 if (IsNonConstant(value)) { 6195 if (IsNonConstant(value)) {
6196 SetValue(instr, non_constant_); 6196 SetValue(instr, non_constant_);
6197 } else if (IsConstant(value)) { 6197 } else if (IsConstant(value)) {
6198 // We are ignoring the instantiator and instantiator_type_arguments, but 6198 // We are ignoring the instantiator and instantiator_type_arguments, but
6199 // still monotonic and safe. 6199 // still monotonic and safe.
6200 // TODO(kmillikin): Handle constants. 6200 if (instr->value()->Type()->IsAssignableTo(instr->dst_type())) {
6201 SetValue(instr, non_constant_); 6201 SetValue(instr, value);
6202 } else {
6203 SetValue(instr, non_constant_);
6204 }
6202 } 6205 }
6203 } 6206 }
6204 6207
6205 6208
6206 void ConstantPropagator::VisitAssertBoolean(AssertBooleanInstr* instr) { 6209 void ConstantPropagator::VisitAssertBoolean(AssertBooleanInstr* instr) {
6207 const Object& value = instr->value()->definition()->constant_value(); 6210 const Object& value = instr->value()->definition()->constant_value();
6208 if (IsNonConstant(value)) { 6211 if (IsNonConstant(value)) {
6209 SetValue(instr, non_constant_); 6212 SetValue(instr, non_constant_);
6210 } else if (IsConstant(value)) { 6213 } else if (IsConstant(value)) {
6211 // TODO(kmillikin): Handle assertion. 6214 if (value.IsBool()) {
6212 SetValue(instr, non_constant_); 6215 SetValue(instr, value);
6216 } else {
6217 SetValue(instr, non_constant_);
6218 }
6213 } 6219 }
6214 } 6220 }
6215 6221
6216 6222
6217 void ConstantPropagator::VisitCurrentContext(CurrentContextInstr* instr) { 6223 void ConstantPropagator::VisitCurrentContext(CurrentContextInstr* instr) {
6218 SetValue(instr, non_constant_); 6224 SetValue(instr, non_constant_);
6219 } 6225 }
6220 6226
6221 6227
6222 void ConstantPropagator::VisitClosureCall(ClosureCallInstr* instr) { 6228 void ConstantPropagator::VisitClosureCall(ClosureCallInstr* instr) {
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
7906 } 7912 }
7907 7913
7908 // Insert materializations at environment uses. 7914 // Insert materializations at environment uses.
7909 for (intptr_t i = 0; i < exits.length(); i++) { 7915 for (intptr_t i = 0; i < exits.length(); i++) {
7910 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7916 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7911 } 7917 }
7912 } 7918 }
7913 7919
7914 7920
7915 } // namespace dart 7921 } // 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