Chromium Code Reviews| 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 = addition_result + increase_by_value; | |
|
Jakob Kummerow
2014/06/20 08:24:50
nit: consider using += for conciseness.
mvstanton
2014/06/23 08:31:14
Done.
| |
| 3496 if (!addition_result.IsValid() || | |
| 3497 !BaseOffsetField::is_valid(base_offset + increase_by_value)) { | |
|
Jakob Kummerow
2014/06/20 08:24:50
I'd split this check in two to make it clearer wha
mvstanton
2014/06/23 08:31:14
Good idea, thx, I like it better too.
| |
| 3498 return false; | |
| 3499 } | |
| 3500 base_offset = addition_result.ValueOrDie(); | |
| 3501 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); | |
| 3502 return true; | |
| 3503 } | |
| 3504 | |
| 3505 | |
| 3487 bool HLoadKeyed::UsesMustHandleHole() const { | 3506 bool HLoadKeyed::UsesMustHandleHole() const { |
| 3488 if (IsFastPackedElementsKind(elements_kind())) { | 3507 if (IsFastPackedElementsKind(elements_kind())) { |
| 3489 return false; | 3508 return false; |
| 3490 } | 3509 } |
| 3491 | 3510 |
| 3492 if (IsExternalArrayElementsKind(elements_kind())) { | 3511 if (IsExternalArrayElementsKind(elements_kind())) { |
| 3493 return false; | 3512 return false; |
| 3494 } | 3513 } |
| 3495 | 3514 |
| 3496 if (hole_mode() == ALLOW_RETURN_HOLE) { | 3515 if (hole_mode() == ALLOW_RETURN_HOLE) { |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4055 stream->Add(" ("); | 4074 stream->Add(" ("); |
| 4056 if (IsNewSpaceAllocation()) stream->Add("N"); | 4075 if (IsNewSpaceAllocation()) stream->Add("N"); |
| 4057 if (IsOldPointerSpaceAllocation()) stream->Add("P"); | 4076 if (IsOldPointerSpaceAllocation()) stream->Add("P"); |
| 4058 if (IsOldDataSpaceAllocation()) stream->Add("D"); | 4077 if (IsOldDataSpaceAllocation()) stream->Add("D"); |
| 4059 if (MustAllocateDoubleAligned()) stream->Add("A"); | 4078 if (MustAllocateDoubleAligned()) stream->Add("A"); |
| 4060 if (MustPrefillWithFiller()) stream->Add("F"); | 4079 if (MustPrefillWithFiller()) stream->Add("F"); |
| 4061 stream->Add(")"); | 4080 stream->Add(")"); |
| 4062 } | 4081 } |
| 4063 | 4082 |
| 4064 | 4083 |
| 4084 bool HStoreKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { | |
| 4085 // The base offset is usually simply the size of the array header, except | |
| 4086 // with dehoisting adds an addition offset due to a array index key | |
| 4087 // manipulation, in which case it becomes (array header size + | |
| 4088 // constant-offset-from-key * kPointerSize) | |
| 4089 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; | |
| 4090 addition_result = addition_result + increase_by_value; | |
|
Jakob Kummerow
2014/06/20 08:24:50
nit: +=
mvstanton
2014/06/23 08:31:14
Done.
| |
| 4091 if (!addition_result.IsValid()) return false; | |
| 4092 base_offset_ = addition_result.ValueOrDie(); | |
| 4093 return true; | |
| 4094 } | |
| 4095 | |
| 4096 | |
| 4065 bool HStoreKeyed::NeedsCanonicalization() { | 4097 bool HStoreKeyed::NeedsCanonicalization() { |
| 4066 // If value is an integer or smi or comes from the result of a keyed load or | 4098 // 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 | 4099 // 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. | 4100 // the hole is only being stored explicitly: no need for canonicalization. |
| 4069 // | 4101 // |
| 4070 // The exception to that is keyed loads from external float or double arrays: | 4102 // The exception to that is keyed loads from external float or double arrays: |
| 4071 // these can load arbitrary representation of NaN. | 4103 // these can load arbitrary representation of NaN. |
| 4072 | 4104 |
| 4073 if (value()->IsConstant()) { | 4105 if (value()->IsConstant()) { |
| 4074 return false; | 4106 return false; |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4839 break; | 4871 break; |
| 4840 case kExternalMemory: | 4872 case kExternalMemory: |
| 4841 stream->Add("[external-memory]"); | 4873 stream->Add("[external-memory]"); |
| 4842 break; | 4874 break; |
| 4843 } | 4875 } |
| 4844 | 4876 |
| 4845 stream->Add("@%d", offset()); | 4877 stream->Add("@%d", offset()); |
| 4846 } | 4878 } |
| 4847 | 4879 |
| 4848 } } // namespace v8::internal | 4880 } } // namespace v8::internal |
| OLD | NEW |