1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include 'src/builtins/builtins-typed-array-gen.h'
6
7namespace typed_array {
8const kBuiltinNameValues: constexpr string = '%TypedArray%.prototype.values';
9
10// %TypedArray%.values ()
11// https://tc39.github.io/ecma262/#sec-%typedarray%.values
12transitioning javascript builtin
13TypedArrayPrototypeValues(js-implicit context: NativeContext, receiver: JSAny)(
14    ...arguments): JSArrayIterator {
15  try {
16    const array: JSTypedArray = Cast<JSTypedArray>(receiver)
17        otherwise NotTypedArray;
18
19    EnsureAttached(array) otherwise IsDetached;
20    return CreateArrayIterator(array, IterationKind::kValues);
21  } label NotTypedArray deferred {
22    ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameValues);
23  } label IsDetached deferred {
24    ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameValues);
25  }
26}
27}
28