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" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 | 146 |
147 bool LoadFieldInstr::IsPotentialUnboxedLoad() const { | 147 bool LoadFieldInstr::IsPotentialUnboxedLoad() const { |
148 return FLAG_unbox_double_fields | 148 return FLAG_unbox_double_fields |
149 && (field() != NULL) | 149 && (field() != NULL) |
150 && field()->IsPotentialUnboxedField(); | 150 && field()->IsPotentialUnboxedField(); |
151 } | 151 } |
152 | 152 |
153 | 153 |
| 154 Representation LoadFieldInstr::representation() const { |
| 155 if (IsUnboxedLoad()) { |
| 156 const intptr_t cid = field()->UnboxedFieldCid(); |
| 157 switch (cid) { |
| 158 case kDoubleCid: |
| 159 return kUnboxedDouble; |
| 160 // TODO(johnmccutchan): Add kFloat32x4Cid here. |
| 161 default: |
| 162 UNREACHABLE(); |
| 163 } |
| 164 } |
| 165 return kTagged; |
| 166 } |
| 167 |
| 168 |
154 bool StoreInstanceFieldInstr::IsUnboxedStore() const { | 169 bool StoreInstanceFieldInstr::IsUnboxedStore() const { |
155 return FLAG_unbox_double_fields && field().IsUnboxedField(); | 170 return FLAG_unbox_double_fields && field().IsUnboxedField(); |
156 } | 171 } |
157 | 172 |
158 | 173 |
159 bool StoreInstanceFieldInstr::IsPotentialUnboxedStore() const { | 174 bool StoreInstanceFieldInstr::IsPotentialUnboxedStore() const { |
160 return FLAG_unbox_double_fields && field().IsPotentialUnboxedField(); | 175 return FLAG_unbox_double_fields && field().IsPotentialUnboxedField(); |
161 } | 176 } |
162 | 177 |
163 | 178 |
| 179 Representation StoreInstanceFieldInstr::RequiredInputRepresentation( |
| 180 intptr_t index) const { |
| 181 ASSERT((index == 0) || (index == 1)); |
| 182 if ((index == 1) && IsUnboxedStore()) { |
| 183 const intptr_t cid = field().UnboxedFieldCid(); |
| 184 switch (cid) { |
| 185 case kDoubleCid: |
| 186 return kUnboxedDouble; |
| 187 default: |
| 188 UNREACHABLE(); |
| 189 } |
| 190 } |
| 191 return kTagged; |
| 192 } |
| 193 |
| 194 |
164 bool GuardFieldInstr::AttributesEqual(Instruction* other) const { | 195 bool GuardFieldInstr::AttributesEqual(Instruction* other) const { |
165 return field().raw() == other->AsGuardField()->field().raw(); | 196 return field().raw() == other->AsGuardField()->field().raw(); |
166 } | 197 } |
167 | 198 |
168 | 199 |
169 bool AssertAssignableInstr::AttributesEqual(Instruction* other) const { | 200 bool AssertAssignableInstr::AttributesEqual(Instruction* other) const { |
170 AssertAssignableInstr* other_assert = other->AsAssertAssignable(); | 201 AssertAssignableInstr* other_assert = other->AsAssertAssignable(); |
171 ASSERT(other_assert != NULL); | 202 ASSERT(other_assert != NULL); |
172 // This predicate has to be commutative for DominatorBasedCSE to work. | 203 // This predicate has to be commutative for DominatorBasedCSE to work. |
173 // TODO(fschneider): Eliminate more asserts with subtype relation. | 204 // TODO(fschneider): Eliminate more asserts with subtype relation. |
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3106 case Token::kTRUNCDIV: return 0; | 3137 case Token::kTRUNCDIV: return 0; |
3107 case Token::kMOD: return 1; | 3138 case Token::kMOD: return 1; |
3108 default: UNIMPLEMENTED(); return -1; | 3139 default: UNIMPLEMENTED(); return -1; |
3109 } | 3140 } |
3110 } | 3141 } |
3111 | 3142 |
3112 | 3143 |
3113 #undef __ | 3144 #undef __ |
3114 | 3145 |
3115 } // namespace dart | 3146 } // namespace dart |
OLD | NEW |