28 #ifndef V8_BUILTINS_H_
29 #define V8_BUILTINS_H_
42 #define BUILTIN_LIST_C(V) \
43 V(Illegal, NO_EXTRA_ARGUMENTS) \
45 V(EmptyFunction, NO_EXTRA_ARGUMENTS) \
47 V(InternalArrayCodeGeneric, NO_EXTRA_ARGUMENTS) \
48 V(ArrayCodeGeneric, NO_EXTRA_ARGUMENTS) \
50 V(ArrayPush, NO_EXTRA_ARGUMENTS) \
51 V(ArrayPop, NO_EXTRA_ARGUMENTS) \
52 V(ArrayShift, NO_EXTRA_ARGUMENTS) \
53 V(ArrayUnshift, NO_EXTRA_ARGUMENTS) \
54 V(ArraySlice, NO_EXTRA_ARGUMENTS) \
55 V(ArraySplice, NO_EXTRA_ARGUMENTS) \
56 V(ArrayConcat, NO_EXTRA_ARGUMENTS) \
58 V(HandleApiCall, NEEDS_CALLED_FUNCTION) \
59 V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \
60 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \
61 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \
63 V(StrictModePoisonPill, NO_EXTRA_ARGUMENTS)
66 #define BUILTIN_LIST_A(V) \
67 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, \
68 Code::kNoExtraICState) \
69 V(InRecompileQueue, BUILTIN, UNINITIALIZED, \
70 Code::kNoExtraICState) \
71 V(JSConstructStubCountdown, BUILTIN, UNINITIALIZED, \
72 Code::kNoExtraICState) \
73 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, \
74 Code::kNoExtraICState) \
75 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, \
76 Code::kNoExtraICState) \
77 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, \
78 Code::kNoExtraICState) \
79 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, \
80 Code::kNoExtraICState) \
81 V(LazyCompile, BUILTIN, UNINITIALIZED, \
82 Code::kNoExtraICState) \
83 V(LazyRecompile, BUILTIN, UNINITIALIZED, \
84 Code::kNoExtraICState) \
85 V(ParallelRecompile, BUILTIN, UNINITIALIZED, \
86 Code::kNoExtraICState) \
87 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, \
88 Code::kNoExtraICState) \
89 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \
90 Code::kNoExtraICState) \
91 V(NotifyOSR, BUILTIN, UNINITIALIZED, \
92 Code::kNoExtraICState) \
94 V(LoadIC_Miss, BUILTIN, UNINITIALIZED, \
95 Code::kNoExtraICState) \
96 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, \
97 Code::kNoExtraICState) \
98 V(KeyedLoadIC_MissForceGeneric, BUILTIN, UNINITIALIZED, \
99 Code::kNoExtraICState) \
100 V(KeyedLoadIC_Slow, BUILTIN, UNINITIALIZED, \
101 Code::kNoExtraICState) \
102 V(StoreIC_Miss, BUILTIN, UNINITIALIZED, \
103 Code::kNoExtraICState) \
104 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, \
105 Code::kNoExtraICState) \
106 V(KeyedStoreIC_MissForceGeneric, BUILTIN, UNINITIALIZED, \
107 Code::kNoExtraICState) \
108 V(KeyedStoreIC_Slow, BUILTIN, UNINITIALIZED, \
109 Code::kNoExtraICState) \
110 V(LoadIC_Initialize, LOAD_IC, UNINITIALIZED, \
111 Code::kNoExtraICState) \
112 V(LoadIC_PreMonomorphic, LOAD_IC, PREMONOMORPHIC, \
113 Code::kNoExtraICState) \
114 V(LoadIC_Normal, LOAD_IC, MONOMORPHIC, \
115 Code::kNoExtraICState) \
116 V(LoadIC_ArrayLength, LOAD_IC, MONOMORPHIC, \
117 Code::kNoExtraICState) \
118 V(LoadIC_StringLength, LOAD_IC, MONOMORPHIC, \
119 Code::kNoExtraICState) \
120 V(LoadIC_StringWrapperLength, LOAD_IC, MONOMORPHIC, \
121 Code::kNoExtraICState) \
122 V(LoadIC_FunctionPrototype, LOAD_IC, MONOMORPHIC, \
123 Code::kNoExtraICState) \
124 V(LoadIC_Megamorphic, LOAD_IC, MEGAMORPHIC, \
125 Code::kNoExtraICState) \
126 V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, \
127 Code::kNoExtraICState) \
129 V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, \
130 Code::kNoExtraICState) \
131 V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \
132 Code::kNoExtraICState) \
133 V(KeyedLoadIC_Generic, KEYED_LOAD_IC, MEGAMORPHIC, \
134 Code::kNoExtraICState) \
135 V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, \
136 Code::kNoExtraICState) \
137 V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MEGAMORPHIC, \
138 Code::kNoExtraICState) \
139 V(KeyedLoadIC_NonStrictArguments, KEYED_LOAD_IC, MEGAMORPHIC, \
140 Code::kNoExtraICState) \
142 V(StoreIC_Initialize, STORE_IC, UNINITIALIZED, \
143 Code::kNoExtraICState) \
144 V(StoreIC_ArrayLength, STORE_IC, MONOMORPHIC, \
145 Code::kNoExtraICState) \
146 V(StoreIC_Normal, STORE_IC, MONOMORPHIC, \
147 Code::kNoExtraICState) \
148 V(StoreIC_Megamorphic, STORE_IC, MEGAMORPHIC, \
149 Code::kNoExtraICState) \
150 V(StoreIC_GlobalProxy, STORE_IC, MEGAMORPHIC, \
151 Code::kNoExtraICState) \
152 V(StoreIC_Initialize_Strict, STORE_IC, UNINITIALIZED, \
154 V(StoreIC_ArrayLength_Strict, STORE_IC, MONOMORPHIC, \
156 V(StoreIC_Normal_Strict, STORE_IC, MONOMORPHIC, \
158 V(StoreIC_Megamorphic_Strict, STORE_IC, MEGAMORPHIC, \
160 V(StoreIC_GlobalProxy_Strict, STORE_IC, MEGAMORPHIC, \
162 V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
165 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, \
166 Code::kNoExtraICState) \
167 V(KeyedStoreIC_Generic, KEYED_STORE_IC, MEGAMORPHIC, \
168 Code::kNoExtraICState) \
170 V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
172 V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \
174 V(KeyedStoreIC_NonStrictArguments, KEYED_STORE_IC, MEGAMORPHIC, \
175 Code::kNoExtraICState) \
176 V(TransitionElementsSmiToDouble, BUILTIN, UNINITIALIZED, \
177 Code::kNoExtraICState) \
178 V(TransitionElementsDoubleToObject, BUILTIN, UNINITIALIZED, \
179 Code::kNoExtraICState) \
182 V(FunctionCall, BUILTIN, UNINITIALIZED, \
183 Code::kNoExtraICState) \
184 V(FunctionApply, BUILTIN, UNINITIALIZED, \
185 Code::kNoExtraICState) \
187 V(InternalArrayCode, BUILTIN, UNINITIALIZED, \
188 Code::kNoExtraICState) \
189 V(ArrayCode, BUILTIN, UNINITIALIZED, \
190 Code::kNoExtraICState) \
191 V(ArrayConstructCode, BUILTIN, UNINITIALIZED, \
192 Code::kNoExtraICState) \
194 V(StringConstructCode, BUILTIN, UNINITIALIZED, \
195 Code::kNoExtraICState) \
197 V(OnStackReplacement, BUILTIN, UNINITIALIZED, \
198 Code::kNoExtraICState)
201 #ifdef ENABLE_DEBUGGER_SUPPORT
203 #define BUILTIN_LIST_DEBUG_A(V) \
204 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK, \
205 Code::kNoExtraICState) \
206 V(CallFunctionStub_DebugBreak, BUILTIN, DEBUG_BREAK, \
207 Code::kNoExtraICState) \
208 V(CallFunctionStub_Recording_DebugBreak, BUILTIN, DEBUG_BREAK, \
209 Code::kNoExtraICState) \
210 V(CallConstructStub_DebugBreak, BUILTIN, DEBUG_BREAK, \
211 Code::kNoExtraICState) \
212 V(CallConstructStub_Recording_DebugBreak, BUILTIN, DEBUG_BREAK, \
213 Code::kNoExtraICState) \
214 V(LoadIC_DebugBreak, LOAD_IC, DEBUG_BREAK, \
215 Code::kNoExtraICState) \
216 V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_BREAK, \
217 Code::kNoExtraICState) \
218 V(StoreIC_DebugBreak, STORE_IC, DEBUG_BREAK, \
219 Code::kNoExtraICState) \
220 V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_BREAK, \
221 Code::kNoExtraICState) \
222 V(Slot_DebugBreak, BUILTIN, DEBUG_BREAK, \
223 Code::kNoExtraICState) \
224 V(PlainReturn_LiveEdit, BUILTIN, DEBUG_BREAK, \
225 Code::kNoExtraICState) \
226 V(FrameDropper_LiveEdit, BUILTIN, DEBUG_BREAK, \
227 Code::kNoExtraICState)
229 #define BUILTIN_LIST_DEBUG_A(V)
233 #define BUILTINS_LIST_JS(V) \
235 V(STRICT_EQUALS, 1) \
254 V(CALL_NON_FUNCTION, 0) \
255 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \
256 V(CALL_FUNCTION_PROXY, 1) \
257 V(CALL_FUNCTION_PROXY_AS_CONSTRUCTOR, 1) \
261 V(STRING_ADD_LEFT, 1) \
262 V(STRING_ADD_RIGHT, 1) \
263 V(APPLY_PREPARE, 1) \
267 class BuiltinFunctionTable;
277 void SetUp(
bool create_heap_objects);
287 #define DEF_ENUM_C(name, ignore) k##name,
288 #define DEF_ENUM_A(name, kind, state, extra) k##name,
298 #define DEF_ENUM_C(name, ignore) c_##name,
305 #define DEF_ENUM(name, ignore) name,
311 #define DECLARE_BUILTIN_ACCESSOR_C(name, ignore) Handle<Code> name();
312 #define DECLARE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \
317 #undef DECLARE_BUILTIN_ACCESSOR_C
318 #undef DECLARE_BUILTIN_ACCESSOR_A
323 return reinterpret_cast<Code*
>(builtins_[name]);
327 return reinterpret_cast<Address>(&builtins_[name]);
331 return c_functions_[id];
352 static const char*
const javascript_names_[
id_count];
353 static int const javascript_argc_[
id_count];
360 static void Generate_JSConstructStubCountdown(
MacroAssembler* masm);
361 static void Generate_JSConstructStubGeneric(
MacroAssembler* masm);
364 static void Generate_JSConstructEntryTrampoline(
MacroAssembler* masm);
370 static void Generate_ArgumentsAdaptorTrampoline(
MacroAssembler* masm);
382 static void InitBuiltinFunctionTable();
394 #endif // V8_BUILTINS_H_
Code * builtin(Name name)
#define DEF_ENUM(name, ignore)
#define BUILTINS_LIST_JS(V)
bool is_initialized() const
#define DECLARE_BUILTIN_ACCESSOR_C(name, ignore)
static const char * GetName(JavaScript id)
#define DEF_ENUM_A(name, kind, state, extra)
#define DECLARE_BUILTIN_ACCESSOR_A(name, kind, state, extra)
static Address c_function_address(CFunctionId id)
void SetUp(bool create_heap_objects)
static int GetArgumentsCount(JavaScript id)
#define DEF_ENUM_C(name, ignore)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Address builtin_address(Name name)
static int NumberOfJavaScriptBuiltins()
const char * Lookup(byte *pc)
#define BUILTIN_LIST_DEBUG_A(V)
Handle< Code > GetCode(JavaScript id, bool *resolved)
void IterateBuiltins(ObjectVisitor *v)
#define BUILTIN_LIST_C(V)
#define BUILTIN_LIST_A(V)