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.
5 #ifndef V8_ACCESSORS_H_
6 #define V8_ACCESSORS_H_
8 #include "src/allocation.h"
9 #include "src/globals.h"
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) \
19 V(FunctionArguments) \
23 V(FunctionPrototype) \
24 V(ScriptColumnOffset) \
25 V(ScriptCompilationType) \
26 V(ScriptContextData) \
27 V(ScriptEvalFromScript) \
28 V(ScriptEvalFromScriptPosition) \
29 V(ScriptEvalFromFunctionName) \
37 V(ScriptSourceMappingUrl) \
40 // Accessors contains all predefined proxy accessors.
42 class Accessors : public AllStatic {
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( \
55 PropertyAttributes attributes);
56 ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
57 #undef ACCESSOR_INFO_DECLARATION
60 #define ACCESSOR_INFO_DECLARATION(name) \
63 ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
64 #undef ACCESSOR_INFO_DECLARATION
68 // Accessor functions called directly from the runtime system.
69 static Handle<Object> FunctionSetPrototype(Handle<JSFunction> object,
70 Handle<Object> value);
71 static Handle<Object> FunctionGetPrototype(Handle<JSFunction> object);
72 static Handle<Object> FunctionGetArguments(Handle<JSFunction> object);
75 static Handle<AccessorInfo> MakeModuleExport(
76 Handle<String> name, int index, PropertyAttributes attributes);
78 // Returns true for properties that are accessors to object fields.
79 // If true, *object_offset contains offset of object field.
81 static bool IsJSObjectFieldAccessor(typename T::TypeHandle type,
85 static Handle<AccessorInfo> MakeAccessor(
88 AccessorNameGetterCallback getter,
89 AccessorNameSetterCallback setter,
90 PropertyAttributes attributes);
92 static Handle<ExecutableAccessorInfo> CloneAccessor(
94 Handle<ExecutableAccessorInfo> accessor);
99 static Handle<Object> FlattenNumber(Isolate* isolate, Handle<Object> value);
102 } } // namespace v8::internal
104 #endif // V8_ACCESSORS_H_