28 #ifndef V8_BUILTINS_H_
29 #define V8_BUILTINS_H_
41 #define CODE_AGE_LIST_WITH_ARG(V, A) \
42 V(Quadragenarian, A) \
43 V(Quinquagenarian, A) \
45 V(Septuagenarian, A) \
48 #define CODE_AGE_LIST_IGNORE_ARG(X, V) V(X)
50 #define CODE_AGE_LIST(V) \
51 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V)
53 #define CODE_AGE_LIST_COMPLETE(V) \
57 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V)
59 #define DECLARE_CODE_AGE_BUILTIN(C, V) \
60 V(Make##C##CodeYoungAgainOddMarking, BUILTIN, \
61 UNINITIALIZED, kNoExtraICState) \
62 V(Make##C##CodeYoungAgainEvenMarking, BUILTIN, \
63 UNINITIALIZED, kNoExtraICState)
67 #define BUILTIN_LIST_C(V) \
68 V(Illegal, NO_EXTRA_ARGUMENTS) \
70 V(EmptyFunction, NO_EXTRA_ARGUMENTS) \
72 V(ArrayPush, NO_EXTRA_ARGUMENTS) \
73 V(ArrayPop, NO_EXTRA_ARGUMENTS) \
74 V(ArrayShift, NO_EXTRA_ARGUMENTS) \
75 V(ArrayUnshift, NO_EXTRA_ARGUMENTS) \
76 V(ArraySlice, NO_EXTRA_ARGUMENTS) \
77 V(ArraySplice, NO_EXTRA_ARGUMENTS) \
78 V(ArrayConcat, NO_EXTRA_ARGUMENTS) \
80 V(HandleApiCall, NEEDS_CALLED_FUNCTION) \
81 V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \
82 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \
83 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \
85 V(StrictModePoisonPill, NO_EXTRA_ARGUMENTS)
88 #define BUILTIN_LIST_A(V) \
89 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, \
91 V(InOptimizationQueue, BUILTIN, UNINITIALIZED, \
93 V(JSConstructStubCountdown, BUILTIN, UNINITIALIZED, \
95 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, \
97 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, \
99 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, \
101 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, \
103 V(CompileUnoptimized, BUILTIN, UNINITIALIZED, \
105 V(CompileOptimized, BUILTIN, UNINITIALIZED, \
107 V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, \
109 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, \
111 V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, \
113 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \
115 V(NotifyStubFailure, BUILTIN, UNINITIALIZED, \
117 V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, \
120 V(LoadIC_Miss, BUILTIN, UNINITIALIZED, \
122 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, \
124 V(StoreIC_Miss, BUILTIN, UNINITIALIZED, \
126 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, \
128 V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, \
130 V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, \
132 V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \
134 V(KeyedLoadIC_Generic, KEYED_LOAD_IC, GENERIC, \
136 V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, \
138 V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MONOMORPHIC, \
140 V(KeyedLoadIC_SloppyArguments, KEYED_LOAD_IC, MONOMORPHIC, \
143 V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
144 StoreIC::kStrictModeState) \
146 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, \
148 V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \
150 V(KeyedStoreIC_Generic, KEYED_STORE_IC, GENERIC, \
153 V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
154 StoreIC::kStrictModeState) \
155 V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \
156 StoreIC::kStrictModeState) \
157 V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, GENERIC, \
158 StoreIC::kStrictModeState) \
159 V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \
163 V(FunctionCall, BUILTIN, UNINITIALIZED, \
165 V(FunctionApply, BUILTIN, UNINITIALIZED, \
168 V(InternalArrayCode, BUILTIN, UNINITIALIZED, \
170 V(ArrayCode, BUILTIN, UNINITIALIZED, \
173 V(StringConstructCode, BUILTIN, UNINITIALIZED, \
176 V(OnStackReplacement, BUILTIN, UNINITIALIZED, \
178 V(InterruptCheck, BUILTIN, UNINITIALIZED, \
180 V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, \
182 V(StackCheck, BUILTIN, UNINITIALIZED, \
185 V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, \
187 V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, \
189 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V)
192 #define BUILTIN_LIST_H(V) \
193 V(LoadIC_Slow, LOAD_IC) \
194 V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \
195 V(StoreIC_Slow, STORE_IC) \
196 V(KeyedStoreIC_Slow, KEYED_STORE_IC) \
197 V(LoadIC_Normal, LOAD_IC) \
198 V(StoreIC_Normal, STORE_IC)
200 #ifdef ENABLE_DEBUGGER_SUPPORT
202 #define BUILTIN_LIST_DEBUG_A(V) \
203 V(Return_DebugBreak, BUILTIN, DEBUG_STUB, \
205 V(CallFunctionStub_DebugBreak, BUILTIN, DEBUG_STUB, \
207 V(CallFunctionStub_Recording_DebugBreak, BUILTIN, DEBUG_STUB, \
209 V(CallConstructStub_DebugBreak, BUILTIN, DEBUG_STUB, \
211 V(CallConstructStub_Recording_DebugBreak, BUILTIN, DEBUG_STUB, \
213 V(LoadIC_DebugBreak, LOAD_IC, DEBUG_STUB, \
215 V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_STUB, \
217 V(StoreIC_DebugBreak, STORE_IC, DEBUG_STUB, \
219 V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_STUB, \
221 V(CompareNilIC_DebugBreak, COMPARE_NIL_IC, DEBUG_STUB, \
223 V(Slot_DebugBreak, BUILTIN, DEBUG_STUB, \
225 V(PlainReturn_LiveEdit, BUILTIN, DEBUG_STUB, \
227 V(FrameDropper_LiveEdit, BUILTIN, DEBUG_STUB, \
230 #define BUILTIN_LIST_DEBUG_A(V)
234 #define BUILTINS_LIST_JS(V) \
236 V(STRICT_EQUALS, 1) \
253 V(CALL_NON_FUNCTION, 0) \
254 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \
255 V(CALL_FUNCTION_PROXY, 1) \
256 V(CALL_FUNCTION_PROXY_AS_CONSTRUCTOR, 1) \
260 V(STRING_ADD_LEFT, 1) \
261 V(STRING_ADD_RIGHT, 1) \
262 V(APPLY_PREPARE, 1) \
265 class BuiltinFunctionTable;
285 #define DEF_ENUM_C(name, ignore) k##name,
286 #define DEF_ENUM_A(name, kind, state, extra) k##name,
287 #define DEF_ENUM_H(name, kind) 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) \
314 #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name();
319 #undef DECLARE_BUILTIN_ACCESSOR_C
320 #undef DECLARE_BUILTIN_ACCESSOR_A
325 return reinterpret_cast<Code*
>(builtins_[
name]);
329 return reinterpret_cast<Address>(&builtins_[
name]);
333 return c_functions_[id];
340 return names_[index];
359 static const char*
const javascript_names_[
id_count];
360 static int const javascript_argc_[
id_count];
368 static void Generate_CompileOptimizedConcurrent(
MacroAssembler* masm);
369 static void Generate_JSConstructStubCountdown(
MacroAssembler* masm);
370 static void Generate_JSConstructStubGeneric(
MacroAssembler* masm);
373 static void Generate_JSConstructEntryTrampoline(
MacroAssembler* masm);
378 static void Generate_NotifyStubFailureSaveDoubles(
MacroAssembler* masm);
379 static void Generate_ArgumentsAdaptorTrampoline(
MacroAssembler* masm);
393 #define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C) \
394 static void Generate_Make##C##CodeYoungAgainEvenMarking( \
395 MacroAssembler* masm); \
396 static void Generate_Make##C##CodeYoungAgainOddMarking( \
397 MacroAssembler* masm);
399 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR
401 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm);
402 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm);
404 static void InitBuiltinFunctionTable();
416 #endif // V8_BUILTINS_H_
Code * builtin(Name name)
#define DEF_ENUM(name, ignore)
#define BUILTINS_LIST_JS(V)
bool is_initialized() const
#define BUILTIN_LIST_H(V)
void SetUp(Isolate *isolate, bool create_heap_objects)
#define ASSERT(condition)
#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)
#define DECLARE_BUILTIN_ACCESSOR_H(name, kind)
static Address c_function_address(CFunctionId id)
#define DEF_ENUM_H(name, kind)
static int GetArgumentsCount(JavaScript id)
#define DEF_ENUM_C(name, ignore)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Address builtin_address(Name name)
#define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C)
static int NumberOfJavaScriptBuiltins()
const char * Lookup(byte *pc)
#define BUILTIN_LIST_DEBUG_A(V)
Handle< Code > GetCode(JavaScript id, bool *resolved)
const char * name(int index)
void IterateBuiltins(ObjectVisitor *v)
#define BUILTIN_LIST_C(V)
#define BUILTIN_LIST_A(V)