| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 V(ArrayConcat, NO_EXTRA_ARGUMENTS) \ | 55 V(ArrayConcat, NO_EXTRA_ARGUMENTS) \ |
| 56 \ | 56 \ |
| 57 V(HandleApiCall, NEEDS_CALLED_FUNCTION) \ | 57 V(HandleApiCall, NEEDS_CALLED_FUNCTION) \ |
| 58 V(FastHandleApiCall, NO_EXTRA_ARGUMENTS) \ | 58 V(FastHandleApiCall, NO_EXTRA_ARGUMENTS) \ |
| 59 V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \ | 59 V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \ |
| 60 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \ | 60 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \ |
| 61 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) | 61 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) |
| 62 | 62 |
| 63 | 63 |
| 64 // Define list of builtins implemented in assembly. | 64 // Define list of builtins implemented in assembly. |
| 65 #define BUILTIN_LIST_A(V) \ | 65 #define BUILTIN_LIST_A(V) \ |
| 66 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED) \ | 66 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, \ |
| 67 V(JSConstructCall, BUILTIN, UNINITIALIZED) \ | 67 Code::kNoExtraICState) \ |
| 68 V(JSConstructStubCountdown, BUILTIN, UNINITIALIZED) \ | 68 V(JSConstructCall, BUILTIN, UNINITIALIZED, \ |
| 69 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED) \ | 69 Code::kNoExtraICState) \ |
| 70 V(JSConstructStubApi, BUILTIN, UNINITIALIZED) \ | 70 V(JSConstructStubCountdown, BUILTIN, UNINITIALIZED, \ |
| 71 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED) \ | 71 Code::kNoExtraICState) \ |
| 72 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED) \ | 72 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, \ |
| 73 V(LazyCompile, BUILTIN, UNINITIALIZED) \ | 73 Code::kNoExtraICState) \ |
| 74 V(LazyRecompile, BUILTIN, UNINITIALIZED) \ | 74 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, \ |
| 75 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED) \ | 75 Code::kNoExtraICState) \ |
| 76 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED) \ | 76 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, \ |
| 77 V(NotifyOSR, BUILTIN, UNINITIALIZED) \ | 77 Code::kNoExtraICState) \ |
| 78 \ | 78 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, \ |
| 79 V(LoadIC_Miss, BUILTIN, UNINITIALIZED) \ | 79 Code::kNoExtraICState) \ |
| 80 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED) \ | 80 V(LazyCompile, BUILTIN, UNINITIALIZED, \ |
| 81 V(StoreIC_Miss, BUILTIN, UNINITIALIZED) \ | 81 Code::kNoExtraICState) \ |
| 82 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED) \ | 82 V(LazyRecompile, BUILTIN, UNINITIALIZED, \ |
| 83 \ | 83 Code::kNoExtraICState) \ |
| 84 V(LoadIC_Initialize, LOAD_IC, UNINITIALIZED) \ | 84 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, \ |
| 85 V(LoadIC_PreMonomorphic, LOAD_IC, PREMONOMORPHIC) \ | 85 Code::kNoExtraICState) \ |
| 86 V(LoadIC_Normal, LOAD_IC, MONOMORPHIC) \ | 86 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \ |
| 87 V(LoadIC_ArrayLength, LOAD_IC, MONOMORPHIC) \ | 87 Code::kNoExtraICState) \ |
| 88 V(LoadIC_StringLength, LOAD_IC, MONOMORPHIC) \ | 88 V(NotifyOSR, BUILTIN, UNINITIALIZED, \ |
| 89 V(LoadIC_StringWrapperLength, LOAD_IC, MONOMORPHIC) \ | 89 Code::kNoExtraICState) \ |
| 90 V(LoadIC_FunctionPrototype, LOAD_IC, MONOMORPHIC) \ | 90 \ |
| 91 V(LoadIC_Megamorphic, LOAD_IC, MEGAMORPHIC) \ | 91 V(LoadIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 92 \ | 92 Code::kNoExtraICState) \ |
| 93 V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED) \ | 93 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 94 V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC) \ | 94 Code::kNoExtraICState) \ |
| 95 V(KeyedLoadIC_Generic, KEYED_LOAD_IC, MEGAMORPHIC) \ | 95 V(StoreIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 96 V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC) \ | 96 Code::kNoExtraICState) \ |
| 97 V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MEGAMORPHIC) \ | 97 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 98 \ | 98 Code::kNoExtraICState) \ |
| 99 V(StoreIC_Initialize, STORE_IC, UNINITIALIZED) \ | 99 \ |
| 100 V(StoreIC_ArrayLength, STORE_IC, MONOMORPHIC) \ | 100 V(LoadIC_Initialize, LOAD_IC, UNINITIALIZED, \ |
| 101 V(StoreIC_Normal, STORE_IC, MONOMORPHIC) \ | 101 Code::kNoExtraICState) \ |
| 102 V(StoreIC_Megamorphic, STORE_IC, MEGAMORPHIC) \ | 102 V(LoadIC_PreMonomorphic, LOAD_IC, PREMONOMORPHIC, \ |
| 103 V(StoreIC_GlobalProxy, STORE_IC, MEGAMORPHIC) \ | 103 Code::kNoExtraICState) \ |
| 104 \ | 104 V(LoadIC_Normal, LOAD_IC, MONOMORPHIC, \ |
| 105 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED) \ | 105 Code::kNoExtraICState) \ |
| 106 V(KeyedStoreIC_Generic, KEYED_STORE_IC, MEGAMORPHIC) \ | 106 V(LoadIC_ArrayLength, LOAD_IC, MONOMORPHIC, \ |
| 107 \ | 107 Code::kNoExtraICState) \ |
| 108 /* Uses KeyedLoadIC_Initialize; must be after in list. */ \ | 108 V(LoadIC_StringLength, LOAD_IC, MONOMORPHIC, \ |
| 109 V(FunctionCall, BUILTIN, UNINITIALIZED) \ | 109 Code::kNoExtraICState) \ |
| 110 V(FunctionApply, BUILTIN, UNINITIALIZED) \ | 110 V(LoadIC_StringWrapperLength, LOAD_IC, MONOMORPHIC, \ |
| 111 \ | 111 Code::kNoExtraICState) \ |
| 112 V(ArrayCode, BUILTIN, UNINITIALIZED) \ | 112 V(LoadIC_FunctionPrototype, LOAD_IC, MONOMORPHIC, \ |
| 113 V(ArrayConstructCode, BUILTIN, UNINITIALIZED) \ | 113 Code::kNoExtraICState) \ |
| 114 \ | 114 V(LoadIC_Megamorphic, LOAD_IC, MEGAMORPHIC, \ |
| 115 V(StringConstructCode, BUILTIN, UNINITIALIZED) \ | 115 Code::kNoExtraICState) \ |
| 116 \ | 116 \ |
| 117 V(OnStackReplacement, BUILTIN, UNINITIALIZED) | 117 V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, \ |
| 118 Code::kNoExtraICState) \ |
| 119 V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \ |
| 120 Code::kNoExtraICState) \ |
| 121 V(KeyedLoadIC_Generic, KEYED_LOAD_IC, MEGAMORPHIC, \ |
| 122 Code::kNoExtraICState) \ |
| 123 V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, \ |
| 124 Code::kNoExtraICState) \ |
| 125 V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MEGAMORPHIC, \ |
| 126 Code::kNoExtraICState) \ |
| 127 \ |
| 128 V(StoreIC_Initialize, STORE_IC, UNINITIALIZED, \ |
| 129 Code::kNoExtraICState) \ |
| 130 V(StoreIC_ArrayLength, STORE_IC, MONOMORPHIC, \ |
| 131 Code::kNoExtraICState) \ |
| 132 V(StoreIC_Normal, STORE_IC, MONOMORPHIC, \ |
| 133 Code::kNoExtraICState) \ |
| 134 V(StoreIC_Megamorphic, STORE_IC, MEGAMORPHIC, \ |
| 135 Code::kNoExtraICState) \ |
| 136 V(StoreIC_GlobalProxy, STORE_IC, MEGAMORPHIC, \ |
| 137 Code::kNoExtraICState) \ |
| 138 V(StoreIC_Initialize_Strict, STORE_IC, UNINITIALIZED, \ |
| 139 kStrictMode) \ |
| 140 V(StoreIC_ArrayLength_Strict, STORE_IC, MONOMORPHIC, \ |
| 141 kStrictMode) \ |
| 142 V(StoreIC_Normal_Strict, STORE_IC, MONOMORPHIC, \ |
| 143 kStrictMode) \ |
| 144 V(StoreIC_Megamorphic_Strict, STORE_IC, MEGAMORPHIC, \ |
| 145 kStrictMode) \ |
| 146 V(StoreIC_GlobalProxy_Strict, STORE_IC, MEGAMORPHIC, \ |
| 147 kStrictMode) \ |
| 148 \ |
| 149 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, \ |
| 150 Code::kNoExtraICState) \ |
| 151 V(KeyedStoreIC_Generic, KEYED_STORE_IC, MEGAMORPHIC, \ |
| 152 Code::kNoExtraICState) \ |
| 153 \ |
| 154 V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \ |
| 155 kStrictMode) \ |
| 156 V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \ |
| 157 kStrictMode) \ |
| 158 \ |
| 159 /* Uses KeyedLoadIC_Initialize; must be after in list. */ \ |
| 160 V(FunctionCall, BUILTIN, UNINITIALIZED, \ |
| 161 Code::kNoExtraICState) \ |
| 162 V(FunctionApply, BUILTIN, UNINITIALIZED, \ |
| 163 Code::kNoExtraICState) \ |
| 164 \ |
| 165 V(ArrayCode, BUILTIN, UNINITIALIZED, \ |
| 166 Code::kNoExtraICState) \ |
| 167 V(ArrayConstructCode, BUILTIN, UNINITIALIZED, \ |
| 168 Code::kNoExtraICState) \ |
| 169 \ |
| 170 V(StringConstructCode, BUILTIN, UNINITIALIZED, \ |
| 171 Code::kNoExtraICState) \ |
| 172 \ |
| 173 V(OnStackReplacement, BUILTIN, UNINITIALIZED, \ |
| 174 Code::kNoExtraICState) |
| 118 | 175 |
| 119 | 176 |
| 120 #ifdef ENABLE_DEBUGGER_SUPPORT | 177 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 121 // Define list of builtins used by the debugger implemented in assembly. | 178 // Define list of builtins used by the debugger implemented in assembly. |
| 122 #define BUILTIN_LIST_DEBUG_A(V) \ | 179 #define BUILTIN_LIST_DEBUG_A(V) \ |
| 123 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 180 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 124 V(ConstructCall_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 181 Code::kNoExtraICState) \ |
| 125 V(StubNoRegisters_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 182 V(ConstructCall_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 126 V(LoadIC_DebugBreak, LOAD_IC, DEBUG_BREAK) \ | 183 Code::kNoExtraICState) \ |
| 127 V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_BREAK) \ | 184 V(StubNoRegisters_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 128 V(StoreIC_DebugBreak, STORE_IC, DEBUG_BREAK) \ | 185 Code::kNoExtraICState) \ |
| 129 V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_BREAK) \ | 186 V(LoadIC_DebugBreak, LOAD_IC, DEBUG_BREAK, \ |
| 130 V(Slot_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 187 Code::kNoExtraICState) \ |
| 131 V(PlainReturn_LiveEdit, BUILTIN, DEBUG_BREAK) \ | 188 V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_BREAK, \ |
| 132 V(FrameDropper_LiveEdit, BUILTIN, DEBUG_BREAK) | 189 Code::kNoExtraICState) \ |
| 190 V(StoreIC_DebugBreak, STORE_IC, DEBUG_BREAK, \ |
| 191 Code::kNoExtraICState) \ |
| 192 V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_BREAK, \ |
| 193 Code::kNoExtraICState) \ |
| 194 V(Slot_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 195 Code::kNoExtraICState) \ |
| 196 V(PlainReturn_LiveEdit, BUILTIN, DEBUG_BREAK, \ |
| 197 Code::kNoExtraICState) \ |
| 198 V(FrameDropper_LiveEdit, BUILTIN, DEBUG_BREAK, \ |
| 199 Code::kNoExtraICState) |
| 133 #else | 200 #else |
| 134 #define BUILTIN_LIST_DEBUG_A(V) | 201 #define BUILTIN_LIST_DEBUG_A(V) |
| 135 #endif | 202 #endif |
| 136 | 203 |
| 137 // Define list of builtins implemented in JavaScript. | 204 // Define list of builtins implemented in JavaScript. |
| 138 #define BUILTINS_LIST_JS(V) \ | 205 #define BUILTINS_LIST_JS(V) \ |
| 139 V(EQUALS, 1) \ | 206 V(EQUALS, 1) \ |
| 140 V(STRICT_EQUALS, 1) \ | 207 V(STRICT_EQUALS, 1) \ |
| 141 V(COMPARE, 2) \ | 208 V(COMPARE, 2) \ |
| 142 V(ADD, 1) \ | 209 V(ADD, 1) \ |
| 143 V(SUB, 1) \ | 210 V(SUB, 1) \ |
| 144 V(MUL, 1) \ | 211 V(MUL, 1) \ |
| 145 V(DIV, 1) \ | 212 V(DIV, 1) \ |
| 146 V(MOD, 1) \ | 213 V(MOD, 1) \ |
| 147 V(BIT_OR, 1) \ | 214 V(BIT_OR, 1) \ |
| 148 V(BIT_AND, 1) \ | 215 V(BIT_AND, 1) \ |
| 149 V(BIT_XOR, 1) \ | 216 V(BIT_XOR, 1) \ |
| 150 V(UNARY_MINUS, 0) \ | 217 V(UNARY_MINUS, 0) \ |
| 151 V(BIT_NOT, 0) \ | 218 V(BIT_NOT, 0) \ |
| 152 V(SHL, 1) \ | 219 V(SHL, 1) \ |
| 153 V(SAR, 1) \ | 220 V(SAR, 1) \ |
| 154 V(SHR, 1) \ | 221 V(SHR, 1) \ |
| 155 V(DELETE, 1) \ | 222 V(DELETE, 2) \ |
| 156 V(IN, 1) \ | 223 V(IN, 1) \ |
| 157 V(INSTANCE_OF, 1) \ | 224 V(INSTANCE_OF, 1) \ |
| 158 V(GET_KEYS, 0) \ | 225 V(GET_KEYS, 0) \ |
| 159 V(FILTER_KEY, 1) \ | 226 V(FILTER_KEY, 1) \ |
| 160 V(CALL_NON_FUNCTION, 0) \ | 227 V(CALL_NON_FUNCTION, 0) \ |
| 161 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \ | 228 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \ |
| 162 V(TO_OBJECT, 0) \ | 229 V(TO_OBJECT, 0) \ |
| 163 V(TO_NUMBER, 0) \ | 230 V(TO_NUMBER, 0) \ |
| 164 V(TO_STRING, 0) \ | 231 V(TO_STRING, 0) \ |
| 165 V(STRING_ADD_LEFT, 1) \ | 232 V(STRING_ADD_LEFT, 1) \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 182 void TearDown(); | 249 void TearDown(); |
| 183 | 250 |
| 184 // Garbage collection support. | 251 // Garbage collection support. |
| 185 void IterateBuiltins(ObjectVisitor* v); | 252 void IterateBuiltins(ObjectVisitor* v); |
| 186 | 253 |
| 187 // Disassembler support. | 254 // Disassembler support. |
| 188 const char* Lookup(byte* pc); | 255 const char* Lookup(byte* pc); |
| 189 | 256 |
| 190 enum Name { | 257 enum Name { |
| 191 #define DEF_ENUM_C(name, ignore) name, | 258 #define DEF_ENUM_C(name, ignore) name, |
| 192 #define DEF_ENUM_A(name, kind, state) name, | 259 #define DEF_ENUM_A(name, kind, state, extra) name, |
| 193 BUILTIN_LIST_C(DEF_ENUM_C) | 260 BUILTIN_LIST_C(DEF_ENUM_C) |
| 194 BUILTIN_LIST_A(DEF_ENUM_A) | 261 BUILTIN_LIST_A(DEF_ENUM_A) |
| 195 BUILTIN_LIST_DEBUG_A(DEF_ENUM_A) | 262 BUILTIN_LIST_DEBUG_A(DEF_ENUM_A) |
| 196 #undef DEF_ENUM_C | 263 #undef DEF_ENUM_C |
| 197 #undef DEF_ENUM_A | 264 #undef DEF_ENUM_A |
| 198 builtin_count | 265 builtin_count |
| 199 }; | 266 }; |
| 200 | 267 |
| 201 enum CFunctionId { | 268 enum CFunctionId { |
| 202 #define DEF_ENUM_C(name, ignore) c_##name, | 269 #define DEF_ENUM_C(name, ignore) c_##name, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 345 |
| 279 friend class BuiltinFunctionTable; | 346 friend class BuiltinFunctionTable; |
| 280 friend class Isolate; | 347 friend class Isolate; |
| 281 | 348 |
| 282 DISALLOW_COPY_AND_ASSIGN(Builtins); | 349 DISALLOW_COPY_AND_ASSIGN(Builtins); |
| 283 }; | 350 }; |
| 284 | 351 |
| 285 } } // namespace v8::internal | 352 } } // namespace v8::internal |
| 286 | 353 |
| 287 #endif // V8_BUILTINS_H_ | 354 #endif // V8_BUILTINS_H_ |
| OLD | NEW |