Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index 8b40a249d34372d793adad1c69c6496d82e5bd52..d7278658a752babb23c3755228956ac97f92131c 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -8,6 +8,7 @@ |
| #include "src/factory.h" |
| #include "src/hydrogen-infer-representation.h" |
| #include "src/property-details-inl.h" |
| +#include "src/base/safe_math.h" |
| #if V8_TARGET_ARCH_IA32 |
| #include "src/ia32/lithium-ia32.h" |
| @@ -3484,6 +3485,24 @@ void HLoadKeyed::PrintDataTo(StringStream* stream) { |
| } |
| +bool HLoadKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { |
| + // The base offset is usually simply the size of the array header, except |
| + // with dehoisting adds an addition offset due to a array index key |
| + // manipulation, in which case it becomes (array header size + |
| + // constant-offset-from-key * kPointerSize) |
| + uint32_t base_offset = BaseOffsetField::decode(bit_field_); |
| + v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset; |
| + 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.
|
| + if (!addition_result.IsValid() || |
| + !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.
|
| + return false; |
| + } |
| + base_offset = addition_result.ValueOrDie(); |
| + bit_field_ = BaseOffsetField::update(bit_field_, base_offset); |
| + return true; |
| +} |
| + |
| + |
| bool HLoadKeyed::UsesMustHandleHole() const { |
| if (IsFastPackedElementsKind(elements_kind())) { |
| return false; |
| @@ -4062,6 +4081,19 @@ void HAllocate::PrintDataTo(StringStream* stream) { |
| } |
| +bool HStoreKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { |
| + // The base offset is usually simply the size of the array header, except |
| + // with dehoisting adds an addition offset due to a array index key |
| + // manipulation, in which case it becomes (array header size + |
| + // constant-offset-from-key * kPointerSize) |
| + v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; |
| + addition_result = addition_result + increase_by_value; |
|
Jakob Kummerow
2014/06/20 08:24:50
nit: +=
mvstanton
2014/06/23 08:31:14
Done.
|
| + if (!addition_result.IsValid()) return false; |
| + base_offset_ = addition_result.ValueOrDie(); |
| + return true; |
| +} |
| + |
| + |
| bool HStoreKeyed::NeedsCanonicalization() { |
| // If value is an integer or smi or comes from the result of a keyed load or |
| // constant then it is either be a non-hole value or in the case of a constant |