Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 8b40a249d34372d793adad1c69c6496d82e5bd52..146c191f53bdbd67f3043d6bd15737ec10f90b86 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,22 @@ 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 += increase_by_value; |
+ if (!addition_result.IsValid()) return false; |
+ base_offset = addition_result.ValueOrDie(); |
+ if (!BaseOffsetField::is_valid(base_offset)) return false; |
+ bit_field_ = BaseOffsetField::update(bit_field_, base_offset); |
+ return true; |
+} |
+ |
+ |
bool HLoadKeyed::UsesMustHandleHole() const { |
if (IsFastPackedElementsKind(elements_kind())) { |
return false; |
@@ -4062,6 +4079,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 += increase_by_value; |
+ 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 |