Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::NativeArguments Class Reference

#include <native_arguments.h>

Public Member Functions

Threadthread () const
 
int ArgCount () const
 
ObjectPtr ArgAt (int index) const
 
void SetArgAt (int index, const Object &value) const
 
int NativeArgCount () const
 
ObjectPtr NativeArg0 () const
 
ObjectPtr NativeArgAt (int index) const
 
TypeArgumentsPtr NativeTypeArgs () const
 
int NativeTypeArgCount () const
 
AbstractTypePtr NativeTypeArgAt (int index) const
 
void SetReturn (const Object &value) const
 
ObjectPtr ReturnValue () const
 

Static Public Member Functions

static intptr_t thread_offset ()
 
static intptr_t argc_tag_offset ()
 
static intptr_t argv_offset ()
 
static intptr_t retval_offset ()
 
static intptr_t ParameterCountForResolution (const Function &function)
 
static int ComputeArgcTag (const Function &function)
 

Friends

class Api
 
class NativeEntry
 
class Simulator
 

Detailed Description

Definition at line 79 of file native_arguments.h.

Member Function Documentation

◆ ArgAt()

ObjectPtr dart::NativeArguments::ArgAt ( int  index) const
inline

Definition at line 86 of file native_arguments.h.

86 {
87 ASSERT((index >= 0) && (index < ArgCount()));
88 ObjectPtr* arg_ptr = &(argv_[-index]);
89 // Tell MemorySanitizer the ObjectPtr was initialized (by generated code).
90 MSAN_UNPOISON(arg_ptr, kWordSize);
91 return *arg_ptr;
92 }
#define ASSERT(E)
#define MSAN_UNPOISON(ptr, len)
constexpr intptr_t kWordSize
Definition: globals.h:509

◆ argc_tag_offset()

static intptr_t dart::NativeArguments::argc_tag_offset ( )
inlinestatic

Definition at line 162 of file native_arguments.h.

162 {
163 return OFFSET_OF(NativeArguments, argc_tag_);
164 }
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ ArgCount()

int dart::NativeArguments::ArgCount ( ) const
inline

Definition at line 84 of file native_arguments.h.

84{ return ArgcBits::decode(argc_tag_); }
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ argv_offset()

static intptr_t dart::NativeArguments::argv_offset ( )
inlinestatic

Definition at line 165 of file native_arguments.h.

165{ return OFFSET_OF(NativeArguments, argv_); }

◆ ComputeArgcTag()

static int dart::NativeArguments::ComputeArgcTag ( const Function function)
inlinestatic

Definition at line 177 of file native_arguments.h.

177 {
178 ASSERT(function.is_old_native());
179 ASSERT(!function.IsGenerativeConstructor()); // Not supported.
180 ASSERT(!function.IsClosureFunction()); // Not supported.
181 int argc = function.NumParameters();
182 int function_bits = 0;
183 if (function.IsGeneric()) {
184 function_bits |= kGenericFunctionBit;
185 argc++;
186 }
187 int tag = ArgcBits::encode(argc);
188 tag = FunctionBits::update(function_bits, tag);
189 return tag;
190 }
static void encode(uint8_t output[16], const uint32_t input[4])
Definition: SkMD5.cpp:240
Dart_NativeFunction function
Definition: fuchsia.cc:51

◆ NativeArg0()

ObjectPtr dart::NativeArguments::NativeArg0 ( ) const
inline

Definition at line 106 of file native_arguments.h.

106 {
107 int function_bits = FunctionBits::decode(argc_tag_);
108 return ArgAt(NumHiddenArgs(function_bits));
109 }
ObjectPtr ArgAt(int index) const

◆ NativeArgAt()

ObjectPtr dart::NativeArguments::NativeArgAt ( int  index) const
inline

Definition at line 111 of file native_arguments.h.

111 {
112 ASSERT((index >= 0) && (index < NativeArgCount()));
113 if (index == 0) {
114 return NativeArg0();
115 }
116 int function_bits = FunctionBits::decode(argc_tag_);
117 const int actual_index = index + NumHiddenArgs(function_bits);
118 return ArgAt(actual_index);
119 }
ObjectPtr NativeArg0() const

◆ NativeArgCount()

int dart::NativeArguments::NativeArgCount ( ) const
inline

Definition at line 101 of file native_arguments.h.

101 {
102 int function_bits = FunctionBits::decode(argc_tag_);
103 return ArgCount() - NumHiddenArgs(function_bits);
104 }

◆ NativeTypeArgAt()

AbstractTypePtr dart::NativeArguments::NativeTypeArgAt ( int  index) const
inline

Definition at line 138 of file native_arguments.h.

138 {
139 ASSERT((index >= 0) && (index < NativeTypeArgCount()));
140 TypeArguments& type_args = TypeArguments::Handle(NativeTypeArgs());
141 if (type_args.IsNull()) {
142 // null vector represents infinite list of dynamics
143 return Type::dynamic_type().ptr();
144 }
145 return type_args.TypeAt(index);
146 }
int NativeTypeArgCount() const
TypeArgumentsPtr NativeTypeArgs() const
static Object & Handle()
Definition: object.h:407

◆ NativeTypeArgCount()

int dart::NativeArguments::NativeTypeArgCount ( ) const
inline

Definition at line 126 of file native_arguments.h.

126 {
127 if (ToGenericFunction()) {
128 TypeArguments& type_args = TypeArguments::Handle(NativeTypeArgs());
129 if (type_args.IsNull()) {
130 // null vector represents infinite list of dynamics
131 return INT_MAX;
132 }
133 return type_args.Length();
134 }
135 return 0;
136 }

◆ NativeTypeArgs()

TypeArgumentsPtr dart::NativeArguments::NativeTypeArgs ( ) const
inline

Definition at line 121 of file native_arguments.h.

121 {
122 ASSERT(ToGenericFunction());
123 return TypeArguments::RawCast(ArgAt(0));
124 }
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325

◆ ParameterCountForResolution()

static intptr_t dart::NativeArguments::ParameterCountForResolution ( const Function function)
inlinestatic

Definition at line 170 of file native_arguments.h.

170 {
171 ASSERT(function.is_old_native());
172 ASSERT(!function.IsGenerativeConstructor()); // Not supported.
173 ASSERT(!function.IsClosureFunction()); // Not supported.
174 return function.NumParameters();
175 }

◆ ReturnValue()

ObjectPtr dart::NativeArguments::ReturnValue ( ) const
inline

Definition at line 153 of file native_arguments.h.

153 {
154 // Tell MemorySanitizer the retval_ was initialized (by generated code).
155 MSAN_UNPOISON(retval_, kWordSize);
156 return *retval_;
157 }

◆ retval_offset()

static intptr_t dart::NativeArguments::retval_offset ( )
inlinestatic

Definition at line 166 of file native_arguments.h.

166 {
167 return OFFSET_OF(NativeArguments, retval_);
168 }

◆ SetArgAt()

void dart::NativeArguments::SetArgAt ( int  index,
const Object value 
) const
inline

Definition at line 94 of file native_arguments.h.

94 {
96 ASSERT((index >= 0) && (index < ArgCount()));
97 argv_[-index] = value.ptr();
98 }
ExecutionState execution_state() const
Definition: thread.h:1040
uint8_t value

◆ SetReturn()

void dart::NativeArguments::SetReturn ( const Object value) const
inline

Definition at line 148 of file native_arguments.h.

148 {
150 *retval_ = value.ptr();
151 }

◆ thread()

Thread * dart::NativeArguments::thread ( ) const
inline

Definition at line 81 of file native_arguments.h.

81{ return thread_; }

◆ thread_offset()

static intptr_t dart::NativeArguments::thread_offset ( )
inlinestatic

Definition at line 159 of file native_arguments.h.

159 {
160 return OFFSET_OF(NativeArguments, thread_);
161 }

Friends And Related Function Documentation

◆ Api

friend class Api
friend

Definition at line 205 of file native_arguments.h.

◆ NativeEntry

friend class NativeEntry
friend

Definition at line 206 of file native_arguments.h.

◆ Simulator

friend class Simulator
friend

Definition at line 207 of file native_arguments.h.


The documentation for this class was generated from the following file: