| OLD | NEW |
| (Empty) |
| 1 | |
| 2 // Copyright 2011 the V8 project authors. All rights reserved. | |
| 3 // Use of this source code is governed by a BSD-style license that can be | |
| 4 // found in the LICENSE file. | |
| 5 | |
| 6 #ifndef V8_BUILTINS_H_ | |
| 7 #define V8_BUILTINS_H_ | |
| 8 | |
| 9 #include "src/base/flags.h" | |
| 10 #include "src/handles.h" | |
| 11 | |
| 12 namespace v8 { | |
| 13 namespace internal { | |
| 14 | |
| 15 // Forward declarations. | |
| 16 class CodeStubAssembler; | |
| 17 | |
| 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(ToBeExecutedOnce) \ | |
| 32 V(NotExecuted) \ | |
| 33 V(ExecutedOnce) \ | |
| 34 V(NoAge) \ | |
| 35 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V) | |
| 36 | |
| 37 #define DECLARE_CODE_AGE_BUILTIN(C, V) \ | |
| 38 V(Make##C##CodeYoungAgainOddMarking, BUILTIN, kNoExtraICState) \ | |
| 39 V(Make##C##CodeYoungAgainEvenMarking, BUILTIN, kNoExtraICState) | |
| 40 | |
| 41 // Define list of builtins implemented in C++. | |
| 42 #define BUILTIN_LIST_C(V) \ | |
| 43 V(Illegal, BUILTIN_EXIT) \ | |
| 44 \ | |
| 45 V(EmptyFunction, BUILTIN_EXIT) \ | |
| 46 \ | |
| 47 V(ArrayConcat, BUILTIN_EXIT) \ | |
| 48 V(ArrayPop, BUILTIN_EXIT) \ | |
| 49 V(ArrayPush, BUILTIN_EXIT) \ | |
| 50 V(ArrayShift, BUILTIN_EXIT) \ | |
| 51 V(ArraySlice, BUILTIN_EXIT) \ | |
| 52 V(ArraySplice, BUILTIN_EXIT) \ | |
| 53 V(ArrayUnshift, BUILTIN_EXIT) \ | |
| 54 \ | |
| 55 V(ArrayBufferConstructor, BUILTIN_EXIT) \ | |
| 56 V(ArrayBufferConstructor_ConstructStub, BUILTIN_EXIT) \ | |
| 57 V(ArrayBufferPrototypeGetByteLength, BUILTIN_EXIT) \ | |
| 58 V(ArrayBufferIsView, BUILTIN_EXIT) \ | |
| 59 \ | |
| 60 V(BooleanConstructor, BUILTIN_EXIT) \ | |
| 61 V(BooleanConstructor_ConstructStub, BUILTIN_EXIT) \ | |
| 62 \ | |
| 63 V(DataViewConstructor, BUILTIN_EXIT) \ | |
| 64 V(DataViewConstructor_ConstructStub, BUILTIN_EXIT) \ | |
| 65 V(DataViewPrototypeGetBuffer, BUILTIN_EXIT) \ | |
| 66 V(DataViewPrototypeGetByteLength, BUILTIN_EXIT) \ | |
| 67 V(DataViewPrototypeGetByteOffset, BUILTIN_EXIT) \ | |
| 68 \ | |
| 69 V(DateConstructor, BUILTIN_EXIT) \ | |
| 70 V(DateConstructor_ConstructStub, BUILTIN_EXIT) \ | |
| 71 V(DateNow, BUILTIN_EXIT) \ | |
| 72 V(DateParse, BUILTIN_EXIT) \ | |
| 73 V(DateUTC, BUILTIN_EXIT) \ | |
| 74 V(DatePrototypeSetDate, BUILTIN_EXIT) \ | |
| 75 V(DatePrototypeSetFullYear, BUILTIN_EXIT) \ | |
| 76 V(DatePrototypeSetHours, BUILTIN_EXIT) \ | |
| 77 V(DatePrototypeSetMilliseconds, BUILTIN_EXIT) \ | |
| 78 V(DatePrototypeSetMinutes, BUILTIN_EXIT) \ | |
| 79 V(DatePrototypeSetMonth, BUILTIN_EXIT) \ | |
| 80 V(DatePrototypeSetSeconds, BUILTIN_EXIT) \ | |
| 81 V(DatePrototypeSetTime, BUILTIN_EXIT) \ | |
| 82 V(DatePrototypeSetUTCDate, BUILTIN_EXIT) \ | |
| 83 V(DatePrototypeSetUTCFullYear, BUILTIN_EXIT) \ | |
| 84 V(DatePrototypeSetUTCHours, BUILTIN_EXIT) \ | |
| 85 V(DatePrototypeSetUTCMilliseconds, BUILTIN_EXIT) \ | |
| 86 V(DatePrototypeSetUTCMinutes, BUILTIN_EXIT) \ | |
| 87 V(DatePrototypeSetUTCMonth, BUILTIN_EXIT) \ | |
| 88 V(DatePrototypeSetUTCSeconds, BUILTIN_EXIT) \ | |
| 89 V(DatePrototypeToDateString, BUILTIN_EXIT) \ | |
| 90 V(DatePrototypeToISOString, BUILTIN_EXIT) \ | |
| 91 V(DatePrototypeToPrimitive, BUILTIN_EXIT) \ | |
| 92 V(DatePrototypeToUTCString, BUILTIN_EXIT) \ | |
| 93 V(DatePrototypeToString, BUILTIN_EXIT) \ | |
| 94 V(DatePrototypeToTimeString, BUILTIN_EXIT) \ | |
| 95 V(DatePrototypeValueOf, BUILTIN_EXIT) \ | |
| 96 V(DatePrototypeGetYear, BUILTIN_EXIT) \ | |
| 97 V(DatePrototypeSetYear, BUILTIN_EXIT) \ | |
| 98 V(DatePrototypeToJson, BUILTIN_EXIT) \ | |
| 99 \ | |
| 100 V(FunctionConstructor, BUILTIN_EXIT) \ | |
| 101 V(FunctionPrototypeBind, BUILTIN_EXIT) \ | |
| 102 V(FunctionPrototypeToString, BUILTIN_EXIT) \ | |
| 103 \ | |
| 104 V(GeneratorFunctionConstructor, BUILTIN_EXIT) \ | |
| 105 V(AsyncFunctionConstructor, BUILTIN_EXIT) \ | |
| 106 \ | |
| 107 V(GlobalDecodeURI, BUILTIN_EXIT) \ | |
| 108 V(GlobalDecodeURIComponent, BUILTIN_EXIT) \ | |
| 109 V(GlobalEncodeURI, BUILTIN_EXIT) \ | |
| 110 V(GlobalEncodeURIComponent, BUILTIN_EXIT) \ | |
| 111 V(GlobalEscape, BUILTIN_EXIT) \ | |
| 112 V(GlobalUnescape, BUILTIN_EXIT) \ | |
| 113 \ | |
| 114 V(GlobalEval, BUILTIN_EXIT) \ | |
| 115 \ | |
| 116 V(JsonParse, BUILTIN_EXIT) \ | |
| 117 V(JsonStringify, BUILTIN_EXIT) \ | |
| 118 \ | |
| 119 V(MathHypot, BUILTIN_EXIT) \ | |
| 120 \ | |
| 121 V(NumberPrototypeToExponential, BUILTIN_EXIT) \ | |
| 122 V(NumberPrototypeToFixed, BUILTIN_EXIT) \ | |
| 123 V(NumberPrototypeToLocaleString, BUILTIN_EXIT) \ | |
| 124 V(NumberPrototypeToPrecision, BUILTIN_EXIT) \ | |
| 125 V(NumberPrototypeToString, BUILTIN_EXIT) \ | |
| 126 \ | |
| 127 V(ObjectAssign, BUILTIN_EXIT) \ | |
| 128 V(ObjectCreate, BUILTIN_EXIT) \ | |
| 129 V(ObjectDefineGetter, BUILTIN_EXIT) \ | |
| 130 V(ObjectDefineProperties, BUILTIN_EXIT) \ | |
| 131 V(ObjectDefineProperty, BUILTIN_EXIT) \ | |
| 132 V(ObjectDefineSetter, BUILTIN_EXIT) \ | |
| 133 V(ObjectEntries, BUILTIN_EXIT) \ | |
| 134 V(ObjectFreeze, BUILTIN_EXIT) \ | |
| 135 V(ObjectGetOwnPropertyDescriptor, BUILTIN_EXIT) \ | |
| 136 V(ObjectGetOwnPropertyDescriptors, BUILTIN_EXIT) \ | |
| 137 V(ObjectGetOwnPropertyNames, BUILTIN_EXIT) \ | |
| 138 V(ObjectGetOwnPropertySymbols, BUILTIN_EXIT) \ | |
| 139 V(ObjectGetPrototypeOf, BUILTIN_EXIT) \ | |
| 140 V(ObjectIs, BUILTIN_EXIT) \ | |
| 141 V(ObjectIsExtensible, BUILTIN_EXIT) \ | |
| 142 V(ObjectIsFrozen, BUILTIN_EXIT) \ | |
| 143 V(ObjectIsSealed, BUILTIN_EXIT) \ | |
| 144 V(ObjectKeys, BUILTIN_EXIT) \ | |
| 145 V(ObjectLookupGetter, BUILTIN_EXIT) \ | |
| 146 V(ObjectLookupSetter, BUILTIN_EXIT) \ | |
| 147 V(ObjectPreventExtensions, BUILTIN_EXIT) \ | |
| 148 V(ObjectPrototypePropertyIsEnumerable, BUILTIN_EXIT) \ | |
| 149 V(ObjectProtoToString, BUILTIN_EXIT) \ | |
| 150 V(ObjectSeal, BUILTIN_EXIT) \ | |
| 151 V(ObjectValues, BUILTIN_EXIT) \ | |
| 152 \ | |
| 153 V(ProxyConstructor, BUILTIN_EXIT) \ | |
| 154 V(ProxyConstructor_ConstructStub, BUILTIN_EXIT) \ | |
| 155 \ | |
| 156 V(ReflectDefineProperty, BUILTIN_EXIT) \ | |
| 157 V(ReflectDeleteProperty, BUILTIN_EXIT) \ | |
| 158 V(ReflectGet, BUILTIN_EXIT) \ | |
| 159 V(ReflectGetOwnPropertyDescriptor, BUILTIN_EXIT) \ | |
| 160 V(ReflectGetPrototypeOf, BUILTIN_EXIT) \ | |
| 161 V(ReflectHas, BUILTIN_EXIT) \ | |
| 162 V(ReflectIsExtensible, BUILTIN_EXIT) \ | |
| 163 V(ReflectOwnKeys, BUILTIN_EXIT) \ | |
| 164 V(ReflectPreventExtensions, BUILTIN_EXIT) \ | |
| 165 V(ReflectSet, BUILTIN_EXIT) \ | |
| 166 V(ReflectSetPrototypeOf, BUILTIN_EXIT) \ | |
| 167 \ | |
| 168 V(SharedArrayBufferPrototypeGetByteLength, BUILTIN_EXIT) \ | |
| 169 \ | |
| 170 V(StringFromCodePoint, BUILTIN_EXIT) \ | |
| 171 \ | |
| 172 V(StringPrototypeTrim, BUILTIN_EXIT) \ | |
| 173 V(StringPrototypeTrimLeft, BUILTIN_EXIT) \ | |
| 174 V(StringPrototypeTrimRight, BUILTIN_EXIT) \ | |
| 175 \ | |
| 176 V(SymbolConstructor, BUILTIN_EXIT) \ | |
| 177 V(SymbolConstructor_ConstructStub, BUILTIN_EXIT) \ | |
| 178 \ | |
| 179 V(TypedArrayPrototypeBuffer, BUILTIN_EXIT) \ | |
| 180 \ | |
| 181 V(HandleApiCall, EXIT) \ | |
| 182 V(HandleApiCallAsFunction, EXIT) \ | |
| 183 V(HandleApiCallAsConstructor, EXIT) \ | |
| 184 \ | |
| 185 V(RestrictedFunctionPropertiesThrower, BUILTIN_EXIT) \ | |
| 186 V(RestrictedStrictArgumentsPropertiesThrower, BUILTIN_EXIT) | |
| 187 | |
| 188 // Define list of builtins implemented in assembly. | |
| 189 #define BUILTIN_LIST_A(V) \ | |
| 190 V(AllocateInNewSpace, BUILTIN, kNoExtraICState) \ | |
| 191 V(AllocateInOldSpace, BUILTIN, kNoExtraICState) \ | |
| 192 \ | |
| 193 V(ArgumentsAdaptorTrampoline, BUILTIN, kNoExtraICState) \ | |
| 194 \ | |
| 195 V(ConstructedNonConstructable, BUILTIN, kNoExtraICState) \ | |
| 196 \ | |
| 197 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 198 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 199 V(CallFunction_ReceiverIsAny, BUILTIN, kNoExtraICState) \ | |
| 200 V(TailCallFunction_ReceiverIsNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 201 V(TailCallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 202 V(TailCallFunction_ReceiverIsAny, BUILTIN, kNoExtraICState) \ | |
| 203 V(CallBoundFunction, BUILTIN, kNoExtraICState) \ | |
| 204 V(TailCallBoundFunction, BUILTIN, kNoExtraICState) \ | |
| 205 V(Call_ReceiverIsNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 206 V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 207 V(Call_ReceiverIsAny, BUILTIN, kNoExtraICState) \ | |
| 208 V(TailCall_ReceiverIsNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 209 V(TailCall_ReceiverIsNotNullOrUndefined, BUILTIN, kNoExtraICState) \ | |
| 210 V(TailCall_ReceiverIsAny, BUILTIN, kNoExtraICState) \ | |
| 211 \ | |
| 212 V(ConstructFunction, BUILTIN, kNoExtraICState) \ | |
| 213 V(ConstructBoundFunction, BUILTIN, kNoExtraICState) \ | |
| 214 V(ConstructProxy, BUILTIN, kNoExtraICState) \ | |
| 215 V(Construct, BUILTIN, kNoExtraICState) \ | |
| 216 \ | |
| 217 V(StringToNumber, BUILTIN, kNoExtraICState) \ | |
| 218 V(NonNumberToNumber, BUILTIN, kNoExtraICState) \ | |
| 219 V(ToNumber, BUILTIN, kNoExtraICState) \ | |
| 220 \ | |
| 221 V(Apply, BUILTIN, kNoExtraICState) \ | |
| 222 \ | |
| 223 V(HandleFastApiCall, BUILTIN, kNoExtraICState) \ | |
| 224 \ | |
| 225 V(InOptimizationQueue, BUILTIN, kNoExtraICState) \ | |
| 226 V(JSConstructStubGeneric, BUILTIN, kNoExtraICState) \ | |
| 227 V(JSBuiltinsConstructStub, BUILTIN, kNoExtraICState) \ | |
| 228 V(JSBuiltinsConstructStubForDerived, BUILTIN, kNoExtraICState) \ | |
| 229 V(JSConstructStubApi, BUILTIN, kNoExtraICState) \ | |
| 230 V(JSEntryTrampoline, BUILTIN, kNoExtraICState) \ | |
| 231 V(JSConstructEntryTrampoline, BUILTIN, kNoExtraICState) \ | |
| 232 V(ResumeGeneratorTrampoline, BUILTIN, kNoExtraICState) \ | |
| 233 V(InstantiateAsmJs, BUILTIN, kNoExtraICState) \ | |
| 234 V(CompileLazy, BUILTIN, kNoExtraICState) \ | |
| 235 V(CompileBaseline, BUILTIN, kNoExtraICState) \ | |
| 236 V(CompileOptimized, BUILTIN, kNoExtraICState) \ | |
| 237 V(CompileOptimizedConcurrent, BUILTIN, kNoExtraICState) \ | |
| 238 V(NotifyDeoptimized, BUILTIN, kNoExtraICState) \ | |
| 239 V(NotifySoftDeoptimized, BUILTIN, kNoExtraICState) \ | |
| 240 V(NotifyLazyDeoptimized, BUILTIN, kNoExtraICState) \ | |
| 241 V(NotifyStubFailure, BUILTIN, kNoExtraICState) \ | |
| 242 V(NotifyStubFailureSaveDoubles, BUILTIN, kNoExtraICState) \ | |
| 243 \ | |
| 244 V(InterpreterEntryTrampoline, BUILTIN, kNoExtraICState) \ | |
| 245 V(InterpreterMarkBaselineOnReturn, BUILTIN, kNoExtraICState) \ | |
| 246 V(InterpreterPushArgsAndCallFunction, BUILTIN, kNoExtraICState) \ | |
| 247 V(InterpreterPushArgsAndTailCallFunction, BUILTIN, kNoExtraICState) \ | |
| 248 V(InterpreterPushArgsAndCall, BUILTIN, kNoExtraICState) \ | |
| 249 V(InterpreterPushArgsAndTailCall, BUILTIN, kNoExtraICState) \ | |
| 250 V(InterpreterPushArgsAndConstruct, BUILTIN, kNoExtraICState) \ | |
| 251 V(InterpreterEnterBytecodeDispatch, BUILTIN, kNoExtraICState) \ | |
| 252 \ | |
| 253 V(KeyedLoadIC_Miss, BUILTIN, kNoExtraICState) \ | |
| 254 V(KeyedStoreIC_Miss, BUILTIN, kNoExtraICState) \ | |
| 255 V(LoadIC_Getter_ForDeopt, LOAD_IC, kNoExtraICState) \ | |
| 256 V(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, kNoExtraICState) \ | |
| 257 \ | |
| 258 V(StoreIC_Setter_ForDeopt, STORE_IC, StoreICState::kStrictModeState) \ | |
| 259 \ | |
| 260 V(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, kNoExtraICState) \ | |
| 261 V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, \ | |
| 262 StoreICState::kStrictModeState) \ | |
| 263 \ | |
| 264 V(DatePrototypeGetDate, BUILTIN, kNoExtraICState) \ | |
| 265 V(DatePrototypeGetDay, BUILTIN, kNoExtraICState) \ | |
| 266 V(DatePrototypeGetFullYear, BUILTIN, kNoExtraICState) \ | |
| 267 V(DatePrototypeGetHours, BUILTIN, kNoExtraICState) \ | |
| 268 V(DatePrototypeGetMilliseconds, BUILTIN, kNoExtraICState) \ | |
| 269 V(DatePrototypeGetMinutes, BUILTIN, kNoExtraICState) \ | |
| 270 V(DatePrototypeGetMonth, BUILTIN, kNoExtraICState) \ | |
| 271 V(DatePrototypeGetSeconds, BUILTIN, kNoExtraICState) \ | |
| 272 V(DatePrototypeGetTime, BUILTIN, kNoExtraICState) \ | |
| 273 V(DatePrototypeGetTimezoneOffset, BUILTIN, kNoExtraICState) \ | |
| 274 V(DatePrototypeGetUTCDate, BUILTIN, kNoExtraICState) \ | |
| 275 V(DatePrototypeGetUTCDay, BUILTIN, kNoExtraICState) \ | |
| 276 V(DatePrototypeGetUTCFullYear, BUILTIN, kNoExtraICState) \ | |
| 277 V(DatePrototypeGetUTCHours, BUILTIN, kNoExtraICState) \ | |
| 278 V(DatePrototypeGetUTCMilliseconds, BUILTIN, kNoExtraICState) \ | |
| 279 V(DatePrototypeGetUTCMinutes, BUILTIN, kNoExtraICState) \ | |
| 280 V(DatePrototypeGetUTCMonth, BUILTIN, kNoExtraICState) \ | |
| 281 V(DatePrototypeGetUTCSeconds, BUILTIN, kNoExtraICState) \ | |
| 282 \ | |
| 283 V(FunctionPrototypeApply, BUILTIN, kNoExtraICState) \ | |
| 284 V(FunctionPrototypeCall, BUILTIN, kNoExtraICState) \ | |
| 285 \ | |
| 286 V(ReflectApply, BUILTIN, kNoExtraICState) \ | |
| 287 V(ReflectConstruct, BUILTIN, kNoExtraICState) \ | |
| 288 \ | |
| 289 V(InternalArrayCode, BUILTIN, kNoExtraICState) \ | |
| 290 V(ArrayCode, BUILTIN, kNoExtraICState) \ | |
| 291 \ | |
| 292 V(MathMax, BUILTIN, kNoExtraICState) \ | |
| 293 V(MathMin, BUILTIN, kNoExtraICState) \ | |
| 294 \ | |
| 295 V(NumberConstructor, BUILTIN, kNoExtraICState) \ | |
| 296 V(NumberConstructor_ConstructStub, BUILTIN, kNoExtraICState) \ | |
| 297 \ | |
| 298 V(StringConstructor, BUILTIN, kNoExtraICState) \ | |
| 299 V(StringConstructor_ConstructStub, BUILTIN, kNoExtraICState) \ | |
| 300 \ | |
| 301 V(OnStackReplacement, BUILTIN, kNoExtraICState) \ | |
| 302 V(InterruptCheck, BUILTIN, kNoExtraICState) \ | |
| 303 V(StackCheck, BUILTIN, kNoExtraICState) \ | |
| 304 \ | |
| 305 V(MarkCodeAsToBeExecutedOnce, BUILTIN, kNoExtraICState) \ | |
| 306 V(MarkCodeAsExecutedOnce, BUILTIN, kNoExtraICState) \ | |
| 307 V(MarkCodeAsExecutedTwice, BUILTIN, kNoExtraICState) \ | |
| 308 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) | |
| 309 | |
| 310 // Define list of builtins implemented in TurboFan (with JS linkage). | |
| 311 #define BUILTIN_LIST_T(V) \ | |
| 312 V(BooleanPrototypeToString, 1) \ | |
| 313 V(BooleanPrototypeValueOf, 1) \ | |
| 314 V(FunctionPrototypeHasInstance, 2) \ | |
| 315 V(GeneratorPrototypeNext, 2) \ | |
| 316 V(GeneratorPrototypeReturn, 2) \ | |
| 317 V(GeneratorPrototypeThrow, 2) \ | |
| 318 V(MathAcos, 2) \ | |
| 319 V(MathAcosh, 2) \ | |
| 320 V(MathAsin, 2) \ | |
| 321 V(MathAsinh, 2) \ | |
| 322 V(MathAtan, 2) \ | |
| 323 V(MathAtanh, 2) \ | |
| 324 V(MathAtan2, 3) \ | |
| 325 V(MathCeil, 2) \ | |
| 326 V(MathCbrt, 2) \ | |
| 327 V(MathAbs, 2) \ | |
| 328 V(MathExpm1, 2) \ | |
| 329 V(MathClz32, 2) \ | |
| 330 V(MathCos, 2) \ | |
| 331 V(MathCosh, 2) \ | |
| 332 V(MathExp, 2) \ | |
| 333 V(MathFloor, 2) \ | |
| 334 V(MathFround, 2) \ | |
| 335 V(MathImul, 3) \ | |
| 336 V(MathLog, 2) \ | |
| 337 V(MathLog1p, 2) \ | |
| 338 V(MathLog10, 2) \ | |
| 339 V(MathLog2, 2) \ | |
| 340 V(MathRound, 2) \ | |
| 341 V(MathPow, 3) \ | |
| 342 V(MathSign, 2) \ | |
| 343 V(MathSin, 2) \ | |
| 344 V(MathSinh, 2) \ | |
| 345 V(MathTan, 2) \ | |
| 346 V(MathTanh, 2) \ | |
| 347 V(MathSqrt, 2) \ | |
| 348 V(MathTrunc, 2) \ | |
| 349 V(NumberPrototypeValueOf, 1) \ | |
| 350 V(ObjectHasOwnProperty, 2) \ | |
| 351 V(ArrayIsArray, 2) \ | |
| 352 V(StringFromCharCode, 2) \ | |
| 353 V(StringPrototypeCharAt, 2) \ | |
| 354 V(StringPrototypeCharCodeAt, 2) \ | |
| 355 V(StringPrototypeToString, 1) \ | |
| 356 V(StringPrototypeValueOf, 1) \ | |
| 357 V(SymbolPrototypeToPrimitive, 2) \ | |
| 358 V(SymbolPrototypeToString, 1) \ | |
| 359 V(SymbolPrototypeValueOf, 1) \ | |
| 360 V(TypedArrayPrototypeByteLength, 1) \ | |
| 361 V(TypedArrayPrototypeByteOffset, 1) \ | |
| 362 V(TypedArrayPrototypeLength, 1) \ | |
| 363 V(AtomicsLoad, 3) \ | |
| 364 V(AtomicsStore, 4) | |
| 365 | |
| 366 // Define list of builtins implemented in TurboFan (with CallStub linkage). | |
| 367 #define BUILTIN_LIST_S(V) \ | |
| 368 V(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector) \ | |
| 369 V(LoadGlobalIC_SlowNotInsideTypeof, HANDLER, Code::LOAD_GLOBAL_IC, \ | |
| 370 LoadGlobalWithVector) \ | |
| 371 V(LoadGlobalIC_SlowInsideTypeof, HANDLER, Code::LOAD_GLOBAL_IC, \ | |
| 372 LoadGlobalWithVector) \ | |
| 373 V(LoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector) \ | |
| 374 V(LoadIC_Slow, HANDLER, Code::LOAD_IC, LoadWithVector) \ | |
| 375 V(StoreIC_Miss, BUILTIN, kNoExtraICState, VectorStoreIC) \ | |
| 376 V(StoreIC_SlowSloppy, HANDLER, Code::STORE_IC, VectorStoreIC) \ | |
| 377 V(StoreIC_SlowStrict, HANDLER, Code::STORE_IC, VectorStoreIC) | |
| 378 | |
| 379 // Define list of builtin handlers implemented in assembly. | |
| 380 #define BUILTIN_LIST_H(V) \ | |
| 381 V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \ | |
| 382 V(KeyedStoreIC_Slow, KEYED_STORE_IC) \ | |
| 383 V(LoadIC_Normal, LOAD_IC) \ | |
| 384 V(StoreIC_Normal, STORE_IC) | |
| 385 | |
| 386 // Define list of builtins used by the debugger implemented in assembly. | |
| 387 #define BUILTIN_LIST_DEBUG_A(V) \ | |
| 388 V(Return_DebugBreak, BUILTIN, kNoExtraICState) \ | |
| 389 V(Slot_DebugBreak, BUILTIN, kNoExtraICState) \ | |
| 390 V(FrameDropper_LiveEdit, BUILTIN, kNoExtraICState) | |
| 391 | |
| 392 class BuiltinFunctionTable; | |
| 393 class ObjectVisitor; | |
| 394 | |
| 395 | |
| 396 class Builtins { | |
| 397 public: | |
| 398 ~Builtins(); | |
| 399 | |
| 400 // Generate all builtin code objects. Should be called once during | |
| 401 // isolate initialization. | |
| 402 void SetUp(Isolate* isolate, bool create_heap_objects); | |
| 403 void TearDown(); | |
| 404 | |
| 405 // Garbage collection support. | |
| 406 void IterateBuiltins(ObjectVisitor* v); | |
| 407 | |
| 408 // Disassembler support. | |
| 409 const char* Lookup(byte* pc); | |
| 410 | |
| 411 enum Name { | |
| 412 #define DEF_ENUM_C(name, ignore) k##name, | |
| 413 #define DEF_ENUM_A(name, kind, extra) k##name, | |
| 414 #define DEF_ENUM_T(name, argc) k##name, | |
| 415 #define DEF_ENUM_S(name, kind, extra, interface_descriptor) k##name, | |
| 416 #define DEF_ENUM_H(name, kind) k##name, | |
| 417 BUILTIN_LIST_C(DEF_ENUM_C) BUILTIN_LIST_A(DEF_ENUM_A) | |
| 418 BUILTIN_LIST_T(DEF_ENUM_T) BUILTIN_LIST_S(DEF_ENUM_S) | |
| 419 BUILTIN_LIST_H(DEF_ENUM_H) BUILTIN_LIST_DEBUG_A(DEF_ENUM_A) | |
| 420 #undef DEF_ENUM_C | |
| 421 #undef DEF_ENUM_A | |
| 422 #undef DEF_ENUM_T | |
| 423 #undef DEF_ENUM_S | |
| 424 #undef DEF_ENUM_H | |
| 425 builtin_count | |
| 426 }; | |
| 427 | |
| 428 enum CFunctionId { | |
| 429 #define DEF_ENUM_C(name, ignore) c_##name, | |
| 430 BUILTIN_LIST_C(DEF_ENUM_C) | |
| 431 #undef DEF_ENUM_C | |
| 432 cfunction_count | |
| 433 }; | |
| 434 | |
| 435 #define DECLARE_BUILTIN_ACCESSOR_C(name, ignore) Handle<Code> name(); | |
| 436 #define DECLARE_BUILTIN_ACCESSOR_A(name, kind, extra) Handle<Code> name(); | |
| 437 #define DECLARE_BUILTIN_ACCESSOR_T(name, argc) Handle<Code> name(); | |
| 438 #define DECLARE_BUILTIN_ACCESSOR_S(name, kind, extra, interface_descriptor) \ | |
| 439 Handle<Code> name(); | |
| 440 #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name(); | |
| 441 BUILTIN_LIST_C(DECLARE_BUILTIN_ACCESSOR_C) | |
| 442 BUILTIN_LIST_A(DECLARE_BUILTIN_ACCESSOR_A) | |
| 443 BUILTIN_LIST_T(DECLARE_BUILTIN_ACCESSOR_T) | |
| 444 BUILTIN_LIST_S(DECLARE_BUILTIN_ACCESSOR_S) | |
| 445 BUILTIN_LIST_H(DECLARE_BUILTIN_ACCESSOR_H) | |
| 446 BUILTIN_LIST_DEBUG_A(DECLARE_BUILTIN_ACCESSOR_A) | |
| 447 #undef DECLARE_BUILTIN_ACCESSOR_C | |
| 448 #undef DECLARE_BUILTIN_ACCESSOR_A | |
| 449 #undef DECLARE_BUILTIN_ACCESSOR_T | |
| 450 #undef DECLARE_BUILTIN_ACCESSOR_S | |
| 451 #undef DECLARE_BUILTIN_ACCESSOR_H | |
| 452 | |
| 453 // Convenience wrappers. | |
| 454 Handle<Code> CallFunction( | |
| 455 ConvertReceiverMode = ConvertReceiverMode::kAny, | |
| 456 TailCallMode tail_call_mode = TailCallMode::kDisallow); | |
| 457 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, | |
| 458 TailCallMode tail_call_mode = TailCallMode::kDisallow); | |
| 459 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode); | |
| 460 Handle<Code> InterpreterPushArgsAndCall( | |
| 461 TailCallMode tail_call_mode, | |
| 462 CallableType function_type = CallableType::kAny); | |
| 463 | |
| 464 Code* builtin(Name name) { | |
| 465 // Code::cast cannot be used here since we access builtins | |
| 466 // during the marking phase of mark sweep. See IC::Clear. | |
| 467 return reinterpret_cast<Code*>(builtins_[name]); | |
| 468 } | |
| 469 | |
| 470 Address builtin_address(Name name) { | |
| 471 return reinterpret_cast<Address>(&builtins_[name]); | |
| 472 } | |
| 473 | |
| 474 static Address c_function_address(CFunctionId id) { | |
| 475 return c_functions_[id]; | |
| 476 } | |
| 477 | |
| 478 const char* name(int index) { | |
| 479 DCHECK(index >= 0); | |
| 480 DCHECK(index < builtin_count); | |
| 481 return names_[index]; | |
| 482 } | |
| 483 | |
| 484 bool is_initialized() const { return initialized_; } | |
| 485 | |
| 486 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction( | |
| 487 Isolate* isolate, Handle<HeapObject> function, Handle<Object> receiver, | |
| 488 int argc, Handle<Object> args[]); | |
| 489 | |
| 490 enum ExitFrameType { EXIT, BUILTIN_EXIT }; | |
| 491 | |
| 492 private: | |
| 493 Builtins(); | |
| 494 | |
| 495 // The external C++ functions called from the code. | |
| 496 static Address const c_functions_[cfunction_count]; | |
| 497 | |
| 498 // Note: These are always Code objects, but to conform with | |
| 499 // IterateBuiltins() above which assumes Object**'s for the callback | |
| 500 // function f, we use an Object* array here. | |
| 501 Object* builtins_[builtin_count]; | |
| 502 const char* names_[builtin_count]; | |
| 503 | |
| 504 static void Generate_Adaptor(MacroAssembler* masm, CFunctionId id, | |
| 505 ExitFrameType exit_frame_type); | |
| 506 static void Generate_AllocateInNewSpace(MacroAssembler* masm); | |
| 507 static void Generate_AllocateInOldSpace(MacroAssembler* masm); | |
| 508 static void Generate_ConstructedNonConstructable(MacroAssembler* masm); | |
| 509 static void Generate_InstantiateAsmJs(MacroAssembler* masm); | |
| 510 static void Generate_CompileLazy(MacroAssembler* masm); | |
| 511 static void Generate_CompileBaseline(MacroAssembler* masm); | |
| 512 static void Generate_InOptimizationQueue(MacroAssembler* masm); | |
| 513 static void Generate_CompileOptimized(MacroAssembler* masm); | |
| 514 static void Generate_CompileOptimizedConcurrent(MacroAssembler* masm); | |
| 515 static void Generate_JSConstructStubGeneric(MacroAssembler* masm); | |
| 516 static void Generate_JSBuiltinsConstructStub(MacroAssembler* masm); | |
| 517 static void Generate_JSBuiltinsConstructStubForDerived(MacroAssembler* masm); | |
| 518 static void Generate_JSConstructStubApi(MacroAssembler* masm); | |
| 519 static void Generate_JSEntryTrampoline(MacroAssembler* masm); | |
| 520 static void Generate_JSConstructEntryTrampoline(MacroAssembler* masm); | |
| 521 static void Generate_ResumeGeneratorTrampoline(MacroAssembler* masm); | |
| 522 static void Generate_NotifyDeoptimized(MacroAssembler* masm); | |
| 523 static void Generate_NotifySoftDeoptimized(MacroAssembler* masm); | |
| 524 static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm); | |
| 525 static void Generate_NotifyStubFailure(MacroAssembler* masm); | |
| 526 static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm); | |
| 527 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); | |
| 528 static void Generate_StringToNumber(MacroAssembler* masm); | |
| 529 static void Generate_NonNumberToNumber(MacroAssembler* masm); | |
| 530 static void Generate_ToNumber(MacroAssembler* masm); | |
| 531 | |
| 532 static void Generate_Apply(MacroAssembler* masm); | |
| 533 | |
| 534 // ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) | |
| 535 static void Generate_CallFunction(MacroAssembler* masm, | |
| 536 ConvertReceiverMode mode, | |
| 537 TailCallMode tail_call_mode); | |
| 538 static void Generate_CallFunction_ReceiverIsNullOrUndefined( | |
| 539 MacroAssembler* masm) { | |
| 540 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, | |
| 541 TailCallMode::kDisallow); | |
| 542 } | |
| 543 static void Generate_CallFunction_ReceiverIsNotNullOrUndefined( | |
| 544 MacroAssembler* masm) { | |
| 545 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
| 546 TailCallMode::kDisallow); | |
| 547 } | |
| 548 static void Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) { | |
| 549 Generate_CallFunction(masm, ConvertReceiverMode::kAny, | |
| 550 TailCallMode::kDisallow); | |
| 551 } | |
| 552 static void Generate_TailCallFunction_ReceiverIsNullOrUndefined( | |
| 553 MacroAssembler* masm) { | |
| 554 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, | |
| 555 TailCallMode::kAllow); | |
| 556 } | |
| 557 static void Generate_TailCallFunction_ReceiverIsNotNullOrUndefined( | |
| 558 MacroAssembler* masm) { | |
| 559 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
| 560 TailCallMode::kAllow); | |
| 561 } | |
| 562 static void Generate_TailCallFunction_ReceiverIsAny(MacroAssembler* masm) { | |
| 563 Generate_CallFunction(masm, ConvertReceiverMode::kAny, | |
| 564 TailCallMode::kAllow); | |
| 565 } | |
| 566 // ES6 section 9.4.1.1 [[Call]] ( thisArgument, argumentsList) | |
| 567 static void Generate_CallBoundFunctionImpl(MacroAssembler* masm, | |
| 568 TailCallMode tail_call_mode); | |
| 569 static void Generate_CallBoundFunction(MacroAssembler* masm) { | |
| 570 Generate_CallBoundFunctionImpl(masm, TailCallMode::kDisallow); | |
| 571 } | |
| 572 static void Generate_TailCallBoundFunction(MacroAssembler* masm) { | |
| 573 Generate_CallBoundFunctionImpl(masm, TailCallMode::kAllow); | |
| 574 } | |
| 575 // ES6 section 7.3.12 Call(F, V, [argumentsList]) | |
| 576 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, | |
| 577 TailCallMode tail_call_mode); | |
| 578 static void Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) { | |
| 579 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, | |
| 580 TailCallMode::kDisallow); | |
| 581 } | |
| 582 static void Generate_Call_ReceiverIsNotNullOrUndefined(MacroAssembler* masm) { | |
| 583 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
| 584 TailCallMode::kDisallow); | |
| 585 } | |
| 586 static void Generate_Call_ReceiverIsAny(MacroAssembler* masm) { | |
| 587 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kDisallow); | |
| 588 } | |
| 589 static void Generate_TailCall_ReceiverIsNullOrUndefined( | |
| 590 MacroAssembler* masm) { | |
| 591 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, | |
| 592 TailCallMode::kAllow); | |
| 593 } | |
| 594 static void Generate_TailCall_ReceiverIsNotNullOrUndefined( | |
| 595 MacroAssembler* masm) { | |
| 596 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
| 597 TailCallMode::kAllow); | |
| 598 } | |
| 599 static void Generate_TailCall_ReceiverIsAny(MacroAssembler* masm) { | |
| 600 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow); | |
| 601 } | |
| 602 | |
| 603 // ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget) | |
| 604 static void Generate_ConstructFunction(MacroAssembler* masm); | |
| 605 // ES6 section 9.4.1.2 [[Construct]] (argumentsList, newTarget) | |
| 606 static void Generate_ConstructBoundFunction(MacroAssembler* masm); | |
| 607 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) | |
| 608 static void Generate_ConstructProxy(MacroAssembler* masm); | |
| 609 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) | |
| 610 static void Generate_Construct(MacroAssembler* masm); | |
| 611 | |
| 612 static void Generate_HandleFastApiCall(MacroAssembler* masm); | |
| 613 | |
| 614 // ES6 section 19.3.3.2 Boolean.prototype.toString ( ) | |
| 615 static void Generate_BooleanPrototypeToString(CodeStubAssembler* assembler); | |
| 616 // ES6 section 19.3.3.3 Boolean.prototype.valueOf ( ) | |
| 617 static void Generate_BooleanPrototypeValueOf(CodeStubAssembler* assembler); | |
| 618 | |
| 619 static void Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 620 int field_index); | |
| 621 // ES6 section 20.3.4.2 Date.prototype.getDate ( ) | |
| 622 static void Generate_DatePrototypeGetDate(MacroAssembler* masm); | |
| 623 // ES6 section 20.3.4.3 Date.prototype.getDay ( ) | |
| 624 static void Generate_DatePrototypeGetDay(MacroAssembler* masm); | |
| 625 // ES6 section 20.3.4.4 Date.prototype.getFullYear ( ) | |
| 626 static void Generate_DatePrototypeGetFullYear(MacroAssembler* masm); | |
| 627 // ES6 section 20.3.4.5 Date.prototype.getHours ( ) | |
| 628 static void Generate_DatePrototypeGetHours(MacroAssembler* masm); | |
| 629 // ES6 section 20.3.4.6 Date.prototype.getMilliseconds ( ) | |
| 630 static void Generate_DatePrototypeGetMilliseconds(MacroAssembler* masm); | |
| 631 // ES6 section 20.3.4.7 Date.prototype.getMinutes ( ) | |
| 632 static void Generate_DatePrototypeGetMinutes(MacroAssembler* masm); | |
| 633 // ES6 section 20.3.4.8 Date.prototype.getMonth ( ) | |
| 634 static void Generate_DatePrototypeGetMonth(MacroAssembler* masm); | |
| 635 // ES6 section 20.3.4.9 Date.prototype.getSeconds ( ) | |
| 636 static void Generate_DatePrototypeGetSeconds(MacroAssembler* masm); | |
| 637 // ES6 section 20.3.4.10 Date.prototype.getTime ( ) | |
| 638 static void Generate_DatePrototypeGetTime(MacroAssembler* masm); | |
| 639 // ES6 section 20.3.4.11 Date.prototype.getTimezoneOffset ( ) | |
| 640 static void Generate_DatePrototypeGetTimezoneOffset(MacroAssembler* masm); | |
| 641 // ES6 section 20.3.4.12 Date.prototype.getUTCDate ( ) | |
| 642 static void Generate_DatePrototypeGetUTCDate(MacroAssembler* masm); | |
| 643 // ES6 section 20.3.4.13 Date.prototype.getUTCDay ( ) | |
| 644 static void Generate_DatePrototypeGetUTCDay(MacroAssembler* masm); | |
| 645 // ES6 section 20.3.4.14 Date.prototype.getUTCFullYear ( ) | |
| 646 static void Generate_DatePrototypeGetUTCFullYear(MacroAssembler* masm); | |
| 647 // ES6 section 20.3.4.15 Date.prototype.getUTCHours ( ) | |
| 648 static void Generate_DatePrototypeGetUTCHours(MacroAssembler* masm); | |
| 649 // ES6 section 20.3.4.16 Date.prototype.getUTCMilliseconds ( ) | |
| 650 static void Generate_DatePrototypeGetUTCMilliseconds(MacroAssembler* masm); | |
| 651 // ES6 section 20.3.4.17 Date.prototype.getUTCMinutes ( ) | |
| 652 static void Generate_DatePrototypeGetUTCMinutes(MacroAssembler* masm); | |
| 653 // ES6 section 20.3.4.18 Date.prototype.getUTCMonth ( ) | |
| 654 static void Generate_DatePrototypeGetUTCMonth(MacroAssembler* masm); | |
| 655 // ES6 section 20.3.4.19 Date.prototype.getUTCSeconds ( ) | |
| 656 static void Generate_DatePrototypeGetUTCSeconds(MacroAssembler* masm); | |
| 657 | |
| 658 static void Generate_FunctionPrototypeApply(MacroAssembler* masm); | |
| 659 static void Generate_FunctionPrototypeCall(MacroAssembler* masm); | |
| 660 | |
| 661 static void Generate_ReflectApply(MacroAssembler* masm); | |
| 662 static void Generate_ReflectConstruct(MacroAssembler* masm); | |
| 663 | |
| 664 static void Generate_InternalArrayCode(MacroAssembler* masm); | |
| 665 static void Generate_ArrayCode(MacroAssembler* masm); | |
| 666 | |
| 667 // ES6 section 20.2.2.1 Math.abs ( x ) | |
| 668 static void Generate_MathAbs(CodeStubAssembler* assembler); | |
| 669 // ES6 section 20.2.2.2 Math.acos ( x ) | |
| 670 static void Generate_MathAcos(CodeStubAssembler* assembler); | |
| 671 // ES6 section 20.2.2.3 Math.acosh ( x ) | |
| 672 static void Generate_MathAcosh(CodeStubAssembler* assembler); | |
| 673 // ES6 section 20.2.2.4 Math.asin ( x ) | |
| 674 static void Generate_MathAsin(CodeStubAssembler* assembler); | |
| 675 // ES6 section 20.2.2.5 Math.asinh ( x ) | |
| 676 static void Generate_MathAsinh(CodeStubAssembler* assembler); | |
| 677 // ES6 section 20.2.2.6 Math.atan ( x ) | |
| 678 static void Generate_MathAtan(CodeStubAssembler* assembler); | |
| 679 // ES6 section 20.2.2.7 Math.atanh ( x ) | |
| 680 static void Generate_MathAtanh(CodeStubAssembler* assembler); | |
| 681 // ES6 section 20.2.2.8 Math.atan2 ( y, x ) | |
| 682 static void Generate_MathAtan2(CodeStubAssembler* assembler); | |
| 683 // ES6 section 20.2.2.10 Math.ceil ( x ) | |
| 684 static void Generate_MathCeil(CodeStubAssembler* assembler); | |
| 685 // ES6 section 20.2.2.9 Math.ceil ( x ) | |
| 686 static void Generate_MathCbrt(CodeStubAssembler* assembler); | |
| 687 // ES6 section 20.2.2.15 Math.expm1 ( x ) | |
| 688 static void Generate_MathExpm1(CodeStubAssembler* assembler); | |
| 689 // ES6 section 20.2.2.11 Math.clz32 ( x ) | |
| 690 static void Generate_MathClz32(CodeStubAssembler* assembler); | |
| 691 // ES6 section 20.2.2.12 Math.cos ( x ) | |
| 692 static void Generate_MathCos(CodeStubAssembler* assembler); | |
| 693 // ES6 section 20.2.2.13 Math.cosh ( x ) | |
| 694 static void Generate_MathCosh(CodeStubAssembler* assembler); | |
| 695 // ES6 section 20.2.2.14 Math.exp ( x ) | |
| 696 static void Generate_MathExp(CodeStubAssembler* assembler); | |
| 697 // ES6 section 20.2.2.16 Math.floor ( x ) | |
| 698 static void Generate_MathFloor(CodeStubAssembler* assembler); | |
| 699 // ES6 section 20.2.2.17 Math.fround ( x ) | |
| 700 static void Generate_MathFround(CodeStubAssembler* assembler); | |
| 701 // ES6 section 20.2.2.20 Math.imul ( x, y ) | |
| 702 static void Generate_MathImul(CodeStubAssembler* assembler); | |
| 703 // ES6 section 20.2.2.20 Math.log ( x ) | |
| 704 static void Generate_MathLog(CodeStubAssembler* assembler); | |
| 705 // ES6 section 20.2.2.21 Math.log ( x ) | |
| 706 static void Generate_MathLog1p(CodeStubAssembler* assembler); | |
| 707 | |
| 708 static void Generate_MathLog2(CodeStubAssembler* assembler); | |
| 709 static void Generate_MathLog10(CodeStubAssembler* assembler); | |
| 710 | |
| 711 enum class MathMaxMinKind { kMax, kMin }; | |
| 712 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); | |
| 713 // ES6 section 20.2.2.24 Math.max ( value1, value2 , ...values ) | |
| 714 static void Generate_MathMax(MacroAssembler* masm) { | |
| 715 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); | |
| 716 } | |
| 717 // ES6 section 20.2.2.25 Math.min ( value1, value2 , ...values ) | |
| 718 static void Generate_MathMin(MacroAssembler* masm) { | |
| 719 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); | |
| 720 } | |
| 721 // ES6 section 20.2.2.26 Math.pow ( x, y ) | |
| 722 static void Generate_MathPow(CodeStubAssembler* assembler); | |
| 723 // ES6 section 20.2.2.28 Math.round ( x ) | |
| 724 static void Generate_MathRound(CodeStubAssembler* assembler); | |
| 725 // ES6 section 20.2.2.29 Math.sign ( x ) | |
| 726 static void Generate_MathSign(CodeStubAssembler* assembler); | |
| 727 // ES6 section 20.2.2.30 Math.sin ( x ) | |
| 728 static void Generate_MathSin(CodeStubAssembler* assembler); | |
| 729 // ES6 section 20.2.2.31 Math.sinh ( x ) | |
| 730 static void Generate_MathSinh(CodeStubAssembler* assembler); | |
| 731 // ES6 section 20.2.2.32 Math.sqrt ( x ) | |
| 732 static void Generate_MathSqrt(CodeStubAssembler* assembler); | |
| 733 // ES6 section 20.2.2.33 Math.tan ( x ) | |
| 734 static void Generate_MathTan(CodeStubAssembler* assembler); | |
| 735 // ES6 section 20.2.2.34 Math.tanh ( x ) | |
| 736 static void Generate_MathTanh(CodeStubAssembler* assembler); | |
| 737 // ES6 section 20.2.2.35 Math.trunc ( x ) | |
| 738 static void Generate_MathTrunc(CodeStubAssembler* assembler); | |
| 739 | |
| 740 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Call]] case. | |
| 741 static void Generate_NumberConstructor(MacroAssembler* masm); | |
| 742 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Construct]] case. | |
| 743 static void Generate_NumberConstructor_ConstructStub(MacroAssembler* masm); | |
| 744 // ES6 section 20.1.3.7 Number.prototype.valueOf ( ) | |
| 745 static void Generate_NumberPrototypeValueOf(CodeStubAssembler* assembler); | |
| 746 | |
| 747 // ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V ) | |
| 748 static void Generate_FunctionPrototypeHasInstance( | |
| 749 CodeStubAssembler* assembler); | |
| 750 | |
| 751 // ES6 section 25.3.1.2 Generator.prototype.next ( value ) | |
| 752 static void Generate_GeneratorPrototypeNext(CodeStubAssembler* assembler); | |
| 753 // ES6 section 25.3.1.3 Generator.prototype.return ( value ) | |
| 754 static void Generate_GeneratorPrototypeReturn(CodeStubAssembler* assembler); | |
| 755 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) | |
| 756 static void Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler); | |
| 757 | |
| 758 // ES6 section 19.1.3.2 Object.prototype.hasOwnProperty | |
| 759 static void Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler); | |
| 760 | |
| 761 // ES6 section 22.1.2.2 Array.isArray | |
| 762 static void Generate_ArrayIsArray(CodeStubAssembler* assembler); | |
| 763 | |
| 764 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) | |
| 765 static void Generate_StringFromCharCode(CodeStubAssembler* assembler); | |
| 766 // ES6 section 21.1.3.1 String.prototype.charAt ( pos ) | |
| 767 static void Generate_StringPrototypeCharAt(CodeStubAssembler* assembler); | |
| 768 // ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) | |
| 769 static void Generate_StringPrototypeCharCodeAt(CodeStubAssembler* assembler); | |
| 770 // ES6 section 21.1.3.25 String.prototype.toString () | |
| 771 static void Generate_StringPrototypeToString(CodeStubAssembler* assembler); | |
| 772 // ES6 section 21.1.3.28 String.prototype.valueOf () | |
| 773 static void Generate_StringPrototypeValueOf(CodeStubAssembler* assembler); | |
| 774 | |
| 775 static void Generate_StringConstructor(MacroAssembler* masm); | |
| 776 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); | |
| 777 | |
| 778 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) | |
| 779 static void Generate_SymbolPrototypeToPrimitive(CodeStubAssembler* assembler); | |
| 780 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) | |
| 781 static void Generate_SymbolPrototypeToString(CodeStubAssembler* assembler); | |
| 782 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) | |
| 783 static void Generate_SymbolPrototypeValueOf(CodeStubAssembler* assembler); | |
| 784 | |
| 785 // ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength | |
| 786 static void Generate_TypedArrayPrototypeByteLength( | |
| 787 CodeStubAssembler* assembler); | |
| 788 // ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset | |
| 789 static void Generate_TypedArrayPrototypeByteOffset( | |
| 790 CodeStubAssembler* assembler); | |
| 791 // ES6 section 22.2.3.18 get %TypedArray%.prototype.length | |
| 792 static void Generate_TypedArrayPrototypeLength(CodeStubAssembler* assembler); | |
| 793 | |
| 794 static void Generate_OnStackReplacement(MacroAssembler* masm); | |
| 795 static void Generate_InterruptCheck(MacroAssembler* masm); | |
| 796 static void Generate_StackCheck(MacroAssembler* masm); | |
| 797 | |
| 798 static void Generate_InterpreterEntryTrampoline(MacroAssembler* masm); | |
| 799 static void Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm); | |
| 800 static void Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm); | |
| 801 static void Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | |
| 802 return Generate_InterpreterPushArgsAndCallImpl( | |
| 803 masm, TailCallMode::kDisallow, CallableType::kAny); | |
| 804 } | |
| 805 static void Generate_InterpreterPushArgsAndTailCall(MacroAssembler* masm) { | |
| 806 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, | |
| 807 CallableType::kAny); | |
| 808 } | |
| 809 static void Generate_InterpreterPushArgsAndCallFunction( | |
| 810 MacroAssembler* masm) { | |
| 811 return Generate_InterpreterPushArgsAndCallImpl( | |
| 812 masm, TailCallMode::kDisallow, CallableType::kJSFunction); | |
| 813 } | |
| 814 static void Generate_InterpreterPushArgsAndTailCallFunction( | |
| 815 MacroAssembler* masm) { | |
| 816 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, | |
| 817 CallableType::kJSFunction); | |
| 818 } | |
| 819 static void Generate_InterpreterPushArgsAndCallImpl( | |
| 820 MacroAssembler* masm, TailCallMode tail_call_mode, | |
| 821 CallableType function_type); | |
| 822 static void Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm); | |
| 823 | |
| 824 #define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C) \ | |
| 825 static void Generate_Make##C##CodeYoungAgainEvenMarking( \ | |
| 826 MacroAssembler* masm); \ | |
| 827 static void Generate_Make##C##CodeYoungAgainOddMarking( \ | |
| 828 MacroAssembler* masm); | |
| 829 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) | |
| 830 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR | |
| 831 | |
| 832 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm); | |
| 833 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); | |
| 834 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); | |
| 835 | |
| 836 static void Generate_AtomicsLoad(CodeStubAssembler* assembler); | |
| 837 static void Generate_AtomicsStore(CodeStubAssembler* assembler); | |
| 838 | |
| 839 static void InitBuiltinFunctionTable(); | |
| 840 | |
| 841 bool initialized_; | |
| 842 | |
| 843 friend class BuiltinFunctionTable; | |
| 844 friend class Isolate; | |
| 845 | |
| 846 DISALLOW_COPY_AND_ASSIGN(Builtins); | |
| 847 }; | |
| 848 | |
| 849 } // namespace internal | |
| 850 } // namespace v8 | |
| 851 | |
| 852 #endif // V8_BUILTINS_H_ | |
| OLD | NEW |