Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 12e30481d8e0723de87c6cfb82f648b1251e0d95..aaa06ad5914caa4a8a167d0f47ad62dbde08aa0a 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1171,11 +1171,8 @@ MaybeHandle<Object> Object::GetProperty(Handle<Object> object, |
MaybeHandle<Object> Object::GetElement(Isolate* isolate, |
Handle<Object> object, |
uint32_t index) { |
- // GetElement can trigger a getter which can cause allocation. |
- // This was not always the case. This DCHECK is here to catch |
- // leftover incorrect uses. |
- DCHECK(AllowHeapAllocation::IsAllowed()); |
- return Object::GetElementWithReceiver(isolate, object, object, index); |
+ LookupIterator it(isolate, object, index); |
+ return GetProperty(&it); |
} |
@@ -1214,14 +1211,6 @@ MaybeHandle<Object> Object::GetProperty(Isolate* isolate, |
} |
-MaybeHandle<Object> JSProxy::GetElementWithHandler(Handle<JSProxy> proxy, |
- Handle<Object> receiver, |
- uint32_t index) { |
- return GetPropertyWithHandler( |
- proxy, receiver, proxy->GetIsolate()->factory()->Uint32ToString(index)); |
-} |
- |
- |
MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy, |
Handle<JSReceiver> receiver, |
uint32_t index, |
@@ -2230,7 +2219,7 @@ void Struct::InitializeBody(int object_size) { |
} |
-bool Object::ToArrayIndex(uint32_t* index) { |
+bool Object::ToArrayLength(uint32_t* index) { |
if (IsSmi()) { |
int value = Smi::cast(this)->value(); |
if (value < 0) return false; |
@@ -2249,6 +2238,11 @@ bool Object::ToArrayIndex(uint32_t* index) { |
} |
+bool Object::ToArrayIndex(uint32_t* index) { |
+ return ToArrayLength(index) && *index != kMaxUInt32; |
+} |
+ |
+ |
bool Object::IsStringObjectWithCharacterAt(uint32_t index) { |
if (!this->IsJSValue()) return false; |
@@ -6546,6 +6540,14 @@ Object* JSTypedArray::length() const { |
} |
+uint32_t JSTypedArray::length_value() const { |
+ if (WasNeutered()) return 0; |
+ uint32_t index = 0; |
+ CHECK(Object::cast(READ_FIELD(this, kLengthOffset))->ToArrayLength(&index)); |
+ return index; |
+} |
+ |
+ |
void JSTypedArray::set_length(Object* value, WriteBarrierMode mode) { |
WRITE_FIELD(this, kLengthOffset, value); |
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kLengthOffset, value, mode); |
@@ -6857,7 +6859,7 @@ bool StringHasher::UpdateIndex(uint16_t c) { |
return false; |
} |
} |
- if (array_index_ > 429496729U - ((d + 2) >> 3)) { |
+ if (array_index_ > 429496729U - ((d + 3) >> 3)) { |
is_array_index_ = false; |
return false; |
} |