Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index f5d5c527106c56929d0bc15fa3c6afed5a04b260..274c3dd9954fc353ea1f007f760daed85f45f106 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -6920,6 +6920,18 @@ void JSTypedArray::set_length(Object* value, WriteBarrierMode mode) { |
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kLengthOffset, value, mode); |
} |
+// static |
+MaybeHandle<JSTypedArray> JSTypedArray::Validate(Isolate* isolate, |
+ Handle<Object> receiver, |
+ const char* method_name) { |
+ if (V8_UNLIKELY(!receiver->IsJSTypedArray())) { |
+ const MessageTemplate::Template message = MessageTemplate::kNotTypedArray; |
+ THROW_NEW_ERROR(isolate, NewTypeError(message), JSTypedArray); |
+ } |
+ |
+ // TODO(caitp): throw if array.[[ViewedArrayBuffer]] is neutered (per v8:4648) |
+ return Handle<JSTypedArray>::cast(receiver); |
+} |
#ifdef VERIFY_HEAP |
ACCESSORS(JSTypedArray, raw_length, Object, kLengthOffset) |