OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/js-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 value = effect = graph()->NewNode( | 1193 value = effect = graph()->NewNode( |
1194 simplified()->LoadTypedElement(external_array_type), buffer, | 1194 simplified()->LoadTypedElement(external_array_type), buffer, |
1195 base_pointer, external_pointer, index, effect, control); | 1195 base_pointer, external_pointer, index, effect, control); |
1196 break; | 1196 break; |
1197 } | 1197 } |
1198 case AccessMode::kStore: { | 1198 case AccessMode::kStore: { |
1199 // Ensure that the {value} is actually a Number. | 1199 // Ensure that the {value} is actually a Number. |
1200 value = effect = graph()->NewNode(simplified()->CheckNumber(), value, | 1200 value = effect = graph()->NewNode(simplified()->CheckNumber(), value, |
1201 effect, control); | 1201 effect, control); |
1202 | 1202 |
| 1203 // Introduce the appropriate truncation for {value}. Currently we |
| 1204 // only need to do this for ClamedUint8Array {receiver}s, as the |
| 1205 // other truncations are implicit in the StoreTypedElement, but we |
| 1206 // might want to change that at some point. |
| 1207 if (external_array_type == kExternalUint8ClampedArray) { |
| 1208 value = graph()->NewNode(simplified()->NumberToUint8Clamped(), value); |
| 1209 } |
| 1210 |
1203 // Check if we can skip the out-of-bounds store. | 1211 // Check if we can skip the out-of-bounds store. |
1204 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { | 1212 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
1205 Node* check = | 1213 Node* check = |
1206 graph()->NewNode(simplified()->NumberLessThan(), index, length); | 1214 graph()->NewNode(simplified()->NumberLessThan(), index, length); |
1207 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 1215 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
1208 check, control); | 1216 check, control); |
1209 | 1217 |
1210 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1218 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
1211 Node* etrue = effect; | 1219 Node* etrue = effect; |
1212 { | 1220 { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 return jsgraph()->javascript(); | 1617 return jsgraph()->javascript(); |
1610 } | 1618 } |
1611 | 1619 |
1612 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1620 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1613 return jsgraph()->simplified(); | 1621 return jsgraph()->simplified(); |
1614 } | 1622 } |
1615 | 1623 |
1616 } // namespace compiler | 1624 } // namespace compiler |
1617 } // namespace internal | 1625 } // namespace internal |
1618 } // namespace v8 | 1626 } // namespace v8 |
OLD | NEW |