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/execution/arguments-inl.h" 11 12namespace v8 { 13namespace internal { 14 15Handle<Object> BuiltinArguments::atOrUndefined(Isolate* isolate, 16 int index) const { 17 if (index >= length()) { 18 return isolate->factory()->undefined_value(); 19 } 20 return at<Object>(index); 21} 22 23Handle<Object> BuiltinArguments::receiver() const { return at<Object>(0); } 24 25Handle<JSFunction> BuiltinArguments::target() const { 26 int index = kTargetOffset; 27 return Handle<JSFunction>(address_of_arg_at(index)); 28} 29 30Handle<HeapObject> BuiltinArguments::new_target() const { 31 int index = kNewTargetOffset; 32 return Handle<JSFunction>(address_of_arg_at(index)); 33} 34 35} // namespace internal 36} // namespace v8 37 38#endif // V8_BUILTINS_BUILTINS_UTILS_INL_H_ 39