V8 Project
v8::internal::Accessors Class Reference

#include <accessors.h>

+ Inheritance diagram for v8::internal::Accessors:
+ Collaboration diagram for v8::internal::Accessors:

Public Types

enum  DescriptorId { descriptorCount }
 

Static Public Member Functions

static Handle< ObjectFunctionSetPrototype (Handle< JSFunction > object, Handle< Object > value)
 
static Handle< ObjectFunctionGetPrototype (Handle< JSFunction > object)
 
static Handle< ObjectFunctionGetArguments (Handle< JSFunction > object)
 
static Handle< AccessorInfoMakeModuleExport (Handle< String > name, int index, PropertyAttributes attributes)
 
template<class T >
static bool IsJSObjectFieldAccessor (typename T::TypeHandle type, Handle< Name > name, int *object_offset)
 
static Handle< AccessorInfoMakeAccessor (Isolate *isolate, Handle< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter, PropertyAttributes attributes)
 
static Handle< ExecutableAccessorInfoCloneAccessor (Isolate *isolate, Handle< ExecutableAccessorInfo > accessor)
 

Static Private Member Functions

static Handle< ObjectFlattenNumber (Isolate *isolate, Handle< Object > value)
 

Detailed Description

Definition at line 42 of file accessors.h.

Member Enumeration Documentation

◆ DescriptorId

Enumerator
descriptorCount 

Definition at line 59 of file accessors.h.

59  {
60 #define ACCESSOR_INFO_DECLARATION(name) \
61  k##name##Getter, \
62  k##name##Setter,
64 #undef ACCESSOR_INFO_DECLARATION
66  };
#define ACCESSOR_INFO_LIST(V)
Definition: accessors.h:16
#define ACCESSOR_INFO_DECLARATION(name)
Definition: accessors.h:60

Member Function Documentation

◆ CloneAccessor()

Handle< ExecutableAccessorInfo > v8::internal::Accessors::CloneAccessor ( Isolate isolate,
Handle< ExecutableAccessorInfo accessor 
)
static

Definition at line 44 of file accessors.cc.

46  {
47  Factory* factory = isolate->factory();
48  Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo();
49  info->set_name(accessor->name());
50  info->set_flag(accessor->flag());
51  info->set_expected_receiver_type(accessor->expected_receiver_type());
52  info->set_getter(accessor->getter());
53  info->set_setter(accessor->setter());
54  info->set_data(accessor->data());
55  return info;
56 }

References v8::internal::Isolate::factory().

+ Here is the call graph for this function:

◆ FlattenNumber()

Handle< Object > v8::internal::Accessors::FlattenNumber ( Isolate isolate,
Handle< Object value 
)
staticprivate

Definition at line 204 of file accessors.cc.

205  {
206  if (value->IsNumber() || !value->IsJSValue()) return value;
207  Handle<JSValue> wrapper = Handle<JSValue>::cast(value);
208  DCHECK(wrapper->GetIsolate()->native_context()->number_function()->
209  has_initial_map());
210  if (wrapper->map() == isolate->number_function()->initial_map()) {
211  return handle(wrapper->value(), isolate);
212  }
213 
214  return value;
215 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
#define DCHECK(condition)
Definition: logging.h:205
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References v8::internal::Handle< T >::cast(), DCHECK, and v8::internal::handle().

+ Here is the call graph for this function:

◆ FunctionGetArguments()

Handle< Object > v8::internal::Accessors::FunctionGetArguments ( Handle< JSFunction object)
static

Definition at line 1157 of file accessors.cc.

1157  {
1158  return GetFunctionArguments(function->GetIsolate(), function);
1159 }
Handle< Object > GetFunctionArguments(Isolate *isolate, Handle< JSFunction > function)
Definition: accessors.cc:1101

References v8::internal::GetFunctionArguments().

Referenced by v8::internal::MaterializeArgumentsObject(), and v8::internal::Deoptimizer::MaterializeNextHeapObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FunctionGetPrototype()

Handle< Object > v8::internal::Accessors::FunctionGetPrototype ( Handle< JSFunction object)
static

Definition at line 919 of file accessors.cc.

919  {
920  return GetFunctionPrototype(function->GetIsolate(), function);
921 }
static Handle< Object > GetFunctionPrototype(Isolate *isolate, Handle< JSFunction > function)
Definition: accessors.cc:885

References v8::internal::GetFunctionPrototype().

+ Here is the call graph for this function:

◆ FunctionSetPrototype()

Handle< Object > v8::internal::Accessors::FunctionSetPrototype ( Handle< JSFunction object,
Handle< Object value 
)
static

Definition at line 924 of file accessors.cc.

925  {
926  DCHECK(function->should_have_prototype());
927  Isolate* isolate = function->GetIsolate();
928  return SetFunctionPrototype(isolate, function, prototype);
929 }
static Handle< Object > SetFunctionPrototype(Isolate *isolate, Handle< JSFunction > function, Handle< Object > value)
Definition: accessors.cc:895

References DCHECK, and v8::internal::SetFunctionPrototype().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsJSObjectFieldAccessor()

template<class T >
template bool v8::internal::Accessors::IsJSObjectFieldAccessor< HeapType > ( typename T::TypeHandle  type,
Handle< Name name,
int object_offset 
)
static

Definition at line 85 of file accessors.cc.

87  {
88  Isolate* isolate = name->GetIsolate();
89 
90  if (type->Is(T::String())) {
91  return CheckForName(name, isolate->factory()->length_string(),
92  String::kLengthOffset, object_offset);
93  }
94 
95  if (!type->IsClass()) return false;
96  Handle<Map> map = type->AsClass()->Map();
97 
98  switch (map->instance_type()) {
99  case JS_ARRAY_TYPE:
100  return
101  CheckForName(name, isolate->factory()->length_string(),
102  JSArray::kLengthOffset, object_offset);
103  case JS_TYPED_ARRAY_TYPE:
104  return
105  CheckForName(name, isolate->factory()->length_string(),
106  JSTypedArray::kLengthOffset, object_offset) ||
107  CheckForName(name, isolate->factory()->byte_length_string(),
108  JSTypedArray::kByteLengthOffset, object_offset) ||
109  CheckForName(name, isolate->factory()->byte_offset_string(),
110  JSTypedArray::kByteOffsetOffset, object_offset);
112  return
113  CheckForName(name, isolate->factory()->byte_length_string(),
114  JSArrayBuffer::kByteLengthOffset, object_offset);
115  case JS_DATA_VIEW_TYPE:
116  return
117  CheckForName(name, isolate->factory()->byte_length_string(),
118  JSDataView::kByteLengthOffset, object_offset) ||
119  CheckForName(name, isolate->factory()->byte_offset_string(),
120  JSDataView::kByteOffsetOffset, object_offset);
121  default:
122  return false;
123  }
124 }
static const int kByteOffsetOffset
Definition: objects.h:9914
static const int kByteLengthOffset
Definition: objects.h:9915
static const int kByteLengthOffset
Definition: objects.h:9877
static const int kLengthOffset
Definition: objects.h:10072
static const int kLengthOffset
Definition: objects.h:9946
static const int kLengthOffset
Definition: objects.h:8802
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
@ JS_ARRAY_TYPE
Definition: objects.h:738
@ JS_TYPED_ARRAY_TYPE
Definition: objects.h:740
@ JS_DATA_VIEW_TYPE
Definition: objects.h:741
@ JS_ARRAY_BUFFER_TYPE
Definition: objects.h:739
static bool CheckForName(Handle< Name > name, Handle< String > property_name, int offset, int *object_offset)
Definition: accessors.cc:70

References v8::internal::CheckForName(), v8::internal::Isolate::factory(), v8::internal::JS_ARRAY_BUFFER_TYPE, v8::internal::JS_ARRAY_TYPE, v8::internal::JS_DATA_VIEW_TYPE, v8::internal::JS_TYPED_ARRAY_TYPE, v8::internal::JSArrayBuffer::kByteLengthOffset, v8::internal::JSArrayBufferView::kByteLengthOffset, v8::internal::JSArrayBufferView::kByteOffsetOffset, v8::internal::String::kLengthOffset, v8::internal::JSTypedArray::kLengthOffset, v8::internal::JSArray::kLengthOffset, map, and name.

+ Here is the call graph for this function:

◆ MakeAccessor()

Handle< AccessorInfo > v8::internal::Accessors::MakeAccessor ( Isolate isolate,
Handle< Name name,
AccessorNameGetterCallback  getter,
AccessorNameSetterCallback  setter,
PropertyAttributes  attributes 
)
static

Definition at line 24 of file accessors.cc.

29  {
30  Factory* factory = isolate->factory();
31  Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo();
32  info->set_property_attributes(attributes);
33  info->set_all_can_read(false);
34  info->set_all_can_write(false);
35  info->set_name(*name);
36  Handle<Object> get = v8::FromCData(isolate, getter);
37  Handle<Object> set = v8::FromCData(isolate, setter);
38  info->set_getter(*get);
39  info->set_setter(*set);
40  return info;
41 }
v8::internal::Handle< v8::internal::Object > FromCData(v8::internal::Isolate *isolate, T obj)
Definition: api.h:104

References v8::internal::Isolate::factory(), v8::FromCData(), and name.

+ Here is the call graph for this function:

◆ MakeModuleExport()

Handle< AccessorInfo > v8::internal::Accessors::MakeModuleExport ( Handle< String name,
int  index,
PropertyAttributes  attributes 
)
static

Definition at line 1402 of file accessors.cc.

1405  {
1406  Isolate* isolate = name->GetIsolate();
1407  Factory* factory = isolate->factory();
1408  Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo();
1409  info->set_property_attributes(attributes);
1410  info->set_all_can_read(true);
1411  info->set_all_can_write(true);
1412  info->set_name(*name);
1413  info->set_data(Smi::FromInt(index));
1414  Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1415  Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1416  info->set_getter(*getter);
1417  if (!(attributes & ReadOnly)) info->set_setter(*setter);
1418  return info;
1419 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
static void ModuleGetExport(v8::Local< v8::String > property, const v8::PropertyCallbackInfo< v8::Value > &info)
Definition: accessors.cc:1348
static void ModuleSetExport(v8::Local< v8::String > property, v8::Local< v8::Value > value, const v8::PropertyCallbackInfo< v8::Value > &info)
Definition: accessors.cc:1375
@ ReadOnly
Definition: v8.h:2212

References v8::internal::Isolate::factory(), v8::FromCData(), v8::internal::Smi::FromInt(), v8::internal::ModuleGetExport(), v8::internal::ModuleSetExport(), name, and v8::ReadOnly.

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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