v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
arguments-inl.h
Go to the documentation of this file.
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_EXECUTION_ARGUMENTS_INL_H_
6#define V8_EXECUTION_ARGUMENTS_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
12#include "src/objects/objects-inl.h" // TODO(jkummerow): Just smi-inl.h.
14
15namespace v8 {
16namespace internal {
17
18template <ArgumentsType T>
20 Arguments* args, int index,
21 Tagged<Object> value)
22 : location_(args->address_of_arg_at(index)) {
24 *location_ = value.ptr();
25}
26
27template <ArgumentsType T>
28int Arguments<T>::smi_value_at(int index) const {
29 Tagged<Object> obj = (*this)[index];
30 int value = Smi::ToInt(obj);
32 return value;
33}
34
35template <ArgumentsType T>
36uint32_t Arguments<T>::positive_smi_value_at(int index) const {
37 int value = smi_value_at(index);
38 DCHECK_LE(0, value);
39 return value;
40}
41
42template <ArgumentsType T>
44 return static_cast<int>(Cast<TaggedIndex>((*this)[index]).value());
45}
46
47template <ArgumentsType T>
48double Arguments<T>::number_value_at(int index) const {
49 return Object::NumberValue((*this)[index]);
50}
51
52template <ArgumentsType T>
54 if (index >= length_) {
55 return Cast<Object>(isolate->factory()->undefined_value());
56 }
57 return at<Object>(index);
58}
59
60} // namespace internal
61} // namespace v8
62
63#endif // V8_EXECUTION_ARGUMENTS_INL_H_
ChangeValueScope(Isolate *isolate, Arguments *args, int index, Tagged< Object > value)
V8_INLINE int smi_value_at(int index) const
V8_INLINE int tagged_index_value_at(int index) const
V8_INLINE uint32_t positive_smi_value_at(int index) const
V8_INLINE double number_value_at(int index) const
V8_INLINE Handle< S > at(int index) const
V8_INLINE Handle< Object > atOrUndefined(Isolate *isolate, int index) const
static double NumberValue(Tagged< Number > obj)
static constexpr int ToInt(const Tagged< Object > object)
Definition smi.h:33
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74
LinkageLocation location_
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
return value
Definition map-inl.h:893
bool IsTaggedIndex(Tagged< Object > obj)
Definition objects-inl.h:91
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define DCHECK_LE(v1, v2)
Definition logging.h:490
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493