| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, \ |
| 79 Code::kNoExtraICState) \ |
| 80 V(LazyCompile, BUILTIN, UNINITIALIZED, \ |
| 81 Code::kNoExtraICState) \ |
| 82 V(LazyRecompile, BUILTIN, UNINITIALIZED, \ |
| 83 Code::kNoExtraICState) \ |
| 84 V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, \ |
| 85 Code::kNoExtraICState) \ |
| 86 V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \ |
| 87 Code::kNoExtraICState) \ |
| 88 V(NotifyOSR, BUILTIN, UNINITIALIZED, \ |
| 89 Code::kNoExtraICState) \ |
| 78 \ | 90 \ |
| 79 V(LoadIC_Miss, BUILTIN, UNINITIALIZED) \ | 91 V(LoadIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 80 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED) \ | 92 Code::kNoExtraICState) \ |
| 81 V(StoreIC_Miss, BUILTIN, UNINITIALIZED) \ | 93 V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 82 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED) \ | 94 Code::kNoExtraICState) \ |
| 95 V(StoreIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 96 Code::kNoExtraICState) \ |
| 97 V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, \ |
| 98 Code::kNoExtraICState) \ |
| 83 \ | 99 \ |
| 84 V(LoadIC_Initialize, LOAD_IC, UNINITIALIZED) \ | 100 V(LoadIC_Initialize, LOAD_IC, UNINITIALIZED, \ |
| 85 V(LoadIC_PreMonomorphic, LOAD_IC, PREMONOMORPHIC) \ | 101 Code::kNoExtraICState) \ |
| 86 V(LoadIC_Normal, LOAD_IC, MONOMORPHIC) \ | 102 V(LoadIC_PreMonomorphic, LOAD_IC, PREMONOMORPHIC, \ |
| 87 V(LoadIC_ArrayLength, LOAD_IC, MONOMORPHIC) \ | 103 Code::kNoExtraICState) \ |
| 88 V(LoadIC_StringLength, LOAD_IC, MONOMORPHIC) \ | 104 V(LoadIC_Normal, LOAD_IC, MONOMORPHIC, \ |
| 89 V(LoadIC_FunctionPrototype, LOAD_IC, MONOMORPHIC) \ | 105 Code::kNoExtraICState) \ |
| 90 V(LoadIC_Megamorphic, LOAD_IC, MEGAMORPHIC) \ | 106 V(LoadIC_ArrayLength, LOAD_IC, MONOMORPHIC, \ |
| 107 Code::kNoExtraICState) \ |
| 108 V(LoadIC_StringLength, LOAD_IC, MONOMORPHIC, \ |
| 109 Code::kNoExtraICState) \ |
| 110 V(LoadIC_StringWrapperLength, LOAD_IC, MONOMORPHIC, \ |
| 111 Code::kNoExtraICState) \ |
| 112 V(LoadIC_FunctionPrototype, LOAD_IC, MONOMORPHIC, \ |
| 113 Code::kNoExtraICState) \ |
| 114 V(LoadIC_Megamorphic, LOAD_IC, MEGAMORPHIC, \ |
| 115 Code::kNoExtraICState) \ |
| 91 \ | 116 \ |
| 92 V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED) \ | 117 V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, \ |
| 93 V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC) \ | 118 Code::kNoExtraICState) \ |
| 94 V(KeyedLoadIC_Generic, KEYED_LOAD_IC, MEGAMORPHIC) \ | 119 V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \ |
| 95 V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC) \ | 120 Code::kNoExtraICState) \ |
| 96 V(KeyedLoadIC_ExternalByteArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | 121 V(KeyedLoadIC_Generic, KEYED_LOAD_IC, MEGAMORPHIC, \ |
| 97 V(KeyedLoadIC_ExternalUnsignedByteArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | 122 Code::kNoExtraICState) \ |
| 98 V(KeyedLoadIC_ExternalShortArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | 123 V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, \ |
| 99 V(KeyedLoadIC_ExternalUnsignedShortArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | 124 Code::kNoExtraICState) \ |
| 100 V(KeyedLoadIC_ExternalIntArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | 125 V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MEGAMORPHIC, \ |
| 101 V(KeyedLoadIC_ExternalUnsignedIntArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | 126 Code::kNoExtraICState) \ |
| 102 V(KeyedLoadIC_ExternalFloatArray, KEYED_LOAD_IC, MEGAMORPHIC) \ | |
| 103 V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MEGAMORPHIC) \ | |
| 104 \ | 127 \ |
| 105 V(StoreIC_Initialize, STORE_IC, UNINITIALIZED) \ | 128 V(StoreIC_Initialize, STORE_IC, UNINITIALIZED, \ |
| 106 V(StoreIC_ArrayLength, STORE_IC, MONOMORPHIC) \ | 129 Code::kNoExtraICState) \ |
| 107 V(StoreIC_Normal, STORE_IC, MONOMORPHIC) \ | 130 V(StoreIC_ArrayLength, STORE_IC, MONOMORPHIC, \ |
| 108 V(StoreIC_Megamorphic, STORE_IC, MEGAMORPHIC) \ | 131 Code::kNoExtraICState) \ |
| 109 V(StoreIC_GlobalProxy, STORE_IC, MEGAMORPHIC) \ | 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 StoreIC::kStoreICStrict) \ |
| 140 V(StoreIC_ArrayLength_Strict, STORE_IC, MONOMORPHIC, \ |
| 141 StoreIC::kStoreICStrict) \ |
| 142 V(StoreIC_Normal_Strict, STORE_IC, MONOMORPHIC, \ |
| 143 StoreIC::kStoreICStrict) \ |
| 144 V(StoreIC_Megamorphic_Strict, STORE_IC, MEGAMORPHIC, \ |
| 145 StoreIC::kStoreICStrict) \ |
| 146 V(StoreIC_GlobalProxy_Strict, STORE_IC, MEGAMORPHIC, \ |
| 147 StoreIC::kStoreICStrict) \ |
| 110 \ | 148 \ |
| 111 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED) \ | 149 V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, \ |
| 112 V(KeyedStoreIC_Generic, KEYED_STORE_IC, MEGAMORPHIC) \ | 150 Code::kNoExtraICState) \ |
| 113 V(KeyedStoreIC_ExternalByteArray, KEYED_STORE_IC, MEGAMORPHIC) \ | 151 V(KeyedStoreIC_Generic, KEYED_STORE_IC, MEGAMORPHIC, \ |
| 114 V(KeyedStoreIC_ExternalUnsignedByteArray, KEYED_STORE_IC, MEGAMORPHIC) \ | 152 Code::kNoExtraICState) \ |
| 115 V(KeyedStoreIC_ExternalShortArray, KEYED_STORE_IC, MEGAMORPHIC) \ | |
| 116 V(KeyedStoreIC_ExternalUnsignedShortArray, KEYED_STORE_IC, MEGAMORPHIC) \ | |
| 117 V(KeyedStoreIC_ExternalIntArray, KEYED_STORE_IC, MEGAMORPHIC) \ | |
| 118 V(KeyedStoreIC_ExternalUnsignedIntArray, KEYED_STORE_IC, MEGAMORPHIC) \ | |
| 119 V(KeyedStoreIC_ExternalFloatArray, KEYED_STORE_IC, MEGAMORPHIC) \ | |
| 120 \ | 153 \ |
| 121 /* Uses KeyedLoadIC_Initialize; must be after in list. */ \ | 154 /* Uses KeyedLoadIC_Initialize; must be after in list. */ \ |
| 122 V(FunctionCall, BUILTIN, UNINITIALIZED) \ | 155 V(FunctionCall, BUILTIN, UNINITIALIZED, \ |
| 123 V(FunctionApply, BUILTIN, UNINITIALIZED) \ | 156 Code::kNoExtraICState) \ |
| 157 V(FunctionApply, BUILTIN, UNINITIALIZED, \ |
| 158 Code::kNoExtraICState) \ |
| 124 \ | 159 \ |
| 125 V(ArrayCode, BUILTIN, UNINITIALIZED) \ | 160 V(ArrayCode, BUILTIN, UNINITIALIZED, \ |
| 126 V(ArrayConstructCode, BUILTIN, UNINITIALIZED) \ | 161 Code::kNoExtraICState) \ |
| 162 V(ArrayConstructCode, BUILTIN, UNINITIALIZED, \ |
| 163 Code::kNoExtraICState) \ |
| 127 \ | 164 \ |
| 128 V(StringConstructCode, BUILTIN, UNINITIALIZED) \ | 165 V(StringConstructCode, BUILTIN, UNINITIALIZED, \ |
| 166 Code::kNoExtraICState) \ |
| 129 \ | 167 \ |
| 130 V(OnStackReplacement, BUILTIN, UNINITIALIZED) | 168 V(OnStackReplacement, BUILTIN, UNINITIALIZED, \ |
| 169 Code::kNoExtraICState) |
| 131 | 170 |
| 132 | 171 |
| 133 #ifdef ENABLE_DEBUGGER_SUPPORT | 172 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 134 // Define list of builtins used by the debugger implemented in assembly. | 173 // Define list of builtins used by the debugger implemented in assembly. |
| 135 #define BUILTIN_LIST_DEBUG_A(V) \ | 174 #define BUILTIN_LIST_DEBUG_A(V) \ |
| 136 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 175 V(Return_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 137 V(ConstructCall_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 176 Code::kNoExtraICState) \ |
| 138 V(StubNoRegisters_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 177 V(ConstructCall_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 139 V(LoadIC_DebugBreak, LOAD_IC, DEBUG_BREAK) \ | 178 Code::kNoExtraICState) \ |
| 140 V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_BREAK) \ | 179 V(StubNoRegisters_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 141 V(StoreIC_DebugBreak, STORE_IC, DEBUG_BREAK) \ | 180 Code::kNoExtraICState) \ |
| 142 V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_BREAK) \ | 181 V(LoadIC_DebugBreak, LOAD_IC, DEBUG_BREAK, \ |
| 143 V(Slot_DebugBreak, BUILTIN, DEBUG_BREAK) \ | 182 Code::kNoExtraICState) \ |
| 144 V(PlainReturn_LiveEdit, BUILTIN, DEBUG_BREAK) \ | 183 V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_BREAK, \ |
| 145 V(FrameDropper_LiveEdit, BUILTIN, DEBUG_BREAK) | 184 Code::kNoExtraICState) \ |
| 185 V(StoreIC_DebugBreak, STORE_IC, DEBUG_BREAK, \ |
| 186 Code::kNoExtraICState) \ |
| 187 V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_BREAK, \ |
| 188 Code::kNoExtraICState) \ |
| 189 V(Slot_DebugBreak, BUILTIN, DEBUG_BREAK, \ |
| 190 Code::kNoExtraICState) \ |
| 191 V(PlainReturn_LiveEdit, BUILTIN, DEBUG_BREAK, \ |
| 192 Code::kNoExtraICState) \ |
| 193 V(FrameDropper_LiveEdit, BUILTIN, DEBUG_BREAK, \ |
| 194 Code::kNoExtraICState) |
| 146 #else | 195 #else |
| 147 #define BUILTIN_LIST_DEBUG_A(V) | 196 #define BUILTIN_LIST_DEBUG_A(V) |
| 148 #endif | 197 #endif |
| 149 | 198 |
| 150 // Define list of builtins implemented in JavaScript. | 199 // Define list of builtins implemented in JavaScript. |
| 151 #define BUILTINS_LIST_JS(V) \ | 200 #define BUILTINS_LIST_JS(V) \ |
| 152 V(EQUALS, 1) \ | 201 V(EQUALS, 1) \ |
| 153 V(STRICT_EQUALS, 1) \ | 202 V(STRICT_EQUALS, 1) \ |
| 154 V(COMPARE, 2) \ | 203 V(COMPARE, 2) \ |
| 155 V(ADD, 1) \ | 204 V(ADD, 1) \ |
| 156 V(SUB, 1) \ | 205 V(SUB, 1) \ |
| 157 V(MUL, 1) \ | 206 V(MUL, 1) \ |
| 158 V(DIV, 1) \ | 207 V(DIV, 1) \ |
| 159 V(MOD, 1) \ | 208 V(MOD, 1) \ |
| 160 V(BIT_OR, 1) \ | 209 V(BIT_OR, 1) \ |
| 161 V(BIT_AND, 1) \ | 210 V(BIT_AND, 1) \ |
| 162 V(BIT_XOR, 1) \ | 211 V(BIT_XOR, 1) \ |
| 163 V(UNARY_MINUS, 0) \ | 212 V(UNARY_MINUS, 0) \ |
| 164 V(BIT_NOT, 0) \ | 213 V(BIT_NOT, 0) \ |
| 165 V(SHL, 1) \ | 214 V(SHL, 1) \ |
| 166 V(SAR, 1) \ | 215 V(SAR, 1) \ |
| 167 V(SHR, 1) \ | 216 V(SHR, 1) \ |
| 168 V(DELETE, 1) \ | 217 V(DELETE, 2) \ |
| 169 V(IN, 1) \ | 218 V(IN, 1) \ |
| 170 V(INSTANCE_OF, 1) \ | 219 V(INSTANCE_OF, 1) \ |
| 171 V(GET_KEYS, 0) \ | 220 V(GET_KEYS, 0) \ |
| 172 V(FILTER_KEY, 1) \ | 221 V(FILTER_KEY, 1) \ |
| 173 V(CALL_NON_FUNCTION, 0) \ | 222 V(CALL_NON_FUNCTION, 0) \ |
| 174 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \ | 223 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR, 0) \ |
| 175 V(TO_OBJECT, 0) \ | 224 V(TO_OBJECT, 0) \ |
| 176 V(TO_NUMBER, 0) \ | 225 V(TO_NUMBER, 0) \ |
| 177 V(TO_STRING, 0) \ | 226 V(TO_STRING, 0) \ |
| 178 V(STRING_ADD_LEFT, 1) \ | 227 V(STRING_ADD_LEFT, 1) \ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 192 static void TearDown(); | 241 static void TearDown(); |
| 193 | 242 |
| 194 // Garbage collection support. | 243 // Garbage collection support. |
| 195 static void IterateBuiltins(ObjectVisitor* v); | 244 static void IterateBuiltins(ObjectVisitor* v); |
| 196 | 245 |
| 197 // Disassembler support. | 246 // Disassembler support. |
| 198 static const char* Lookup(byte* pc); | 247 static const char* Lookup(byte* pc); |
| 199 | 248 |
| 200 enum Name { | 249 enum Name { |
| 201 #define DEF_ENUM_C(name, ignore) name, | 250 #define DEF_ENUM_C(name, ignore) name, |
| 202 #define DEF_ENUM_A(name, kind, state) name, | 251 #define DEF_ENUM_A(name, kind, state, extra) name, |
| 203 BUILTIN_LIST_C(DEF_ENUM_C) | 252 BUILTIN_LIST_C(DEF_ENUM_C) |
| 204 BUILTIN_LIST_A(DEF_ENUM_A) | 253 BUILTIN_LIST_A(DEF_ENUM_A) |
| 205 BUILTIN_LIST_DEBUG_A(DEF_ENUM_A) | 254 BUILTIN_LIST_DEBUG_A(DEF_ENUM_A) |
| 206 #undef DEF_ENUM_C | 255 #undef DEF_ENUM_C |
| 207 #undef DEF_ENUM_A | 256 #undef DEF_ENUM_A |
| 208 builtin_count | 257 builtin_count |
| 209 }; | 258 }; |
| 210 | 259 |
| 211 enum CFunctionId { | 260 enum CFunctionId { |
| 212 #define DEF_ENUM_C(name, ignore) c_##name, | 261 #define DEF_ENUM_C(name, ignore) c_##name, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 static void Generate_ArrayConstructCode(MacroAssembler* masm); | 325 static void Generate_ArrayConstructCode(MacroAssembler* masm); |
| 277 | 326 |
| 278 static void Generate_StringConstructCode(MacroAssembler* masm); | 327 static void Generate_StringConstructCode(MacroAssembler* masm); |
| 279 | 328 |
| 280 static void Generate_OnStackReplacement(MacroAssembler* masm); | 329 static void Generate_OnStackReplacement(MacroAssembler* masm); |
| 281 }; | 330 }; |
| 282 | 331 |
| 283 } } // namespace v8::internal | 332 } } // namespace v8::internal |
| 284 | 333 |
| 285 #endif // V8_BUILTINS_H_ | 334 #endif // V8_BUILTINS_H_ |
| OLD | NEW |