The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / deps / v8 / src / accessors.h @ 40c0f755
History | View | Annotate | Download (4.25 KB)
1 |
// Copyright 2006-2008 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 |
namespace v8 { namespace internal { |
32 |
|
33 |
// The list of accessor descriptors. This is a second-order macro
|
34 |
// taking a macro to be applied to all accessor descriptor names.
|
35 |
#define ACCESSOR_DESCRIPTOR_LIST(V) \
|
36 |
V(FunctionPrototype) \ |
37 |
V(FunctionLength) \ |
38 |
V(FunctionName) \ |
39 |
V(FunctionArguments) \ |
40 |
V(FunctionCaller) \ |
41 |
V(ArrayLength) \ |
42 |
V(StringLength) \ |
43 |
V(ScriptSource) \ |
44 |
V(ScriptName) \ |
45 |
V(ScriptId) \ |
46 |
V(ScriptLineOffset) \ |
47 |
V(ScriptColumnOffset) \ |
48 |
V(ScriptType) \ |
49 |
V(ScriptLineEnds) \ |
50 |
V(ObjectPrototype) |
51 |
|
52 |
// Accessors contains all predefined proxy accessors.
|
53 |
|
54 |
class Accessors : public AllStatic { |
55 |
public:
|
56 |
// Accessor descriptors.
|
57 |
#define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
|
58 |
static const AccessorDescriptor name; |
59 |
ACCESSOR_DESCRIPTOR_LIST(ACCESSOR_DESCRIPTOR_DECLARATION) |
60 |
#undef ACCESSOR_DESCRIPTOR_DECLARATION
|
61 |
|
62 |
enum DescriptorId {
|
63 |
#define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
|
64 |
k##name, |
65 |
ACCESSOR_DESCRIPTOR_LIST(ACCESSOR_DESCRIPTOR_DECLARATION) |
66 |
#undef ACCESSOR_DESCRIPTOR_DECLARATION
|
67 |
descriptorCount |
68 |
}; |
69 |
|
70 |
// Accessor functions called directly from the runtime system.
|
71 |
static Object* FunctionGetPrototype(Object* object, void*); |
72 |
static Object* FunctionSetPrototype(JSObject* object, Object* value, void*); |
73 |
private:
|
74 |
// Accessor functions only used through the descriptor.
|
75 |
static Object* FunctionGetLength(Object* object, void*); |
76 |
static Object* FunctionGetName(Object* object, void*); |
77 |
static Object* FunctionGetArguments(Object* object, void*); |
78 |
static Object* FunctionGetCaller(Object* object, void*); |
79 |
static Object* ArraySetLength(JSObject* object, Object* value, void*); |
80 |
static Object* ArrayGetLength(Object* object, void*); |
81 |
static Object* StringGetLength(Object* object, void*); |
82 |
static Object* ScriptGetName(Object* object, void*); |
83 |
static Object* ScriptGetId(Object* object, void*); |
84 |
static Object* ScriptGetSource(Object* object, void*); |
85 |
static Object* ScriptGetLineOffset(Object* object, void*); |
86 |
static Object* ScriptGetColumnOffset(Object* object, void*); |
87 |
static Object* ScriptGetType(Object* object, void*); |
88 |
static Object* ScriptGetLineEnds(Object* object, void*); |
89 |
static Object* ObjectGetPrototype(Object* receiver, void*); |
90 |
static Object* ObjectSetPrototype(JSObject* receiver, Object* value, void*); |
91 |
|
92 |
// Helper functions.
|
93 |
static Object* FlattenNumber(Object* value);
|
94 |
static Object* IllegalSetter(JSObject*, Object*, void*); |
95 |
static Object* IllegalGetAccessor(Object* object, void*); |
96 |
static Object* ReadOnlySetAccessor(JSObject*, Object* value, void*); |
97 |
}; |
98 |
|
99 |
} } // namespace v8::internal
|
100 |
|
101 |
#endif // V8_ACCESSORS_H_ |