| 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 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3350   if (!type.IsInstantiated() || type.IsMalformedOrMalbounded()) { | 3350   if (!type.IsInstantiated() || type.IsMalformedOrMalbounded()) { | 
| 3351     return Bool::null(); | 3351     return Bool::null(); | 
| 3352   } | 3352   } | 
| 3353   const Class& type_class = Class::Handle(type.type_class()); | 3353   const Class& type_class = Class::Handle(type.type_class()); | 
| 3354   const intptr_t num_type_args = type_class.NumTypeArguments(); | 3354   const intptr_t num_type_args = type_class.NumTypeArguments(); | 
| 3355   if (num_type_args > 0) { | 3355   if (num_type_args > 0) { | 
| 3356     // Only raw types can be directly compared, thus disregarding type | 3356     // Only raw types can be directly compared, thus disregarding type | 
| 3357     // arguments. | 3357     // arguments. | 
| 3358     const intptr_t num_type_params = type_class.NumTypeParameters(); | 3358     const intptr_t num_type_params = type_class.NumTypeParameters(); | 
| 3359     const intptr_t from_index = num_type_args - num_type_params; | 3359     const intptr_t from_index = num_type_args - num_type_params; | 
| 3360     const AbstractTypeArguments& type_arguments = | 3360     const TypeArguments& type_arguments = | 
| 3361         AbstractTypeArguments::Handle(type.arguments()); | 3361         TypeArguments::Handle(type.arguments()); | 
| 3362     const bool is_raw_type = type_arguments.IsNull() || | 3362     const bool is_raw_type = type_arguments.IsNull() || | 
| 3363         type_arguments.IsRaw(from_index, num_type_params); | 3363         type_arguments.IsRaw(from_index, num_type_params); | 
| 3364     if (!is_raw_type) { | 3364     if (!is_raw_type) { | 
| 3365       // Unknown result. | 3365       // Unknown result. | 
| 3366       return Bool::null(); | 3366       return Bool::null(); | 
| 3367     } | 3367     } | 
| 3368   } | 3368   } | 
| 3369   const ClassTable& class_table = *Isolate::Current()->class_table(); | 3369   const ClassTable& class_table = *Isolate::Current()->class_table(); | 
| 3370   Bool& prev = Bool::Handle(); | 3370   Bool& prev = Bool::Handle(); | 
| 3371   Class& cls = Class::Handle(); | 3371   Class& cls = Class::Handle(); | 
| (...skipping 3737 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7109   // TODO(kmillikin): Treat closures as constants. | 7109   // TODO(kmillikin): Treat closures as constants. | 
| 7110   SetValue(instr, non_constant_); | 7110   SetValue(instr, non_constant_); | 
| 7111 } | 7111 } | 
| 7112 | 7112 | 
| 7113 | 7113 | 
| 7114 void ConstantPropagator::VisitAllocateObject(AllocateObjectInstr* instr) { | 7114 void ConstantPropagator::VisitAllocateObject(AllocateObjectInstr* instr) { | 
| 7115   SetValue(instr, non_constant_); | 7115   SetValue(instr, non_constant_); | 
| 7116 } | 7116 } | 
| 7117 | 7117 | 
| 7118 | 7118 | 
| 7119 void ConstantPropagator::VisitAllocateObjectWithBoundsCheck( |  | 
| 7120     AllocateObjectWithBoundsCheckInstr* instr) { |  | 
| 7121   SetValue(instr, non_constant_); |  | 
| 7122 } |  | 
| 7123 |  | 
| 7124 |  | 
| 7125 void ConstantPropagator::VisitLoadUntagged(LoadUntaggedInstr* instr) { | 7119 void ConstantPropagator::VisitLoadUntagged(LoadUntaggedInstr* instr) { | 
| 7126   SetValue(instr, non_constant_); | 7120   SetValue(instr, non_constant_); | 
| 7127 } | 7121 } | 
| 7128 | 7122 | 
| 7129 | 7123 | 
| 7130 void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { | 7124 void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { | 
| 7131   intptr_t cid = instr->object()->Type()->ToCid(); | 7125   intptr_t cid = instr->object()->Type()->ToCid(); | 
| 7132   if (cid != kDynamicCid) { | 7126   if (cid != kDynamicCid) { | 
| 7133     SetValue(instr, Smi::ZoneHandle(Smi::New(cid))); | 7127     SetValue(instr, Smi::ZoneHandle(Smi::New(cid))); | 
| 7134     return; | 7128     return; | 
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8473   } | 8467   } | 
| 8474 | 8468 | 
| 8475   // Insert materializations at environment uses. | 8469   // Insert materializations at environment uses. | 
| 8476   for (intptr_t i = 0; i < exits.length(); i++) { | 8470   for (intptr_t i = 0; i < exits.length(); i++) { | 
| 8477     CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 8471     CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 
| 8478   } | 8472   } | 
| 8479 } | 8473 } | 
| 8480 | 8474 | 
| 8481 | 8475 | 
| 8482 }  // namespace dart | 8476 }  // namespace dart | 
| OLD | NEW | 
|---|