OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_BUILTINS_H_ | 28 #ifndef V8_BUILTINS_H_ |
29 #define V8_BUILTINS_H_ | 29 #define V8_BUILTINS_H_ |
30 | 30 |
31 namespace v8 { namespace internal { | 31 namespace v8 { namespace internal { |
32 | 32 |
33 // Define list of builtins implemented in C. | 33 // Define list of builtins implemented in C. |
34 #define BUILTIN_LIST_C(V) \ | 34 #define BUILTIN_LIST_C(V) \ |
35 V(Illegal, 0) \ | 35 V(Illegal) \ |
36 \ | 36 \ |
37 V(EmptyFunction, 0) \ | 37 V(EmptyFunction) \ |
38 \ | 38 \ |
39 V(ArrayCode, 0) \ | 39 V(ArrayCode) \ |
40 \ | 40 \ |
41 V(ArrayPush, -1) \ | 41 V(ArrayPush) \ |
42 V(ArrayPop, -1) \ | 42 V(ArrayPop) \ |
43 \ | 43 \ |
44 V(HandleApiCall, 0) \ | 44 V(HandleApiCall) \ |
45 V(HandleApiCallAsFunction, 0) | 45 V(HandleApiCallAsFunction) |
46 | 46 |
47 | 47 |
48 // Define list of builtins implemented in assembly. | 48 // Define list of builtins implemented in assembly. |
49 #define BUILTIN_LIST_A(V) \ | 49 #define BUILTIN_LIST_A(V) \ |
50 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED) \ | 50 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED) \ |
51 V(JSConstructCall, BUILTIN, UNINITIALIZED) \ | 51 V(JSConstructCall, BUILTIN, UNINITIALIZED) \ |
52 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED) \ | 52 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED) \ |
53 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED) \ | 53 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED) \ |
54 \ | 54 \ |
55 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 55 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK) \ |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 static void Setup(bool create_heap_objects); | 134 static void Setup(bool create_heap_objects); |
135 static void TearDown(); | 135 static void TearDown(); |
136 | 136 |
137 // Garbage collection support. | 137 // Garbage collection support. |
138 static void IterateBuiltins(ObjectVisitor* v); | 138 static void IterateBuiltins(ObjectVisitor* v); |
139 | 139 |
140 // Disassembler support. | 140 // Disassembler support. |
141 static const char* Lookup(byte* pc); | 141 static const char* Lookup(byte* pc); |
142 | 142 |
143 enum Name { | 143 enum Name { |
144 #define DEF_ENUM_C(name, ignore) name, | 144 #define DEF_ENUM_C(name) name, |
145 #define DEF_ENUM_A(name, kind, state) name, | 145 #define DEF_ENUM_A(name, kind, state) name, |
146 BUILTIN_LIST_C(DEF_ENUM_C) | 146 BUILTIN_LIST_C(DEF_ENUM_C) |
147 BUILTIN_LIST_A(DEF_ENUM_A) | 147 BUILTIN_LIST_A(DEF_ENUM_A) |
148 #undef DEF_ENUM_C | 148 #undef DEF_ENUM_C |
149 #undef DEF_ENUM_A | 149 #undef DEF_ENUM_A |
150 builtin_count | 150 builtin_count |
151 }; | 151 }; |
152 | 152 |
153 enum CFunctionId { | 153 enum CFunctionId { |
154 #define DEF_ENUM_C(name, ignore) c_##name, | 154 #define DEF_ENUM_C(name) c_##name, |
155 BUILTIN_LIST_C(DEF_ENUM_C) | 155 BUILTIN_LIST_C(DEF_ENUM_C) |
156 #undef DEF_ENUM_C | 156 #undef DEF_ENUM_C |
157 cfunction_count | 157 cfunction_count |
158 }; | 158 }; |
159 | 159 |
160 enum JavaScript { | 160 enum JavaScript { |
161 #define DEF_ENUM(name, ignore) name, | 161 #define DEF_ENUM(name, ignore) name, |
162 BUILTINS_LIST_JS(DEF_ENUM) | 162 BUILTINS_LIST_JS(DEF_ENUM) |
163 #undef DEF_ENUM | 163 #undef DEF_ENUM |
164 id_count | 164 id_count |
(...skipping 28 matching lines...) Expand all Loading... |
193 | 193 |
194 private: | 194 private: |
195 // The external C++ functions called from the code. | 195 // The external C++ functions called from the code. |
196 static Address c_functions_[cfunction_count]; | 196 static Address c_functions_[cfunction_count]; |
197 | 197 |
198 // Note: These are always Code objects, but to conform with | 198 // Note: These are always Code objects, but to conform with |
199 // IterateBuiltins() above which assumes Object**'s for the callback | 199 // IterateBuiltins() above which assumes Object**'s for the callback |
200 // function f, we use an Object* array here. | 200 // function f, we use an Object* array here. |
201 static Object* builtins_[builtin_count]; | 201 static Object* builtins_[builtin_count]; |
202 static const char* names_[builtin_count]; | 202 static const char* names_[builtin_count]; |
203 | |
204 static const char* javascript_names_[id_count]; | 203 static const char* javascript_names_[id_count]; |
205 static int javascript_argc_[id_count]; | 204 static int javascript_argc_[id_count]; |
206 | 205 |
207 // The offset from the beginning of the JSConstructCall builtin code | 206 // The offset from the beginning of the JSConstructCall builtin code |
208 // object to the return address after the call. Used for determining | 207 // object to the return address after the call. Used for determining |
209 // if a call is a constructor invocation. | 208 // if a call is a constructor invocation. |
210 static int construct_call_pc_offset_; | 209 static int construct_call_pc_offset_; |
211 static int arguments_adaptor_call_pc_offset_; | 210 static int arguments_adaptor_call_pc_offset_; |
212 | 211 |
213 static void Generate_Adaptor(MacroAssembler* masm, | 212 static void Generate_Adaptor(MacroAssembler* masm, CFunctionId id); |
214 int argc, | |
215 CFunctionId id); | |
216 static void Generate_JSConstructCall(MacroAssembler* masm); | 213 static void Generate_JSConstructCall(MacroAssembler* masm); |
217 static void Generate_JSEntryTrampoline(MacroAssembler* masm); | 214 static void Generate_JSEntryTrampoline(MacroAssembler* masm); |
218 static void Generate_JSConstructEntryTrampoline(MacroAssembler* masm); | 215 static void Generate_JSConstructEntryTrampoline(MacroAssembler* masm); |
219 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); | 216 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); |
220 | 217 |
221 static void Generate_FunctionCall(MacroAssembler* masm); | 218 static void Generate_FunctionCall(MacroAssembler* masm); |
222 static void Generate_FunctionApply(MacroAssembler* masm); | 219 static void Generate_FunctionApply(MacroAssembler* masm); |
223 | 220 |
224 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm); | 221 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm); |
225 static void Generate_StoreIC_DebugBreak(MacroAssembler* masm); | 222 static void Generate_StoreIC_DebugBreak(MacroAssembler* masm); |
226 static void Generate_KeyedLoadIC_DebugBreak(MacroAssembler* masm); | 223 static void Generate_KeyedLoadIC_DebugBreak(MacroAssembler* masm); |
227 static void Generate_KeyedStoreIC_DebugBreak(MacroAssembler* masm); | 224 static void Generate_KeyedStoreIC_DebugBreak(MacroAssembler* masm); |
228 static void Generate_ConstructCall_DebugBreak(MacroAssembler* masm); | 225 static void Generate_ConstructCall_DebugBreak(MacroAssembler* masm); |
229 static void Generate_Return_DebugBreak(MacroAssembler* masm); | 226 static void Generate_Return_DebugBreak(MacroAssembler* masm); |
230 static void Generate_Return_DebugBreakEntry(MacroAssembler* masm); | 227 static void Generate_Return_DebugBreakEntry(MacroAssembler* masm); |
231 static void Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm); | 228 static void Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm); |
232 }; | 229 }; |
233 | 230 |
234 } } // namespace v8::internal | 231 } } // namespace v8::internal |
235 | 232 |
236 #endif // V8_BUILTINS_H_ | 233 #endif // V8_BUILTINS_H_ |
OLD | NEW |