V8 Project
accessors.h
Go to the documentation of this file.
1 // Copyright 2012 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_ACCESSORS_H_
6 #define V8_ACCESSORS_H_
7 
8 #include "src/allocation.h"
9 #include "src/globals.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 // The list of accessor descriptors. This is a second-order macro
15 // taking a macro to be applied to all accessor descriptor names.
16 #define ACCESSOR_INFO_LIST(V) \
17  V(ArgumentsIterator) \
18  V(ArrayLength) \
19  V(FunctionArguments) \
20  V(FunctionCaller) \
21  V(FunctionName) \
22  V(FunctionLength) \
23  V(FunctionPrototype) \
24  V(ScriptColumnOffset) \
25  V(ScriptCompilationType) \
26  V(ScriptContextData) \
27  V(ScriptEvalFromScript) \
28  V(ScriptEvalFromScriptPosition) \
29  V(ScriptEvalFromFunctionName) \
30  V(ScriptId) \
31  V(ScriptLineEnds) \
32  V(ScriptLineOffset) \
33  V(ScriptName) \
34  V(ScriptSource) \
35  V(ScriptType) \
36  V(ScriptSourceUrl) \
37  V(ScriptSourceMappingUrl) \
38  V(StringLength)
39 
40 // Accessors contains all predefined proxy accessors.
41 
42 class Accessors : public AllStatic {
43  public:
44  // Accessor descriptors.
45 #define ACCESSOR_INFO_DECLARATION(name) \
46  static void name##Getter( \
47  v8::Local<v8::Name> name, \
48  const v8::PropertyCallbackInfo<v8::Value>& info); \
49  static void name##Setter( \
50  v8::Local<v8::Name> name, \
51  v8::Local<v8::Value> value, \
52  const v8::PropertyCallbackInfo<void>& info); \
53  static Handle<AccessorInfo> name##Info( \
54  Isolate* isolate, \
55  PropertyAttributes attributes);
57 #undef ACCESSOR_INFO_DECLARATION
58 
59  enum DescriptorId {
60 #define ACCESSOR_INFO_DECLARATION(name) \
61  k##name##Getter, \
62  k##name##Setter,
64 #undef ACCESSOR_INFO_DECLARATION
66  };
67 
68  // Accessor functions called directly from the runtime system.
70  Handle<Object> value);
73 
74  // Accessor infos.
76  Handle<String> name, int index, PropertyAttributes attributes);
77 
78  // Returns true for properties that are accessors to object fields.
79  // If true, *object_offset contains offset of object field.
80  template <class T>
81  static bool IsJSObjectFieldAccessor(typename T::TypeHandle type,
83  int* object_offset);
84 
86  Isolate* isolate,
90  PropertyAttributes attributes);
91 
93  Isolate* isolate,
95 
96 
97  private:
98  // Helper functions.
99  static Handle<Object> FlattenNumber(Isolate* isolate, Handle<Object> value);
100 };
101 
102 } } // namespace v8::internal
103 
104 #endif // V8_ACCESSORS_H_
#define ACCESSOR_INFO_LIST(V)
Definition: accessors.h:16
#define ACCESSOR_INFO_DECLARATION(name)
Definition: accessors.h:60
static Handle< Object > FlattenNumber(Isolate *isolate, Handle< Object > value)
Definition: accessors.cc:204
static Handle< ExecutableAccessorInfo > CloneAccessor(Isolate *isolate, Handle< ExecutableAccessorInfo > accessor)
Definition: accessors.cc:44
static Handle< Object > FunctionSetPrototype(Handle< JSFunction > object, Handle< Object > value)
Definition: accessors.cc:924
static Handle< AccessorInfo > MakeModuleExport(Handle< String > name, int index, PropertyAttributes attributes)
Definition: accessors.cc:1402
static Handle< AccessorInfo > MakeAccessor(Isolate *isolate, Handle< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter, PropertyAttributes attributes)
Definition: accessors.cc:24
static Handle< Object > FunctionGetPrototype(Handle< JSFunction > object)
Definition: accessors.cc:919
static Handle< Object > FunctionGetArguments(Handle< JSFunction > object)
Definition: accessors.cc:1157
static bool IsJSObjectFieldAccessor(typename T::TypeHandle type, Handle< Name > name, int *object_offset)
Definition: accessors.cc:85
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
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
Definition: v8.h:2257
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:2248
PropertyAttributes