| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen-uint32-analysis.h" | 5 #include "src/hydrogen-uint32-analysis.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 | 9 |
| 10 | 10 |
| 11 static bool IsUnsignedLoad(HLoadKeyed* instr) { | 11 static bool IsUnsignedLoad(HLoadKeyed* instr) { |
| 12 switch (instr->elements_kind()) { | 12 switch (instr->elements_kind()) { |
| 13 case EXTERNAL_UINT8_ELEMENTS: | |
| 14 case EXTERNAL_UINT16_ELEMENTS: | |
| 15 case EXTERNAL_UINT32_ELEMENTS: | |
| 16 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 17 case UINT8_ELEMENTS: | 13 case UINT8_ELEMENTS: |
| 18 case UINT16_ELEMENTS: | 14 case UINT16_ELEMENTS: |
| 19 case UINT32_ELEMENTS: | 15 case UINT32_ELEMENTS: |
| 20 case UINT8_CLAMPED_ELEMENTS: | 16 case UINT8_CLAMPED_ELEMENTS: |
| 21 return true; | 17 return true; |
| 22 default: | 18 default: |
| 23 return false; | 19 return false; |
| 24 } | 20 } |
| 25 } | 21 } |
| 26 | 22 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 // Conversions have special support for uint32. | 39 // Conversions have special support for uint32. |
| 44 // This DCHECK guards that the conversion in question is actually | 40 // This DCHECK guards that the conversion in question is actually |
| 45 // implemented. Do not extend the whitelist without adding | 41 // implemented. Do not extend the whitelist without adding |
| 46 // support to LChunkBuilder::DoChange(). | 42 // support to LChunkBuilder::DoChange(). |
| 47 DCHECK(HChange::cast(use)->to().IsDouble() || | 43 DCHECK(HChange::cast(use)->to().IsDouble() || |
| 48 HChange::cast(use)->to().IsSmi() || | 44 HChange::cast(use)->to().IsSmi() || |
| 49 HChange::cast(use)->to().IsTagged()); | 45 HChange::cast(use)->to().IsTagged()); |
| 50 return true; | 46 return true; |
| 51 } else if (use->IsStoreKeyed()) { | 47 } else if (use->IsStoreKeyed()) { |
| 52 HStoreKeyed* store = HStoreKeyed::cast(use); | 48 HStoreKeyed* store = HStoreKeyed::cast(use); |
| 53 if (store->is_external()) { | 49 if (store->is_fixed_typed_array()) { |
| 54 // Storing a value into an external integer array is a bit level | 50 // Storing a value into an external integer array is a bit level |
| 55 // operation. | 51 // operation. |
| 56 if (store->value() == val) { | 52 if (store->value() == val) { |
| 57 // Clamping or a conversion to double should have beed inserted. | 53 // Clamping or a conversion to double should have beed inserted. |
| 58 DCHECK(store->elements_kind() != EXTERNAL_UINT8_CLAMPED_ELEMENTS); | 54 DCHECK(store->elements_kind() != UINT8_CLAMPED_ELEMENTS); |
| 59 DCHECK(store->elements_kind() != EXTERNAL_FLOAT32_ELEMENTS); | 55 DCHECK(store->elements_kind() != FLOAT32_ELEMENTS); |
| 60 DCHECK(store->elements_kind() != EXTERNAL_FLOAT64_ELEMENTS); | 56 DCHECK(store->elements_kind() != FLOAT64_ELEMENTS); |
| 61 return true; | 57 return true; |
| 62 } | 58 } |
| 63 } | 59 } |
| 64 } else if (use->IsCompareNumericAndBranch()) { | 60 } else if (use->IsCompareNumericAndBranch()) { |
| 65 HCompareNumericAndBranch* c = HCompareNumericAndBranch::cast(use); | 61 HCompareNumericAndBranch* c = HCompareNumericAndBranch::cast(use); |
| 66 return IsUint32Operation(c->left()) && IsUint32Operation(c->right()); | 62 return IsUint32Operation(c->left()) && IsUint32Operation(c->right()); |
| 67 } | 63 } |
| 68 | 64 |
| 69 return false; | 65 return false; |
| 70 } | 66 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // Some phis might have been optimistically marked with kUint32 flag. | 228 // Some phis might have been optimistically marked with kUint32 flag. |
| 233 // Remove this flag from those phis that are unsafe and propagate | 229 // Remove this flag from those phis that are unsafe and propagate |
| 234 // this information transitively potentially clearing kUint32 flag | 230 // this information transitively potentially clearing kUint32 flag |
| 235 // from some non-phi operations that are used as operands to unsafe phis. | 231 // from some non-phi operations that are used as operands to unsafe phis. |
| 236 UnmarkUnsafePhis(); | 232 UnmarkUnsafePhis(); |
| 237 } | 233 } |
| 238 | 234 |
| 239 | 235 |
| 240 } // namespace internal | 236 } // namespace internal |
| 241 } // namespace v8 | 237 } // namespace v8 |
| OLD | NEW |