| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| 11 #include "vm/flow_graph_builder.h" | 11 #include "vm/flow_graph_builder.h" |
| 12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/flow_graph_optimizer.h" | 13 #include "vm/flow_graph_optimizer.h" |
| 14 #include "vm/locations.h" | 14 #include "vm/locations.h" |
| 15 #include "vm/object.h" | 15 #include "vm/object.h" |
| 16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 17 #include "vm/os.h" | 17 #include "vm/os.h" |
| 18 #include "vm/resolver.h" | 18 #include "vm/resolver.h" |
| 19 #include "vm/scopes.h" | 19 #include "vm/scopes.h" |
| 20 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
| 22 | 22 |
| 23 #include "vm/il_printer.h" | 23 #include "vm/il_printer.h" |
| 24 | 24 |
| 25 namespace dart { | 25 namespace dart { |
| 26 | 26 |
| 27 DEFINE_FLAG(bool, propagate_ic_data, true, | 27 DEFINE_FLAG(bool, propagate_ic_data, true, |
| 28 "Propagate IC data from unoptimized to optimized IC calls."); | 28 "Propagate IC data from unoptimized to optimized IC calls."); |
| 29 DEFINE_FLAG(bool, unbox_double_fields, true, "Support unboxed double fields."); | 29 DEFINE_FLAG(bool, unbox_numeric_fields, true, |
| 30 "Support unboxed double and float32x4 fields."); |
| 30 DECLARE_FLAG(bool, enable_type_checks); | 31 DECLARE_FLAG(bool, enable_type_checks); |
| 31 DECLARE_FLAG(bool, eliminate_type_checks); | 32 DECLARE_FLAG(bool, eliminate_type_checks); |
| 32 DECLARE_FLAG(bool, trace_optimization); | 33 DECLARE_FLAG(bool, trace_optimization); |
| 33 DECLARE_FLAG(bool, trace_constant_propagation); | 34 DECLARE_FLAG(bool, trace_constant_propagation); |
| 34 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 35 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 35 | 36 |
| 36 Definition::Definition() | 37 Definition::Definition() |
| 37 : range_(NULL), | 38 : range_(NULL), |
| 38 type_(NULL), | 39 type_(NULL), |
| 39 temp_index_(-1), | 40 temp_index_(-1), |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 132 } |
| 132 CompileType* in_type = value()->Type(); | 133 CompileType* in_type = value()->Type(); |
| 133 const intptr_t cid = unary_checks().GetCidAt(0); | 134 const intptr_t cid = unary_checks().GetCidAt(0); |
| 134 // Performance check: use CheckSmiInstr instead. | 135 // Performance check: use CheckSmiInstr instead. |
| 135 ASSERT(cid != kSmiCid); | 136 ASSERT(cid != kSmiCid); |
| 136 return in_type->is_nullable() && (in_type->ToNullableCid() == cid); | 137 return in_type->is_nullable() && (in_type->ToNullableCid() == cid); |
| 137 } | 138 } |
| 138 | 139 |
| 139 | 140 |
| 140 bool LoadFieldInstr::IsUnboxedLoad() const { | 141 bool LoadFieldInstr::IsUnboxedLoad() const { |
| 141 return FLAG_unbox_double_fields | 142 return FLAG_unbox_numeric_fields |
| 142 && (field() != NULL) | 143 && (field() != NULL) |
| 143 && field()->IsUnboxedField(); | 144 && field()->IsUnboxedField(); |
| 144 } | 145 } |
| 145 | 146 |
| 146 | 147 |
| 147 bool LoadFieldInstr::IsPotentialUnboxedLoad() const { | 148 bool LoadFieldInstr::IsPotentialUnboxedLoad() const { |
| 148 return FLAG_unbox_double_fields | 149 return FLAG_unbox_numeric_fields |
| 149 && (field() != NULL) | 150 && (field() != NULL) |
| 150 && field()->IsPotentialUnboxedField(); | 151 && field()->IsPotentialUnboxedField(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 | 154 |
| 154 Representation LoadFieldInstr::representation() const { | 155 Representation LoadFieldInstr::representation() const { |
| 155 if (IsUnboxedLoad()) { | 156 if (IsUnboxedLoad()) { |
| 156 const intptr_t cid = field()->UnboxedFieldCid(); | 157 const intptr_t cid = field()->UnboxedFieldCid(); |
| 157 switch (cid) { | 158 switch (cid) { |
| 158 case kDoubleCid: | 159 case kDoubleCid: |
| 159 return kUnboxedDouble; | 160 return kUnboxedDouble; |
| 160 // TODO(johnmccutchan): Add kFloat32x4Cid here. | 161 case kFloat32x4Cid: |
| 162 return kUnboxedFloat32x4; |
| 161 default: | 163 default: |
| 162 UNREACHABLE(); | 164 UNREACHABLE(); |
| 163 } | 165 } |
| 164 } | 166 } |
| 165 return kTagged; | 167 return kTagged; |
| 166 } | 168 } |
| 167 | 169 |
| 168 | 170 |
| 169 bool StoreInstanceFieldInstr::IsUnboxedStore() const { | 171 bool StoreInstanceFieldInstr::IsUnboxedStore() const { |
| 170 return FLAG_unbox_double_fields && field().IsUnboxedField(); | 172 return FLAG_unbox_numeric_fields && field().IsUnboxedField(); |
| 171 } | 173 } |
| 172 | 174 |
| 173 | 175 |
| 174 bool StoreInstanceFieldInstr::IsPotentialUnboxedStore() const { | 176 bool StoreInstanceFieldInstr::IsPotentialUnboxedStore() const { |
| 175 return FLAG_unbox_double_fields && field().IsPotentialUnboxedField(); | 177 return FLAG_unbox_numeric_fields && field().IsPotentialUnboxedField(); |
| 176 } | 178 } |
| 177 | 179 |
| 178 | 180 |
| 179 Representation StoreInstanceFieldInstr::RequiredInputRepresentation( | 181 Representation StoreInstanceFieldInstr::RequiredInputRepresentation( |
| 180 intptr_t index) const { | 182 intptr_t index) const { |
| 181 ASSERT((index == 0) || (index == 1)); | 183 ASSERT((index == 0) || (index == 1)); |
| 182 if ((index == 1) && IsUnboxedStore()) { | 184 if ((index == 1) && IsUnboxedStore()) { |
| 183 const intptr_t cid = field().UnboxedFieldCid(); | 185 const intptr_t cid = field().UnboxedFieldCid(); |
| 184 switch (cid) { | 186 switch (cid) { |
| 185 case kDoubleCid: | 187 case kDoubleCid: |
| 186 return kUnboxedDouble; | 188 return kUnboxedDouble; |
| 189 case kFloat32x4Cid: |
| 190 return kUnboxedFloat32x4; |
| 187 default: | 191 default: |
| 188 UNREACHABLE(); | 192 UNREACHABLE(); |
| 189 } | 193 } |
| 190 } | 194 } |
| 191 return kTagged; | 195 return kTagged; |
| 192 } | 196 } |
| 193 | 197 |
| 194 | 198 |
| 195 bool GuardFieldInstr::AttributesEqual(Instruction* other) const { | 199 bool GuardFieldInstr::AttributesEqual(Instruction* other) const { |
| 196 return field().raw() == other->AsGuardField()->field().raw(); | 200 return field().raw() == other->AsGuardField()->field().raw(); |
| (...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3137 case Token::kTRUNCDIV: return 0; | 3141 case Token::kTRUNCDIV: return 0; |
| 3138 case Token::kMOD: return 1; | 3142 case Token::kMOD: return 1; |
| 3139 default: UNIMPLEMENTED(); return -1; | 3143 default: UNIMPLEMENTED(); return -1; |
| 3140 } | 3144 } |
| 3141 } | 3145 } |
| 3142 | 3146 |
| 3143 | 3147 |
| 3144 #undef __ | 3148 #undef __ |
| 3145 | 3149 |
| 3146 } // namespace dart | 3150 } // namespace dart |
| OLD | NEW |