| OLD | NEW |
| 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 7218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7229 SetValue(instr, object); | 7229 SetValue(instr, object); |
| 7230 return; | 7230 return; |
| 7231 } | 7231 } |
| 7232 SetValue(instr, non_constant_); | 7232 SetValue(instr, non_constant_); |
| 7233 } | 7233 } |
| 7234 } | 7234 } |
| 7235 | 7235 |
| 7236 | 7236 |
| 7237 void ConstantPropagator::VisitExtractConstructorTypeArguments( | 7237 void ConstantPropagator::VisitExtractConstructorTypeArguments( |
| 7238 ExtractConstructorTypeArgumentsInstr* instr) { | 7238 ExtractConstructorTypeArgumentsInstr* instr) { |
| 7239 CompileType* type = instr->instantiator()->Type(); |
| 7240 if (type->HasDecidableNullability()) { |
| 7241 if (!type->is_nullable()) { |
| 7242 SetValue(instr, instr->type_arguments()); |
| 7243 return; |
| 7244 } |
| 7245 ASSERT(type->IsNull()); |
| 7246 SetValue(instr, instr->instantiator()->definition()->constant_value()); |
| 7247 return; |
| 7248 } |
| 7239 SetValue(instr, non_constant_); | 7249 SetValue(instr, non_constant_); |
| 7240 } | 7250 } |
| 7241 | 7251 |
| 7242 | 7252 |
| 7243 void ConstantPropagator::VisitExtractConstructorInstantiator( | 7253 void ConstantPropagator::VisitExtractConstructorInstantiator( |
| 7244 ExtractConstructorInstantiatorInstr* instr) { | 7254 ExtractConstructorInstantiatorInstr* instr) { |
| 7255 CompileType* type = instr->instantiator()->Type(); |
| 7256 if (type->HasDecidableNullability()) { |
| 7257 if (type->IsNull()) { |
| 7258 SetValue(instr, Smi::ZoneHandle(Smi::New(StubCode::kNoInstantiator))); |
| 7259 return; |
| 7260 } |
| 7261 ASSERT(!type->is_nullable()); |
| 7262 SetValue(instr, instr->instantiator()->definition()->constant_value()); |
| 7263 return; |
| 7264 } |
| 7245 SetValue(instr, non_constant_); | 7265 SetValue(instr, non_constant_); |
| 7246 } | 7266 } |
| 7247 | 7267 |
| 7248 | 7268 |
| 7249 void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) { | 7269 void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) { |
| 7250 SetValue(instr, non_constant_); | 7270 SetValue(instr, non_constant_); |
| 7251 } | 7271 } |
| 7252 | 7272 |
| 7253 | 7273 |
| 7254 void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) { | 7274 void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) { |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8480 } | 8500 } |
| 8481 | 8501 |
| 8482 // Insert materializations at environment uses. | 8502 // Insert materializations at environment uses. |
| 8483 for (intptr_t i = 0; i < exits.length(); i++) { | 8503 for (intptr_t i = 0; i < exits.length(); i++) { |
| 8484 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 8504 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 8485 } | 8505 } |
| 8486 } | 8506 } |
| 8487 | 8507 |
| 8488 | 8508 |
| 8489 } // namespace dart | 8509 } // namespace dart |
| OLD | NEW |