summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/js-array-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects/js-array-inl.h')
-rw-r--r--deps/v8/src/objects/js-array-inl.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/deps/v8/src/objects/js-array-inl.h b/deps/v8/src/objects/js-array-inl.h
index 6bba2f0054..1128e190b2 100644
--- a/deps/v8/src/objects/js-array-inl.h
+++ b/deps/v8/src/objects/js-array-inl.h
@@ -204,6 +204,15 @@ void JSTypedArray::set_length(Object* value, WriteBarrierMode mode) {
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kLengthOffset, value, mode);
}
+bool JSTypedArray::HasJSTypedArrayPrototype(Isolate* isolate) {
+ DisallowHeapAllocation no_gc;
+ Object* proto = map()->prototype();
+ if (!proto->IsJSObject()) return false;
+
+ JSObject* proto_obj = JSObject::cast(proto);
+ return proto_obj->map()->prototype() == *isolate->typed_array_prototype();
+}
+
// static
MaybeHandle<JSTypedArray> JSTypedArray::Validate(Isolate* isolate,
Handle<Object> receiver,
@@ -227,6 +236,26 @@ MaybeHandle<JSTypedArray> JSTypedArray::Validate(Isolate* isolate,
return array;
}
+// static
+Handle<JSFunction> JSTypedArray::DefaultConstructor(
+ Isolate* isolate, Handle<JSTypedArray> exemplar) {
+ Handle<JSFunction> default_ctor = isolate->uint8_array_fun();
+ switch (exemplar->type()) {
+#define TYPED_ARRAY_CTOR(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: { \
+ default_ctor = isolate->type##_array_fun(); \
+ break; \
+ }
+
+ TYPED_ARRAYS(TYPED_ARRAY_CTOR)
+#undef TYPED_ARRAY_CTOR
+ default:
+ UNREACHABLE();
+ }
+
+ return default_ctor;
+}
+
#ifdef VERIFY_HEAP
ACCESSORS(JSTypedArray, raw_length, Object, kLengthOffset)
#endif