OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/double.h" | 7 #include "src/double.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/hydrogen-infer-representation.h" | 9 #include "src/hydrogen-infer-representation.h" |
10 #include "src/property-details-inl.h" | 10 #include "src/property-details-inl.h" |
| 11 #include "src/base/safe_math.h" |
11 | 12 |
12 #if V8_TARGET_ARCH_IA32 | 13 #if V8_TARGET_ARCH_IA32 |
13 #include "src/ia32/lithium-ia32.h" | 14 #include "src/ia32/lithium-ia32.h" |
14 #elif V8_TARGET_ARCH_X64 | 15 #elif V8_TARGET_ARCH_X64 |
15 #include "src/x64/lithium-x64.h" | 16 #include "src/x64/lithium-x64.h" |
16 #elif V8_TARGET_ARCH_ARM64 | 17 #elif V8_TARGET_ARCH_ARM64 |
17 #include "src/arm64/lithium-arm64.h" | 18 #include "src/arm64/lithium-arm64.h" |
18 #elif V8_TARGET_ARCH_ARM | 19 #elif V8_TARGET_ARCH_ARM |
19 #include "src/arm/lithium-arm.h" | 20 #include "src/arm/lithium-arm.h" |
20 #elif V8_TARGET_ARCH_MIPS | 21 #elif V8_TARGET_ARCH_MIPS |
(...skipping 3456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3477 stream->Add(" "); | 3478 stream->Add(" "); |
3478 dependency()->PrintNameTo(stream); | 3479 dependency()->PrintNameTo(stream); |
3479 } | 3480 } |
3480 | 3481 |
3481 if (RequiresHoleCheck()) { | 3482 if (RequiresHoleCheck()) { |
3482 stream->Add(" check_hole"); | 3483 stream->Add(" check_hole"); |
3483 } | 3484 } |
3484 } | 3485 } |
3485 | 3486 |
3486 | 3487 |
| 3488 bool HLoadKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { |
| 3489 // The base offset is usually simply the size of the array header, except |
| 3490 // with dehoisting adds an addition offset due to a array index key |
| 3491 // manipulation, in which case it becomes (array header size + |
| 3492 // constant-offset-from-key * kPointerSize) |
| 3493 uint32_t base_offset = BaseOffsetField::decode(bit_field_); |
| 3494 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset; |
| 3495 addition_result += increase_by_value; |
| 3496 if (!addition_result.IsValid()) return false; |
| 3497 base_offset = addition_result.ValueOrDie(); |
| 3498 if (!BaseOffsetField::is_valid(base_offset)) return false; |
| 3499 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); |
| 3500 return true; |
| 3501 } |
| 3502 |
| 3503 |
3487 bool HLoadKeyed::UsesMustHandleHole() const { | 3504 bool HLoadKeyed::UsesMustHandleHole() const { |
3488 if (IsFastPackedElementsKind(elements_kind())) { | 3505 if (IsFastPackedElementsKind(elements_kind())) { |
3489 return false; | 3506 return false; |
3490 } | 3507 } |
3491 | 3508 |
3492 if (IsExternalArrayElementsKind(elements_kind())) { | 3509 if (IsExternalArrayElementsKind(elements_kind())) { |
3493 return false; | 3510 return false; |
3494 } | 3511 } |
3495 | 3512 |
3496 if (hole_mode() == ALLOW_RETURN_HOLE) { | 3513 if (hole_mode() == ALLOW_RETURN_HOLE) { |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4055 stream->Add(" ("); | 4072 stream->Add(" ("); |
4056 if (IsNewSpaceAllocation()) stream->Add("N"); | 4073 if (IsNewSpaceAllocation()) stream->Add("N"); |
4057 if (IsOldPointerSpaceAllocation()) stream->Add("P"); | 4074 if (IsOldPointerSpaceAllocation()) stream->Add("P"); |
4058 if (IsOldDataSpaceAllocation()) stream->Add("D"); | 4075 if (IsOldDataSpaceAllocation()) stream->Add("D"); |
4059 if (MustAllocateDoubleAligned()) stream->Add("A"); | 4076 if (MustAllocateDoubleAligned()) stream->Add("A"); |
4060 if (MustPrefillWithFiller()) stream->Add("F"); | 4077 if (MustPrefillWithFiller()) stream->Add("F"); |
4061 stream->Add(")"); | 4078 stream->Add(")"); |
4062 } | 4079 } |
4063 | 4080 |
4064 | 4081 |
| 4082 bool HStoreKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { |
| 4083 // The base offset is usually simply the size of the array header, except |
| 4084 // with dehoisting adds an addition offset due to a array index key |
| 4085 // manipulation, in which case it becomes (array header size + |
| 4086 // constant-offset-from-key * kPointerSize) |
| 4087 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; |
| 4088 addition_result += increase_by_value; |
| 4089 if (!addition_result.IsValid()) return false; |
| 4090 base_offset_ = addition_result.ValueOrDie(); |
| 4091 return true; |
| 4092 } |
| 4093 |
| 4094 |
4065 bool HStoreKeyed::NeedsCanonicalization() { | 4095 bool HStoreKeyed::NeedsCanonicalization() { |
4066 // If value is an integer or smi or comes from the result of a keyed load or | 4096 // If value is an integer or smi or comes from the result of a keyed load or |
4067 // constant then it is either be a non-hole value or in the case of a constant | 4097 // constant then it is either be a non-hole value or in the case of a constant |
4068 // the hole is only being stored explicitly: no need for canonicalization. | 4098 // the hole is only being stored explicitly: no need for canonicalization. |
4069 // | 4099 // |
4070 // The exception to that is keyed loads from external float or double arrays: | 4100 // The exception to that is keyed loads from external float or double arrays: |
4071 // these can load arbitrary representation of NaN. | 4101 // these can load arbitrary representation of NaN. |
4072 | 4102 |
4073 if (value()->IsConstant()) { | 4103 if (value()->IsConstant()) { |
4074 return false; | 4104 return false; |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4839 break; | 4869 break; |
4840 case kExternalMemory: | 4870 case kExternalMemory: |
4841 stream->Add("[external-memory]"); | 4871 stream->Add("[external-memory]"); |
4842 break; | 4872 break; |
4843 } | 4873 } |
4844 | 4874 |
4845 stream->Add("@%d", offset()); | 4875 stream->Add("@%d", offset()); |
4846 } | 4876 } |
4847 | 4877 |
4848 } } // namespace v8::internal | 4878 } } // namespace v8::internal |
OLD | NEW |