Commit 5cba7810 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Remove WasDetached() helper in elements.cc

This is not needed as this is already a method on all ArrayBufferViews
and there is only one caller which actually uses the cast.

Bug: v8:9183
Change-Id: Ic45b40bf433c870bc8cb0121c24755fd03ce405b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1622106
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61688}
parent 426bba70
......@@ -3056,15 +3056,10 @@ class TypedElementsAccessor
: kMaxUInt32;
}
static bool WasDetached(JSObject holder) {
JSArrayBufferView view = JSArrayBufferView::cast(holder);
return view->WasDetached();
}
static uint32_t GetCapacityImpl(JSObject holder,
FixedArrayBase backing_store) {
JSTypedArray typed_array = JSTypedArray::cast(holder);
if (WasDetached(typed_array)) return 0;
if (typed_array->WasDetached()) return 0;
// TODO(bmeurer, v8:4153): We need to support arbitrary size_t here.
return static_cast<uint32_t>(typed_array->length());
}
......@@ -3142,7 +3137,7 @@ class TypedElementsAccessor
// TODO(caitp): return Just(false) here when implementing strict throwing on
// detached views.
if (WasDetached(typed_array)) {
if (typed_array->WasDetached()) {
return Just(value->IsUndefined(isolate) && length > start_from);
}
......@@ -3203,7 +3198,7 @@ class TypedElementsAccessor
DisallowHeapAllocation no_gc;
JSTypedArray typed_array = JSTypedArray::cast(*receiver);
if (WasDetached(typed_array)) return Just<int64_t>(-1);
if (typed_array->WasDetached()) return Just<int64_t>(-1);
BackingStore elements = BackingStore::cast(typed_array->elements());
ctype typed_search_value;
......@@ -3255,7 +3250,7 @@ class TypedElementsAccessor
DisallowHeapAllocation no_gc;
JSTypedArray typed_array = JSTypedArray::cast(*receiver);
DCHECK(!WasDetached(typed_array));
DCHECK(!typed_array->WasDetached());
BackingStore elements = BackingStore::cast(typed_array->elements());
ctype typed_search_value;
......@@ -3300,7 +3295,7 @@ class TypedElementsAccessor
DisallowHeapAllocation no_gc;
JSTypedArray typed_array = JSTypedArray::cast(receiver);
DCHECK(!WasDetached(typed_array));
DCHECK(!typed_array->WasDetached());
BackingStore elements = BackingStore::cast(typed_array->elements());
......@@ -3320,7 +3315,7 @@ class TypedElementsAccessor
static Handle<FixedArray> CreateListFromArrayLikeImpl(Isolate* isolate,
Handle<JSObject> object,
uint32_t length) {
DCHECK(!WasDetached(*object));
DCHECK(!Handle<JSArrayBufferView>::cast(object)->WasDetached());
DCHECK(object->IsJSTypedArray());
Handle<FixedArray> result = isolate->factory()->NewFixedArray(length);
Handle<BackingStore> elements(BackingStore::cast(object->elements()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment