Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/accessors.h

Issue 258243003: Remove old-style accessor support from runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/accessors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 18 matching lines...) Expand all
29 #define V8_ACCESSORS_H_ 29 #define V8_ACCESSORS_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "v8globals.h" 32 #include "v8globals.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 // The list of accessor descriptors. This is a second-order macro 37 // The list of accessor descriptors. This is a second-order macro
38 // taking a macro to be applied to all accessor descriptor names. 38 // taking a macro to be applied to all accessor descriptor names.
39 #define ACCESSOR_DESCRIPTOR_LIST(V) \
40
41
42 #define ACCESSOR_INFO_LIST(V) \ 39 #define ACCESSOR_INFO_LIST(V) \
43 V(ArrayLength) \ 40 V(ArrayLength) \
44 V(FunctionArguments) \ 41 V(FunctionArguments) \
45 V(FunctionCaller) \ 42 V(FunctionCaller) \
46 V(FunctionName) \ 43 V(FunctionName) \
47 V(FunctionLength) \ 44 V(FunctionLength) \
48 V(FunctionPrototype) \ 45 V(FunctionPrototype) \
49 V(ScriptColumnOffset) \ 46 V(ScriptColumnOffset) \
50 V(ScriptCompilationType) \ 47 V(ScriptCompilationType) \
51 V(ScriptContextData) \ 48 V(ScriptContextData) \
52 V(ScriptEvalFromScript) \ 49 V(ScriptEvalFromScript) \
53 V(ScriptEvalFromScriptPosition) \ 50 V(ScriptEvalFromScriptPosition) \
54 V(ScriptEvalFromFunctionName) \ 51 V(ScriptEvalFromFunctionName) \
55 V(ScriptId) \ 52 V(ScriptId) \
56 V(ScriptLineEnds) \ 53 V(ScriptLineEnds) \
57 V(ScriptLineOffset) \ 54 V(ScriptLineOffset) \
58 V(ScriptName) \ 55 V(ScriptName) \
59 V(ScriptSource) \ 56 V(ScriptSource) \
60 V(ScriptType) \ 57 V(ScriptType) \
61 V(StringLength) 58 V(StringLength)
62 59
63 // Accessors contains all predefined proxy accessors. 60 // Accessors contains all predefined proxy accessors.
64 61
65 class Accessors : public AllStatic { 62 class Accessors : public AllStatic {
66 public: 63 public:
67 // Accessor descriptors. 64 // Accessor descriptors.
68 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
69 static const AccessorDescriptor name;
70 ACCESSOR_DESCRIPTOR_LIST(ACCESSOR_DESCRIPTOR_DECLARATION)
71 #undef ACCESSOR_DESCRIPTOR_DECLARATION
72
73 #define ACCESSOR_INFO_DECLARATION(name) \ 65 #define ACCESSOR_INFO_DECLARATION(name) \
74 static void name##Getter( \ 66 static void name##Getter( \
75 v8::Local<v8::String> name, \ 67 v8::Local<v8::String> name, \
76 const v8::PropertyCallbackInfo<v8::Value>& info); \ 68 const v8::PropertyCallbackInfo<v8::Value>& info); \
77 static void name##Setter( \ 69 static void name##Setter( \
78 v8::Local<v8::String> name, \ 70 v8::Local<v8::String> name, \
79 v8::Local<v8::Value> value, \ 71 v8::Local<v8::Value> value, \
80 const v8::PropertyCallbackInfo<void>& info); \ 72 const v8::PropertyCallbackInfo<void>& info); \
81 static Handle<AccessorInfo> name##Info( \ 73 static Handle<AccessorInfo> name##Info( \
82 Isolate* isolate, \ 74 Isolate* isolate, \
83 PropertyAttributes attributes); 75 PropertyAttributes attributes);
84 ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION) 76 ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
85 #undef ACCESSOR_INFO_DECLARATION 77 #undef ACCESSOR_INFO_DECLARATION
86 78
87 enum DescriptorId { 79 enum DescriptorId {
88 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
89 k##name,
90 ACCESSOR_DESCRIPTOR_LIST(ACCESSOR_DESCRIPTOR_DECLARATION)
91 #undef ACCESSOR_DESCRIPTOR_DECLARATION
92 #define ACCESSOR_INFO_DECLARATION(name) \ 80 #define ACCESSOR_INFO_DECLARATION(name) \
93 k##name##Getter, \ 81 k##name##Getter, \
94 k##name##Setter, 82 k##name##Setter,
95 ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION) 83 ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
96 #undef ACCESSOR_INFO_DECLARATION 84 #undef ACCESSOR_INFO_DECLARATION
97 descriptorCount 85 descriptorCount
98 }; 86 };
99 87
100 // Accessor functions called directly from the runtime system. 88 // Accessor functions called directly from the runtime system.
101 static Handle<Object> FunctionSetPrototype(Handle<JSFunction> object, 89 static Handle<Object> FunctionSetPrototype(Handle<JSFunction> object,
102 Handle<Object> value); 90 Handle<Object> value);
103 static Handle<Object> FunctionGetPrototype(Handle<JSFunction> object); 91 static Handle<Object> FunctionGetPrototype(Handle<JSFunction> object);
104 static Handle<Object> FunctionGetArguments(Handle<JSFunction> object); 92 static Handle<Object> FunctionGetArguments(Handle<JSFunction> object);
105 93
106 // Accessor infos. 94 // Accessor infos.
107 static Handle<AccessorInfo> MakeModuleExport( 95 static Handle<AccessorInfo> MakeModuleExport(
108 Handle<String> name, int index, PropertyAttributes attributes); 96 Handle<String> name, int index, PropertyAttributes attributes);
109 97
110 // Returns true for properties that are accessors to object fields. 98 // Returns true for properties that are accessors to object fields.
111 // If true, *object_offset contains offset of object field. 99 // If true, *object_offset contains offset of object field.
112 template <class T> 100 template <class T>
113 static bool IsJSObjectFieldAccessor(typename T::TypeHandle type, 101 static bool IsJSObjectFieldAccessor(typename T::TypeHandle type,
114 Handle<String> name, 102 Handle<String> name,
115 int* object_offset); 103 int* object_offset);
116 104
105 static Handle<AccessorInfo> MakeAccessor(
106 Isolate* isolate,
107 Handle<String> name,
108 AccessorGetterCallback getter,
109 AccessorSetterCallback setter,
110 PropertyAttributes attributes);
111
117 private: 112 private:
118 static Object* FunctionGetCaller(Isolate* isolate,
119 Object* object,
120 void*);
121 static Object* ArraySetLength(Isolate* isolate,
122 JSObject* object,
123 Object*,
124 void*);
125 static Object* ArrayGetLength(Isolate* isolate, Object* object, void*);
126
127 // Helper functions. 113 // Helper functions.
128 static Handle<Object> FlattenNumber(Isolate* isolate, Handle<Object> value); 114 static Handle<Object> FlattenNumber(Isolate* isolate, Handle<Object> value);
129 static Object* IllegalSetter(Isolate* isolate,
130 JSObject*,
131 Object*,
132 void*);
133 static Object* IllegalGetAccessor(Isolate* isolate, Object* object, void*);
134 static Object* ReadOnlySetAccessor(Isolate* isolate,
135 JSObject*,
136 Object* value,
137 void*);
138 }; 115 };
139 116
140 } } // namespace v8::internal 117 } } // namespace v8::internal
141 118
142 #endif // V8_ACCESSORS_H_ 119 #endif // V8_ACCESSORS_H_
OLDNEW
« no previous file with comments | « no previous file | src/accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698