Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_BUILTINS_H_ |
| 6 | #define V8_BUILTINS_H_ |
| 7 | |
| 8 | namespace v8 { |
| 9 | namespace internal { |
| 10 | |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 11 | // Specifies extra arguments required by a C++ builtin. |
| 12 | enum BuiltinExtraArguments { |
| 13 | NO_EXTRA_ARGUMENTS = 0, |
| 14 | NEEDS_CALLED_FUNCTION = 1 |
| 15 | }; |
| 16 | |
| 17 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 18 | #define CODE_AGE_LIST_WITH_ARG(V, A) \ |
| 19 | V(Quadragenarian, A) \ |
| 20 | V(Quinquagenarian, A) \ |
| 21 | V(Sexagenarian, A) \ |
| 22 | V(Septuagenarian, A) \ |
| 23 | V(Octogenarian, A) |
| 24 | |
| 25 | #define CODE_AGE_LIST_IGNORE_ARG(X, V) V(X) |
| 26 | |
| 27 | #define CODE_AGE_LIST(V) \ |
| 28 | CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V) |
| 29 | |
| 30 | #define CODE_AGE_LIST_COMPLETE(V) \ |
| 31 | V(NotExecuted) \ |
| 32 | V(ExecutedOnce) \ |
| 33 | V(NoAge) \ |
| 34 | CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V) |
| 35 | |
| 36 | #define DECLARE_CODE_AGE_BUILTIN(C, V) \ |
| 37 | V(Make##C##CodeYoungAgainOddMarking, BUILTIN, \ |
| 38 | UNINITIALIZED, kNoExtraICState) \ |
| 39 | V(Make##C##CodeYoungAgainEvenMarking, BUILTIN, \ |
| 40 | UNINITIALIZED, kNoExtraICState) |
| 41 | |
| 42 | |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 43 | // Define list of builtins implemented in C++. |
| 44 | #define BUILTIN_LIST_C(V) \ |
| 45 | V(Illegal, NO_EXTRA_ARGUMENTS) \ |
| 46 | \ |
| 47 | V(EmptyFunction, NO_EXTRA_ARGUMENTS) \ |
| 48 | \ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 49 | V(ArrayPush, NO_EXTRA_ARGUMENTS) \ |
| 50 | V(ArrayPop, NO_EXTRA_ARGUMENTS) \ |
Andrei Popescu | 402d937 | 2010-02-26 13:31:12 +0000 | [diff] [blame] | 51 | V(ArrayShift, NO_EXTRA_ARGUMENTS) \ |
| 52 | V(ArrayUnshift, NO_EXTRA_ARGUMENTS) \ |
| 53 | V(ArraySlice, NO_EXTRA_ARGUMENTS) \ |
| 54 | V(ArraySplice, NO_EXTRA_ARGUMENTS) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 55 | V(ArrayConcat, NO_EXTRA_ARGUMENTS) \ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 56 | \ |
| 57 | V(HandleApiCall, NEEDS_CALLED_FUNCTION) \ |
| 58 | V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \ |
| 59 | V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \ |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 60 | V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \ |
| 61 | \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 62 | V(StrictModePoisonPill, NO_EXTRA_ARGUMENTS) \ |
| 63 | V(GeneratorPoisonPill, NO_EXTRA_ARGUMENTS) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 64 | |
| 65 | // Define list of builtins implemented in assembly. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 66 | #define BUILTIN_LIST_A(V) \ |
| 67 | V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 68 | V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 69 | V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 70 | V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 71 | V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 72 | V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 73 | V(CompileLazy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 74 | V(CompileOptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 75 | V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 76 | V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 77 | V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 78 | V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 79 | V(NotifyStubFailure, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 80 | V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 81 | \ |
| 82 | V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 83 | V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 84 | V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 85 | V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 86 | V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \ |
| 87 | V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, kNoExtraICState) \ |
| 88 | V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \ |
| 89 | kNoExtraICState) \ |
| 90 | V(KeyedLoadIC_Generic, KEYED_LOAD_IC, GENERIC, kNoExtraICState) \ |
| 91 | V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \ |
| 92 | \ |
| 93 | V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, StoreIC::kStrictModeState) \ |
| 94 | \ |
| 95 | V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, kNoExtraICState) \ |
| 96 | V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \ |
| 97 | kNoExtraICState) \ |
| 98 | V(KeyedStoreIC_Generic, KEYED_STORE_IC, GENERIC, kNoExtraICState) \ |
| 99 | \ |
| 100 | V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \ |
| 101 | StoreIC::kStrictModeState) \ |
| 102 | V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \ |
| 103 | StoreIC::kStrictModeState) \ |
| 104 | V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, GENERIC, \ |
| 105 | StoreIC::kStrictModeState) \ |
| 106 | V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \ |
| 107 | kNoExtraICState) \ |
| 108 | \ |
| 109 | /* Uses KeyedLoadIC_Initialize; must be after in list. */ \ |
| 110 | V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 111 | V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 112 | \ |
| 113 | V(InternalArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 114 | V(ArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 115 | \ |
| 116 | V(StringConstructCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 117 | \ |
| 118 | V(OnStackReplacement, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 119 | V(InterruptCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 120 | V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 121 | V(StackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 122 | \ |
| 123 | V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 124 | V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 125 | CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 126 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 127 | // Define list of builtin handlers implemented in assembly. |
| 128 | #define BUILTIN_LIST_H(V) \ |
| 129 | V(LoadIC_Slow, LOAD_IC) \ |
| 130 | V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \ |
| 131 | V(StoreIC_Slow, STORE_IC) \ |
| 132 | V(KeyedStoreIC_Slow, KEYED_STORE_IC) \ |
| 133 | V(LoadIC_Normal, LOAD_IC) \ |
| 134 | V(StoreIC_Normal, STORE_IC) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 135 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 136 | // Define list of builtins used by the debugger implemented in assembly. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 137 | #define BUILTIN_LIST_DEBUG_A(V) \ |
| 138 | V(Return_DebugBreak, BUILTIN, DEBUG_STUB, \ |
| 139 | DEBUG_BREAK) \ |
| 140 | V(CallFunctionStub_DebugBreak, BUILTIN, DEBUG_STUB, \ |
| 141 | DEBUG_BREAK) \ |
| 142 | V(CallConstructStub_DebugBreak, BUILTIN, DEBUG_STUB, \ |
| 143 | DEBUG_BREAK) \ |
| 144 | V(CallConstructStub_Recording_DebugBreak, BUILTIN, DEBUG_STUB, \ |
| 145 | DEBUG_BREAK) \ |
| 146 | V(CallICStub_DebugBreak, CALL_IC, DEBUG_STUB, \ |
| 147 | DEBUG_BREAK) \ |
| 148 | V(LoadIC_DebugBreak, LOAD_IC, DEBUG_STUB, \ |
| 149 | DEBUG_BREAK) \ |
| 150 | V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_STUB, \ |
| 151 | DEBUG_BREAK) \ |
| 152 | V(StoreIC_DebugBreak, STORE_IC, DEBUG_STUB, \ |
| 153 | DEBUG_BREAK) \ |
| 154 | V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_STUB, \ |
| 155 | DEBUG_BREAK) \ |
| 156 | V(CompareNilIC_DebugBreak, COMPARE_NIL_IC, DEBUG_STUB, \ |
| 157 | DEBUG_BREAK) \ |
| 158 | V(Slot_DebugBreak, BUILTIN, DEBUG_STUB, \ |
| 159 | DEBUG_BREAK) \ |
| 160 | V(PlainReturn_LiveEdit, BUILTIN, DEBUG_STUB, \ |
| 161 | DEBUG_BREAK) \ |
| 162 | V(FrameDropper_LiveEdit, BUILTIN, DEBUG_STUB, \ |
| 163 | DEBUG_BREAK) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 164 | |
| 165 | // Define list of builtins implemented in JavaScript. |
| 166 | #define BUILTINS_LIST_JS(V) \ |
| 167 | V(EQUALS, 1) \ |
| 168 | V(STRICT_EQUALS, 1) \ |
| 169 | V(COMPARE, 2) \ |
| 170 | V(ADD, 1) \ |
| 171 | V(SUB, 1) \ |
| 172 | V(MUL, 1) \ |
| 173 | V(DIV, 1) \ |
| 174 | V(MOD, 1) \ |
| 175 | V(BIT_OR, 1) \ |
| 176 | V(BIT_AND, 1) \ |
| 177 | V(BIT_XOR, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 178 | V(SHL, 1) \ |
| 179 | V(SAR, 1) \ |
| 180 | V(SHR, 1) \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 181 | V(DELETE, 2) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 182 | V(IN, 1) \ |
| 183 | V(INSTANCE_OF, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 184 | V(FILTER_KEY, 1) \ |
| 185 | V(CALL_NON_FUNCTION, 0) \ |
| 186 | V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \ |
Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 187 | V(CALL_FUNCTION_PROXY, 1) \ |
| 188 | V(CALL_FUNCTION_PROXY_AS_CONSTRUCTOR, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 189 | V(TO_OBJECT, 0) \ |
| 190 | V(TO_NUMBER, 0) \ |
| 191 | V(TO_STRING, 0) \ |
| 192 | V(STRING_ADD_LEFT, 1) \ |
| 193 | V(STRING_ADD_RIGHT, 1) \ |
| 194 | V(APPLY_PREPARE, 1) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 195 | V(STACK_OVERFLOW, 1) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 196 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 197 | class BuiltinFunctionTable; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 198 | class ObjectVisitor; |
| 199 | |
| 200 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 201 | class Builtins { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 202 | public: |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 203 | ~Builtins(); |
| 204 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 205 | // Generate all builtin code objects. Should be called once during |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 206 | // isolate initialization. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 207 | void SetUp(Isolate* isolate, bool create_heap_objects); |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 208 | void TearDown(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 209 | |
| 210 | // Garbage collection support. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 211 | void IterateBuiltins(ObjectVisitor* v); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 212 | |
| 213 | // Disassembler support. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 214 | const char* Lookup(byte* pc); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 215 | |
| 216 | enum Name { |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 217 | #define DEF_ENUM_C(name, ignore) k##name, |
| 218 | #define DEF_ENUM_A(name, kind, state, extra) k##name, |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 219 | #define DEF_ENUM_H(name, kind) k##name, |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 220 | BUILTIN_LIST_C(DEF_ENUM_C) |
| 221 | BUILTIN_LIST_A(DEF_ENUM_A) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 222 | BUILTIN_LIST_H(DEF_ENUM_H) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 223 | BUILTIN_LIST_DEBUG_A(DEF_ENUM_A) |
| 224 | #undef DEF_ENUM_C |
| 225 | #undef DEF_ENUM_A |
| 226 | builtin_count |
| 227 | }; |
| 228 | |
| 229 | enum CFunctionId { |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 230 | #define DEF_ENUM_C(name, ignore) c_##name, |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 231 | BUILTIN_LIST_C(DEF_ENUM_C) |
| 232 | #undef DEF_ENUM_C |
| 233 | cfunction_count |
| 234 | }; |
| 235 | |
| 236 | enum JavaScript { |
| 237 | #define DEF_ENUM(name, ignore) name, |
| 238 | BUILTINS_LIST_JS(DEF_ENUM) |
| 239 | #undef DEF_ENUM |
| 240 | id_count |
| 241 | }; |
| 242 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 243 | #define DECLARE_BUILTIN_ACCESSOR_C(name, ignore) Handle<Code> name(); |
| 244 | #define DECLARE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ |
| 245 | Handle<Code> name(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 246 | #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name(); |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 247 | BUILTIN_LIST_C(DECLARE_BUILTIN_ACCESSOR_C) |
| 248 | BUILTIN_LIST_A(DECLARE_BUILTIN_ACCESSOR_A) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 249 | BUILTIN_LIST_H(DECLARE_BUILTIN_ACCESSOR_H) |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 250 | BUILTIN_LIST_DEBUG_A(DECLARE_BUILTIN_ACCESSOR_A) |
| 251 | #undef DECLARE_BUILTIN_ACCESSOR_C |
| 252 | #undef DECLARE_BUILTIN_ACCESSOR_A |
| 253 | |
| 254 | Code* builtin(Name name) { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 255 | // Code::cast cannot be used here since we access builtins |
| 256 | // during the marking phase of mark sweep. See IC::Clear. |
| 257 | return reinterpret_cast<Code*>(builtins_[name]); |
| 258 | } |
| 259 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 260 | Address builtin_address(Name name) { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 261 | return reinterpret_cast<Address>(&builtins_[name]); |
| 262 | } |
| 263 | |
| 264 | static Address c_function_address(CFunctionId id) { |
| 265 | return c_functions_[id]; |
| 266 | } |
| 267 | |
| 268 | static const char* GetName(JavaScript id) { return javascript_names_[id]; } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 269 | const char* name(int index) { |
| 270 | DCHECK(index >= 0); |
| 271 | DCHECK(index < builtin_count); |
| 272 | return names_[index]; |
| 273 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 274 | static int GetArgumentsCount(JavaScript id) { return javascript_argc_[id]; } |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 275 | Handle<Code> GetCode(JavaScript id, bool* resolved); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 276 | static int NumberOfJavaScriptBuiltins() { return id_count; } |
| 277 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 278 | bool is_initialized() const { return initialized_; } |
| 279 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 280 | private: |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 281 | Builtins(); |
| 282 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 283 | // The external C++ functions called from the code. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 284 | static Address const c_functions_[cfunction_count]; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 285 | |
| 286 | // Note: These are always Code objects, but to conform with |
| 287 | // IterateBuiltins() above which assumes Object**'s for the callback |
| 288 | // function f, we use an Object* array here. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 289 | Object* builtins_[builtin_count]; |
| 290 | const char* names_[builtin_count]; |
| 291 | static const char* const javascript_names_[id_count]; |
| 292 | static int const javascript_argc_[id_count]; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 293 | |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 294 | static void Generate_Adaptor(MacroAssembler* masm, |
| 295 | CFunctionId id, |
| 296 | BuiltinExtraArguments extra_args); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 297 | static void Generate_CompileLazy(MacroAssembler* masm); |
| 298 | static void Generate_InOptimizationQueue(MacroAssembler* masm); |
| 299 | static void Generate_CompileOptimized(MacroAssembler* masm); |
| 300 | static void Generate_CompileOptimizedConcurrent(MacroAssembler* masm); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 301 | static void Generate_JSConstructStubGeneric(MacroAssembler* masm); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 302 | static void Generate_JSConstructStubApi(MacroAssembler* masm); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 303 | static void Generate_JSEntryTrampoline(MacroAssembler* masm); |
| 304 | static void Generate_JSConstructEntryTrampoline(MacroAssembler* masm); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 305 | static void Generate_NotifyDeoptimized(MacroAssembler* masm); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 306 | static void Generate_NotifySoftDeoptimized(MacroAssembler* masm); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 307 | static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 308 | static void Generate_NotifyStubFailure(MacroAssembler* masm); |
| 309 | static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 310 | static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); |
| 311 | |
| 312 | static void Generate_FunctionCall(MacroAssembler* masm); |
| 313 | static void Generate_FunctionApply(MacroAssembler* masm); |
| 314 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 315 | static void Generate_InternalArrayCode(MacroAssembler* masm); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 316 | static void Generate_ArrayCode(MacroAssembler* masm); |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 317 | |
| 318 | static void Generate_StringConstructCode(MacroAssembler* masm); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 319 | static void Generate_OnStackReplacement(MacroAssembler* masm); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 320 | static void Generate_OsrAfterStackCheck(MacroAssembler* masm); |
| 321 | static void Generate_InterruptCheck(MacroAssembler* masm); |
| 322 | static void Generate_StackCheck(MacroAssembler* masm); |
| 323 | |
| 324 | #define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C) \ |
| 325 | static void Generate_Make##C##CodeYoungAgainEvenMarking( \ |
| 326 | MacroAssembler* masm); \ |
| 327 | static void Generate_Make##C##CodeYoungAgainOddMarking( \ |
| 328 | MacroAssembler* masm); |
| 329 | CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) |
| 330 | #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR |
| 331 | |
| 332 | static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); |
| 333 | static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 334 | |
| 335 | static void InitBuiltinFunctionTable(); |
| 336 | |
| 337 | bool initialized_; |
| 338 | |
| 339 | friend class BuiltinFunctionTable; |
| 340 | friend class Isolate; |
| 341 | |
| 342 | DISALLOW_COPY_AND_ASSIGN(Builtins); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 343 | }; |
| 344 | |
| 345 | } } // namespace v8::internal |
| 346 | |
| 347 | #endif // V8_BUILTINS_H_ |