OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BUILTINS_H_ | 5 #ifndef V8_BUILTINS_H_ |
6 #define V8_BUILTINS_H_ | 6 #define V8_BUILTINS_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 \ | 90 \ |
91 V(HandleApiCall, kTarget) \ | 91 V(HandleApiCall, kTarget) \ |
92 V(HandleApiCallConstruct, kTarget) \ | 92 V(HandleApiCallConstruct, kTarget) \ |
93 V(HandleApiCallAsFunction, kNone) \ | 93 V(HandleApiCallAsFunction, kNone) \ |
94 V(HandleApiCallAsConstructor, kNone) \ | 94 V(HandleApiCallAsConstructor, kNone) \ |
95 \ | 95 \ |
96 V(RestrictedFunctionPropertiesThrower, kNone) \ | 96 V(RestrictedFunctionPropertiesThrower, kNone) \ |
97 V(RestrictedStrictArgumentsPropertiesThrower, kNone) | 97 V(RestrictedStrictArgumentsPropertiesThrower, kNone) |
98 | 98 |
99 // Define list of builtins implemented in assembly. | 99 // Define list of builtins implemented in assembly. |
100 #define BUILTIN_LIST_A(V) \ | 100 #define BUILTIN_LIST_A(V) \ |
101 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 101 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
102 \ | 102 \ |
103 V(ConstructedNonConstructable, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 103 V(ConstructedNonConstructable, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
104 \ | 104 \ |
105 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ | 105 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
106 kNoExtraICState) \ | 106 kNoExtraICState) \ |
107 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ | 107 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
108 kNoExtraICState) \ | 108 kNoExtraICState) \ |
109 V(CallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 109 V(CallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
110 V(Call_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 110 V(Call_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
111 V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ | 111 V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
112 kNoExtraICState) \ | 112 kNoExtraICState) \ |
113 V(Call_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 113 V(Call_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
114 \ | 114 \ |
115 V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 115 V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
116 V(ConstructProxy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 116 V(ConstructProxy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
117 V(Construct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 117 V(Construct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
118 \ | 118 \ |
119 V(HandleFastApiCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 119 V(HandleFastApiCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
120 \ | 120 \ |
121 V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 121 V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
122 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 122 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
123 V(JSBuiltinsConstructStub, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 123 V(JSBuiltinsConstructStub, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
124 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 124 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
125 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 125 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
126 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 126 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
127 V(CompileLazy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 127 V(CompileLazy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
128 V(CompileOptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 128 V(CompileOptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
129 V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 129 V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
130 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 130 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
131 V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 131 V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
132 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 132 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
133 V(NotifyStubFailure, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 133 V(NotifyStubFailure, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
134 V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 134 V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
135 \ | 135 \ |
136 V(InterpreterEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 136 V(InterpreterEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
137 V(InterpreterExitTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 137 V(InterpreterExitTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
138 V(InterpreterPushArgsAndCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 138 V(InterpreterPushArgsAndCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
139 V(InterpreterPushArgsAndConstruct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 139 V(InterpreterPushArgsAndConstruct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
140 \ | 140 V(InterpreterNotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
141 V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 141 V(InterpreterNotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
142 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 142 V(InterpreterNotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
143 V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 143 \ |
144 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 144 V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
145 V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \ | 145 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
146 V(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \ | 146 V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
147 \ | 147 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
148 V(KeyedLoadIC_Megamorphic_Strong, KEYED_LOAD_IC, MEGAMORPHIC, \ | 148 V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \ |
149 LoadICState::kStrongModeState) \ | 149 V(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \ |
150 \ | 150 \ |
151 V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \ | 151 V(KeyedLoadIC_Megamorphic_Strong, KEYED_LOAD_IC, MEGAMORPHIC, \ |
152 StoreICState::kStrictModeState) \ | 152 LoadICState::kStrongModeState) \ |
153 \ | 153 \ |
154 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, kNoExtraICState) \ | 154 V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \ |
155 V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \ | 155 StoreICState::kStrictModeState) \ |
156 kNoExtraICState) \ | 156 \ |
157 V(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, MEGAMORPHIC, kNoExtraICState) \ | 157 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, kNoExtraICState) \ |
158 \ | 158 V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \ |
159 V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \ | 159 kNoExtraICState) \ |
160 StoreICState::kStrictModeState) \ | 160 V(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, MEGAMORPHIC, kNoExtraICState) \ |
161 V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \ | 161 \ |
162 StoreICState::kStrictModeState) \ | 162 V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \ |
163 V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \ | 163 StoreICState::kStrictModeState) \ |
164 StoreICState::kStrictModeState) \ | 164 V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \ |
165 \ | 165 StoreICState::kStrictModeState) \ |
166 V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 166 V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \ |
167 V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 167 StoreICState::kStrictModeState) \ |
168 V(ReflectApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 168 \ |
169 V(ReflectConstruct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 169 V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
170 \ | 170 V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
171 V(InternalArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 171 V(ReflectApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
172 V(ArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 172 V(ReflectConstruct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
173 \ | 173 \ |
174 V(StringConstructor, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 174 V(InternalArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
175 V(StringConstructor_ConstructStub, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 175 V(ArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
176 \ | 176 \ |
177 V(OnStackReplacement, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 177 V(StringConstructor, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
178 V(InterruptCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 178 V(StringConstructor_ConstructStub, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
179 V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 179 \ |
180 V(StackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 180 V(OnStackReplacement, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
181 \ | 181 V(InterruptCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
182 V(MarkCodeAsToBeExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 182 V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
183 V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 183 V(StackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
184 V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 184 \ |
| 185 V(MarkCodeAsToBeExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 186 V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 187 V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
185 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) | 188 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) |
186 | 189 |
187 // Define list of builtin handlers implemented in assembly. | 190 // Define list of builtin handlers implemented in assembly. |
188 #define BUILTIN_LIST_H(V) \ | 191 #define BUILTIN_LIST_H(V) \ |
189 V(LoadIC_Slow, LOAD_IC) \ | 192 V(LoadIC_Slow, LOAD_IC) \ |
190 V(LoadIC_Slow_Strong, LOAD_IC) \ | 193 V(LoadIC_Slow_Strong, LOAD_IC) \ |
191 V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \ | 194 V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \ |
192 V(KeyedLoadIC_Slow_Strong, KEYED_LOAD_IC) \ | 195 V(KeyedLoadIC_Slow_Strong, KEYED_LOAD_IC) \ |
193 V(StoreIC_Slow, STORE_IC) \ | 196 V(StoreIC_Slow, STORE_IC) \ |
194 V(KeyedStoreIC_Slow, KEYED_STORE_IC) \ | 197 V(KeyedStoreIC_Slow, KEYED_STORE_IC) \ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); | 365 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); |
363 static void Generate_OnStackReplacement(MacroAssembler* masm); | 366 static void Generate_OnStackReplacement(MacroAssembler* masm); |
364 static void Generate_OsrAfterStackCheck(MacroAssembler* masm); | 367 static void Generate_OsrAfterStackCheck(MacroAssembler* masm); |
365 static void Generate_InterruptCheck(MacroAssembler* masm); | 368 static void Generate_InterruptCheck(MacroAssembler* masm); |
366 static void Generate_StackCheck(MacroAssembler* masm); | 369 static void Generate_StackCheck(MacroAssembler* masm); |
367 | 370 |
368 static void Generate_InterpreterEntryTrampoline(MacroAssembler* masm); | 371 static void Generate_InterpreterEntryTrampoline(MacroAssembler* masm); |
369 static void Generate_InterpreterExitTrampoline(MacroAssembler* masm); | 372 static void Generate_InterpreterExitTrampoline(MacroAssembler* masm); |
370 static void Generate_InterpreterPushArgsAndCall(MacroAssembler* masm); | 373 static void Generate_InterpreterPushArgsAndCall(MacroAssembler* masm); |
371 static void Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm); | 374 static void Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm); |
| 375 static void Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm); |
| 376 static void Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm); |
| 377 static void Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm); |
372 | 378 |
373 #define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C) \ | 379 #define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C) \ |
374 static void Generate_Make##C##CodeYoungAgainEvenMarking( \ | 380 static void Generate_Make##C##CodeYoungAgainEvenMarking( \ |
375 MacroAssembler* masm); \ | 381 MacroAssembler* masm); \ |
376 static void Generate_Make##C##CodeYoungAgainOddMarking( \ | 382 static void Generate_Make##C##CodeYoungAgainOddMarking( \ |
377 MacroAssembler* masm); | 383 MacroAssembler* masm); |
378 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) | 384 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) |
379 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR | 385 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR |
380 | 386 |
381 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm); | 387 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm); |
382 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); | 388 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); |
383 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); | 389 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); |
384 | 390 |
385 static void InitBuiltinFunctionTable(); | 391 static void InitBuiltinFunctionTable(); |
386 | 392 |
387 bool initialized_; | 393 bool initialized_; |
388 | 394 |
389 friend class BuiltinFunctionTable; | 395 friend class BuiltinFunctionTable; |
390 friend class Isolate; | 396 friend class Isolate; |
391 | 397 |
392 DISALLOW_COPY_AND_ASSIGN(Builtins); | 398 DISALLOW_COPY_AND_ASSIGN(Builtins); |
393 }; | 399 }; |
394 | 400 |
395 } // namespace internal | 401 } // namespace internal |
396 } // namespace v8 | 402 } // namespace v8 |
397 | 403 |
398 #endif // V8_BUILTINS_H_ | 404 #endif // V8_BUILTINS_H_ |
OLD | NEW |