v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
accessors.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #ifndef V8_ACCESSORS_H_
29 #define V8_ACCESSORS_H_
30 
31 #include "allocation.h"
32 #include "v8globals.h"
33 
34 namespace v8 {
35 namespace internal {
36 
37 // The list of accessor descriptors. This is a second-order macro
38 // taking a macro to be applied to all accessor descriptor names.
39 #define ACCESSOR_DESCRIPTOR_LIST(V) \
40  V(FunctionPrototype) \
41  V(FunctionLength) \
42  V(FunctionName) \
43  V(FunctionArguments) \
44  V(FunctionCaller) \
45  V(ArrayLength) \
46  V(StringLength) \
47  V(ScriptSource) \
48  V(ScriptName) \
49  V(ScriptId) \
50  V(ScriptLineOffset) \
51  V(ScriptColumnOffset) \
52  V(ScriptType) \
53  V(ScriptCompilationType) \
54  V(ScriptLineEnds) \
55  V(ScriptContextData) \
56  V(ScriptEvalFromScript) \
57  V(ScriptEvalFromScriptPosition) \
58  V(ScriptEvalFromFunctionName)
59 
60 // Accessors contains all predefined proxy accessors.
61 
62 class Accessors : public AllStatic {
63  public:
64  // Accessor descriptors.
65 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
66  static const AccessorDescriptor name;
68 #undef ACCESSOR_DESCRIPTOR_DECLARATION
69 
70  enum DescriptorId {
71 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
72  k##name,
74 #undef ACCESSOR_DESCRIPTOR_DECLARATION
76  };
77 
78  // Accessor functions called directly from the runtime system.
80  Handle<Object> value);
83 
84  // Accessor infos.
86  Handle<String> name, int index, PropertyAttributes attributes);
87 
88  // Returns true for properties that are accessors to object fields.
89  // If true, *object_offset contains offset of object field.
90  template <class T>
91  static bool IsJSObjectFieldAccessor(typename T::TypeHandle type,
93  int* object_offset);
94 
95 
96  private:
97  // Accessor functions only used through the descriptor.
98  static MaybeObject* FunctionSetPrototype(Isolate* isolate,
99  JSObject* object,
100  Object*,
101  void*);
102  static MaybeObject* FunctionGetPrototype(Isolate* isolate,
103  Object* object,
104  void*);
105  static MaybeObject* FunctionGetLength(Isolate* isolate,
106  Object* object,
107  void*);
108  static MaybeObject* FunctionGetName(Isolate* isolate, Object* object, void*);
109  static MaybeObject* FunctionGetArguments(Isolate* isolate,
110  Object* object,
111  void*);
112  static MaybeObject* FunctionGetCaller(Isolate* isolate,
113  Object* object,
114  void*);
115  static MaybeObject* ArraySetLength(Isolate* isolate,
116  JSObject* object,
117  Object*,
118  void*);
119  static MaybeObject* ArrayGetLength(Isolate* isolate, Object* object, void*);
120  static MaybeObject* StringGetLength(Isolate* isolate, Object* object, void*);
121  static MaybeObject* ScriptGetName(Isolate* isolate, Object* object, void*);
122  static MaybeObject* ScriptGetId(Isolate* isolate, Object* object, void*);
123  static MaybeObject* ScriptGetSource(Isolate* isolate, Object* object, void*);
124  static MaybeObject* ScriptGetLineOffset(Isolate* isolate,
125  Object* object,
126  void*);
127  static MaybeObject* ScriptGetColumnOffset(Isolate* isolate,
128  Object* object,
129  void*);
130  static MaybeObject* ScriptGetType(Isolate* isolate, Object* object, void*);
131  static MaybeObject* ScriptGetCompilationType(Isolate* isolate,
132  Object* object,
133  void*);
134  static MaybeObject* ScriptGetLineEnds(Isolate* isolate,
135  Object* object,
136  void*);
137  static MaybeObject* ScriptGetContextData(Isolate* isolate,
138  Object* object,
139  void*);
140  static MaybeObject* ScriptGetEvalFromScript(Isolate* isolate,
141  Object* object,
142  void*);
143  static MaybeObject* ScriptGetEvalFromScriptPosition(Isolate* isolate,
144  Object* object,
145  void*);
146  static MaybeObject* ScriptGetEvalFromFunctionName(Isolate* isolate,
147  Object* object,
148  void*);
149 
150  // Helper functions.
151  static Handle<Object> FlattenNumber(Isolate* isolate, Handle<Object> value);
152  static MaybeObject* IllegalSetter(Isolate* isolate,
153  JSObject*,
154  Object*,
155  void*);
156  static Object* IllegalGetAccessor(Isolate* isolate, Object* object, void*);
157  static MaybeObject* ReadOnlySetAccessor(Isolate* isolate,
158  JSObject*,
159  Object* value,
160  void*);
161 };
162 
163 } } // namespace v8::internal
164 
165 #endif // V8_ACCESSORS_H_
static bool IsJSObjectFieldAccessor(typename T::TypeHandle type, Handle< String > name, int *object_offset)
Definition: accessors.cc:97
#define ACCESSOR_DESCRIPTOR_DECLARATION(name)
Definition: accessors.h:71
static Handle< Object > FunctionSetPrototype(Handle< JSFunction > object, Handle< Object > value)
Definition: accessors.cc:546
PropertyAttributes
static Handle< AccessorInfo > MakeModuleExport(Handle< String > name, int index, PropertyAttributes attributes)
Definition: accessors.cc:952
static Handle< Object > FunctionGetArguments(Handle< JSFunction > object)
Definition: accessors.cc:687
#define ACCESSOR_DESCRIPTOR_LIST(V)
Definition: accessors.h:39
static Handle< Object > FunctionGetPrototype(Handle< JSFunction > object)
Definition: accessors.cc:537
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
Definition: flags.cc:505