1// Copyright 2018 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#ifndef V8_BUILTINS_BUILTINS_UTILS_INL_H_
6#define V8_BUILTINS_BUILTINS_UTILS_INL_H_
7
8#include "src/builtins/builtins-utils.h"
9
10#include "src/arguments-inl.h"
11
12namespace v8 {
13namespace internal {
14
15Handle<Object> BuiltinArguments::atOrUndefined(Isolate* isolate, int index) {
16 if (index >= length()) {
17 return isolate->factory()->undefined_value();
18 }
19 return at<Object>(index);
20}
21
22Handle<Object> BuiltinArguments::receiver() { return at<Object>(0); }
23
24Handle<JSFunction> BuiltinArguments::target() {
25 return Arguments::at<JSFunction>(Arguments::length() - 1 - kTargetOffset);
26}
27
28Handle<HeapObject> BuiltinArguments::new_target() {
29 return Arguments::at<HeapObject>(Arguments::length() - 1 - kNewTargetOffset);
30}
31
32} // namespace internal
33} // namespace v8
34
35#endif // V8_BUILTINS_BUILTINS_UTILS_INL_H_
36