1 // Copyright 2011 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_BUILTINS_BUILTINS_H_ 6 #define V8_BUILTINS_BUILTINS_H_ 7 8 #include "src/base/flags.h" 9 #include "src/globals.h" 10 11 namespace v8 { 12 namespace internal { 13 14 template <typename T> 15 class Handle; 16 class Isolate; 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) CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V) 28 29 #define CODE_AGE_LIST_COMPLETE(V) \ 30 V(ToBeExecutedOnce) \ 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) V(Make##C##CodeYoungAgain) 37 38 // CPP: Builtin in C++. Entered via BUILTIN_EXIT frame. 39 // Args: name 40 // API: Builtin in C++ for API callbacks. Entered via EXIT frame. 41 // Args: name 42 // TFJ: Builtin in Turbofan, with JS linkage (callable as Javascript function). 43 // Args: name, arguments count 44 // TFS: Builtin in Turbofan, with CodeStub linkage. 45 // Args: name, code kind, extra IC state, interface descriptor, return_size 46 // ASM: Builtin in platform-dependent assembly. 47 // Args: name 48 // ASH: Handlers implemented in platform-dependent assembly. 49 // Args: name, code kind, extra IC state 50 // DBG: Builtin in platform-dependent assembly, used by the debugger. 51 // Args: name 52 #define BUILTIN_LIST(CPP, API, TFJ, TFS, ASM, ASH, DBG) \ 53 ASM(Abort) \ 54 /* Code aging */ \ 55 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, ASM) \ 56 \ 57 /* Declared first for dependency reasons */ \ 58 ASM(CompileLazy) \ 59 TFS(ToObject, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 60 TFS(FastNewObject, BUILTIN, kNoExtraICState, FastNewObject, 1) \ 61 TFS(HasProperty, BUILTIN, kNoExtraICState, HasProperty, 1) \ 62 \ 63 /* Calls */ \ 64 ASM(ArgumentsAdaptorTrampoline) \ 65 /* ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) */ \ 66 ASM(CallFunction_ReceiverIsNullOrUndefined) \ 67 ASM(CallFunction_ReceiverIsNotNullOrUndefined) \ 68 ASM(CallFunction_ReceiverIsAny) \ 69 ASM(TailCallFunction_ReceiverIsNullOrUndefined) \ 70 ASM(TailCallFunction_ReceiverIsNotNullOrUndefined) \ 71 ASM(TailCallFunction_ReceiverIsAny) \ 72 /* ES6 section 9.4.1.1 [[Call]] ( thisArgument, argumentsList) */ \ 73 ASM(CallBoundFunction) \ 74 ASM(TailCallBoundFunction) \ 75 /* ES6 section 7.3.12 Call(F, V, [argumentsList]) */ \ 76 ASM(Call_ReceiverIsNullOrUndefined) \ 77 ASM(Call_ReceiverIsNotNullOrUndefined) \ 78 ASM(Call_ReceiverIsAny) \ 79 ASM(TailCall_ReceiverIsNullOrUndefined) \ 80 ASM(TailCall_ReceiverIsNotNullOrUndefined) \ 81 ASM(TailCall_ReceiverIsAny) \ 82 ASM(CallWithSpread) \ 83 ASM(CallForwardVarargs) \ 84 ASM(CallFunctionForwardVarargs) \ 85 \ 86 /* Construct */ \ 87 /* ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget) */ \ 88 ASM(ConstructFunction) \ 89 /* ES6 section 9.4.1.2 [[Construct]] (argumentsList, newTarget) */ \ 90 ASM(ConstructBoundFunction) \ 91 ASM(ConstructedNonConstructable) \ 92 /* ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) */ \ 93 ASM(ConstructProxy) \ 94 /* ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) */ \ 95 ASM(Construct) \ 96 ASM(ConstructWithSpread) \ 97 ASM(JSConstructStubApi) \ 98 ASM(JSConstructStubGeneric) \ 99 ASM(JSBuiltinsConstructStub) \ 100 ASM(JSBuiltinsConstructStubForDerived) \ 101 TFS(FastNewClosure, BUILTIN, kNoExtraICState, FastNewClosure, 1) \ 102 TFS(FastNewFunctionContextEval, BUILTIN, kNoExtraICState, \ 103 FastNewFunctionContext, 1) \ 104 TFS(FastNewFunctionContextFunction, BUILTIN, kNoExtraICState, \ 105 FastNewFunctionContext, 1) \ 106 TFS(FastNewStrictArguments, BUILTIN, kNoExtraICState, FastNewArguments, 1) \ 107 TFS(FastNewSloppyArguments, BUILTIN, kNoExtraICState, FastNewArguments, 1) \ 108 TFS(FastNewRestParameter, BUILTIN, kNoExtraICState, FastNewArguments, 1) \ 109 TFS(FastCloneRegExp, BUILTIN, kNoExtraICState, FastCloneRegExp, 1) \ 110 TFS(FastCloneShallowArrayTrack, BUILTIN, kNoExtraICState, \ 111 FastCloneShallowArray, 1) \ 112 TFS(FastCloneShallowArrayDontTrack, BUILTIN, kNoExtraICState, \ 113 FastCloneShallowArray, 1) \ 114 TFS(FastCloneShallowObject0, BUILTIN, kNoExtraICState, \ 115 FastCloneShallowObject, 1) \ 116 TFS(FastCloneShallowObject1, BUILTIN, kNoExtraICState, \ 117 FastCloneShallowObject, 1) \ 118 TFS(FastCloneShallowObject2, BUILTIN, kNoExtraICState, \ 119 FastCloneShallowObject, 1) \ 120 TFS(FastCloneShallowObject3, BUILTIN, kNoExtraICState, \ 121 FastCloneShallowObject, 1) \ 122 TFS(FastCloneShallowObject4, BUILTIN, kNoExtraICState, \ 123 FastCloneShallowObject, 1) \ 124 TFS(FastCloneShallowObject5, BUILTIN, kNoExtraICState, \ 125 FastCloneShallowObject, 1) \ 126 TFS(FastCloneShallowObject6, BUILTIN, kNoExtraICState, \ 127 FastCloneShallowObject, 1) \ 128 \ 129 /* Apply and entries */ \ 130 ASM(Apply) \ 131 ASM(JSEntryTrampoline) \ 132 ASM(JSConstructEntryTrampoline) \ 133 ASM(ResumeGeneratorTrampoline) \ 134 \ 135 /* Stack and interrupt check */ \ 136 ASM(InterruptCheck) \ 137 ASM(StackCheck) \ 138 \ 139 /* String helpers */ \ 140 TFS(StringCharAt, BUILTIN, kNoExtraICState, StringCharAt, 1) \ 141 TFS(StringCharCodeAt, BUILTIN, kNoExtraICState, StringCharCodeAt, 1) \ 142 TFS(StringEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 143 TFS(StringGreaterThan, BUILTIN, kNoExtraICState, Compare, 1) \ 144 TFS(StringGreaterThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 145 TFS(StringIndexOf, BUILTIN, kNoExtraICState, StringIndexOf, 1) \ 146 TFS(StringLessThan, BUILTIN, kNoExtraICState, Compare, 1) \ 147 TFS(StringLessThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 148 TFS(StringNotEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 149 \ 150 /* Interpreter */ \ 151 ASM(InterpreterEntryTrampoline) \ 152 ASM(InterpreterPushArgsAndCall) \ 153 ASM(InterpreterPushArgsAndCallFunction) \ 154 ASM(InterpreterPushArgsAndCallWithFinalSpread) \ 155 ASM(InterpreterPushArgsAndTailCall) \ 156 ASM(InterpreterPushArgsAndTailCallFunction) \ 157 ASM(InterpreterPushArgsAndConstruct) \ 158 ASM(InterpreterPushArgsAndConstructFunction) \ 159 ASM(InterpreterPushArgsAndConstructArray) \ 160 ASM(InterpreterPushArgsAndConstructWithFinalSpread) \ 161 ASM(InterpreterEnterBytecodeAdvance) \ 162 ASM(InterpreterEnterBytecodeDispatch) \ 163 ASM(InterpreterOnStackReplacement) \ 164 \ 165 /* Code life-cycle */ \ 166 ASM(CompileBaseline) \ 167 ASM(CompileOptimized) \ 168 ASM(CompileOptimizedConcurrent) \ 169 ASM(InOptimizationQueue) \ 170 ASM(InstantiateAsmJs) \ 171 ASM(MarkCodeAsToBeExecutedOnce) \ 172 ASM(MarkCodeAsExecutedOnce) \ 173 ASM(MarkCodeAsExecutedTwice) \ 174 ASM(NotifyDeoptimized) \ 175 ASM(NotifySoftDeoptimized) \ 176 ASM(NotifyLazyDeoptimized) \ 177 ASM(NotifyStubFailure) \ 178 ASM(NotifyStubFailureSaveDoubles) \ 179 ASM(OnStackReplacement) \ 180 \ 181 /* API callback handling */ \ 182 API(HandleApiCall) \ 183 API(HandleApiCallAsFunction) \ 184 API(HandleApiCallAsConstructor) \ 185 ASM(HandleFastApiCall) \ 186 \ 187 /* Adapters for Turbofan into runtime */ \ 188 ASM(AllocateInNewSpace) \ 189 ASM(AllocateInOldSpace) \ 190 \ 191 /* TurboFan support builtins */ \ 192 TFS(CopyFastSmiOrObjectElements, BUILTIN, kNoExtraICState, \ 193 CopyFastSmiOrObjectElements, 1) \ 194 TFS(GrowFastDoubleElements, BUILTIN, kNoExtraICState, GrowArrayElements, 1) \ 195 TFS(GrowFastSmiOrObjectElements, BUILTIN, kNoExtraICState, \ 196 GrowArrayElements, 1) \ 197 TFS(NewUnmappedArgumentsElements, BUILTIN, kNoExtraICState, \ 198 NewArgumentsElements, 1) \ 199 TFS(NewRestParameterElements, BUILTIN, kNoExtraICState, \ 200 NewArgumentsElements, 1) \ 201 \ 202 /* Debugger */ \ 203 DBG(FrameDropperTrampoline) \ 204 DBG(HandleDebuggerStatement) \ 205 DBG(Return_DebugBreak) \ 206 DBG(Slot_DebugBreak) \ 207 \ 208 /* Type conversions */ \ 209 TFS(ToBoolean, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 210 TFS(OrdinaryToPrimitive_Number, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 211 TFS(OrdinaryToPrimitive_String, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 212 TFS(NonPrimitiveToPrimitive_Default, BUILTIN, kNoExtraICState, \ 213 TypeConversion, 1) \ 214 TFS(NonPrimitiveToPrimitive_Number, BUILTIN, kNoExtraICState, \ 215 TypeConversion, 1) \ 216 TFS(NonPrimitiveToPrimitive_String, BUILTIN, kNoExtraICState, \ 217 TypeConversion, 1) \ 218 TFS(StringToNumber, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 219 TFS(ToName, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 220 TFS(NonNumberToNumber, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 221 TFS(ToNumber, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 222 TFS(ToString, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 223 TFS(ToInteger, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 224 TFS(ToLength, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 225 TFS(ClassOf, BUILTIN, kNoExtraICState, Typeof, 1) \ 226 TFS(Typeof, BUILTIN, kNoExtraICState, Typeof, 1) \ 227 TFS(GetSuperConstructor, BUILTIN, kNoExtraICState, TypeConversion, 1) \ 228 \ 229 /* Handlers */ \ 230 TFS(LoadICProtoArray, BUILTIN, kNoExtraICState, LoadICProtoArray, 1) \ 231 TFS(LoadICProtoArrayThrowIfNonexistent, BUILTIN, kNoExtraICState, \ 232 LoadICProtoArray, 1) \ 233 TFS(KeyedLoadIC_Megamorphic, BUILTIN, kNoExtraICState, LoadWithVector, 1) \ 234 TFS(KeyedLoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector, 1) \ 235 TFS(KeyedLoadIC_Slow, HANDLER, Code::LOAD_IC, LoadWithVector, 1) \ 236 TFS(KeyedLoadIC_IndexedString, HANDLER, Code::LOAD_IC, LoadWithVector, 1) \ 237 TFS(KeyedStoreIC_Megamorphic, BUILTIN, kNoExtraICState, StoreWithVector, 1) \ 238 TFS(KeyedStoreIC_Megamorphic_Strict, BUILTIN, kNoExtraICState, \ 239 StoreWithVector, 1) \ 240 TFS(KeyedStoreIC_Miss, BUILTIN, kNoExtraICState, StoreWithVector, 1) \ 241 TFS(KeyedStoreIC_Slow, HANDLER, Code::STORE_IC, StoreWithVector, 1) \ 242 TFS(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector, 1) \ 243 TFS(LoadGlobalIC_Slow, HANDLER, Code::LOAD_GLOBAL_IC, LoadGlobalWithVector, \ 244 1) \ 245 TFS(LoadField, BUILTIN, kNoExtraICState, LoadField, 1) \ 246 TFS(LoadIC_FunctionPrototype, HANDLER, Code::LOAD_IC, LoadWithVector, 1) \ 247 ASH(LoadIC_Getter_ForDeopt, BUILTIN, kNoExtraICState) \ 248 TFS(LoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector, 1) \ 249 TFS(LoadIC_Normal, HANDLER, Code::LOAD_IC, LoadWithVector, 1) \ 250 TFS(LoadIC_Slow, HANDLER, Code::LOAD_IC, LoadWithVector, 1) \ 251 TFS(StoreIC_Miss, BUILTIN, kNoExtraICState, StoreWithVector, 1) \ 252 TFS(StoreIC_Normal, HANDLER, Code::STORE_IC, StoreWithVector, 1) \ 253 ASH(StoreIC_Setter_ForDeopt, BUILTIN, kNoExtraICState) \ 254 \ 255 /* Built-in functions for Javascript */ \ 256 /* Special internal builtins */ \ 257 CPP(EmptyFunction) \ 258 CPP(Illegal) \ 259 CPP(RestrictedFunctionPropertiesThrower) \ 260 CPP(RestrictedStrictArgumentsPropertiesThrower) \ 261 CPP(UnsupportedThrower) \ 262 TFJ(ReturnReceiver, 0) \ 263 \ 264 /* Array */ \ 265 ASM(ArrayCode) \ 266 ASM(InternalArrayCode) \ 267 CPP(ArrayConcat) \ 268 /* ES6 section 22.1.2.2 Array.isArray */ \ 269 TFJ(ArrayIsArray, 1) \ 270 /* ES7 #sec-array.prototype.includes */ \ 271 TFJ(ArrayIncludes, 2) \ 272 TFJ(ArrayIndexOf, 2) \ 273 CPP(ArrayPop) \ 274 CPP(ArrayPush) \ 275 TFJ(FastArrayPush, -1) \ 276 CPP(ArrayShift) \ 277 CPP(ArraySlice) \ 278 CPP(ArraySplice) \ 279 CPP(ArrayUnshift) \ 280 TFJ(ArrayForEach, 2) \ 281 /* ES6 #sec-array.prototype.entries */ \ 282 TFJ(ArrayPrototypeEntries, 0) \ 283 /* ES6 #sec-array.prototype.keys */ \ 284 TFJ(ArrayPrototypeKeys, 0) \ 285 /* ES6 #sec-array.prototype.values */ \ 286 TFJ(ArrayPrototypeValues, 0) \ 287 /* ES6 #sec-%arrayiteratorprototype%.next */ \ 288 TFJ(ArrayIteratorPrototypeNext, 0) \ 289 \ 290 /* ArrayBuffer */ \ 291 CPP(ArrayBufferConstructor) \ 292 CPP(ArrayBufferConstructor_ConstructStub) \ 293 CPP(ArrayBufferPrototypeGetByteLength) \ 294 CPP(ArrayBufferIsView) \ 295 \ 296 /* AsyncFunction */ \ 297 TFJ(AsyncFunctionAwaitCaught, 3) \ 298 TFJ(AsyncFunctionAwaitUncaught, 3) \ 299 TFJ(AsyncFunctionAwaitRejectClosure, 1) \ 300 TFJ(AsyncFunctionAwaitResolveClosure, 1) \ 301 TFJ(AsyncFunctionPromiseCreate, 0) \ 302 TFJ(AsyncFunctionPromiseRelease, 1) \ 303 \ 304 /* Boolean */ \ 305 CPP(BooleanConstructor) \ 306 CPP(BooleanConstructor_ConstructStub) \ 307 /* ES6 section 19.3.3.2 Boolean.prototype.toString ( ) */ \ 308 TFJ(BooleanPrototypeToString, 0) \ 309 /* ES6 section 19.3.3.3 Boolean.prototype.valueOf ( ) */ \ 310 TFJ(BooleanPrototypeValueOf, 0) \ 311 \ 312 /* CallSite */ \ 313 CPP(CallSitePrototypeGetColumnNumber) \ 314 CPP(CallSitePrototypeGetEvalOrigin) \ 315 CPP(CallSitePrototypeGetFileName) \ 316 CPP(CallSitePrototypeGetFunction) \ 317 CPP(CallSitePrototypeGetFunctionName) \ 318 CPP(CallSitePrototypeGetLineNumber) \ 319 CPP(CallSitePrototypeGetMethodName) \ 320 CPP(CallSitePrototypeGetPosition) \ 321 CPP(CallSitePrototypeGetScriptNameOrSourceURL) \ 322 CPP(CallSitePrototypeGetThis) \ 323 CPP(CallSitePrototypeGetTypeName) \ 324 CPP(CallSitePrototypeIsConstructor) \ 325 CPP(CallSitePrototypeIsEval) \ 326 CPP(CallSitePrototypeIsNative) \ 327 CPP(CallSitePrototypeIsToplevel) \ 328 CPP(CallSitePrototypeToString) \ 329 \ 330 /* DataView */ \ 331 CPP(DataViewConstructor) \ 332 CPP(DataViewConstructor_ConstructStub) \ 333 CPP(DataViewPrototypeGetBuffer) \ 334 CPP(DataViewPrototypeGetByteLength) \ 335 CPP(DataViewPrototypeGetByteOffset) \ 336 CPP(DataViewPrototypeGetInt8) \ 337 CPP(DataViewPrototypeSetInt8) \ 338 CPP(DataViewPrototypeGetUint8) \ 339 CPP(DataViewPrototypeSetUint8) \ 340 CPP(DataViewPrototypeGetInt16) \ 341 CPP(DataViewPrototypeSetInt16) \ 342 CPP(DataViewPrototypeGetUint16) \ 343 CPP(DataViewPrototypeSetUint16) \ 344 CPP(DataViewPrototypeGetInt32) \ 345 CPP(DataViewPrototypeSetInt32) \ 346 CPP(DataViewPrototypeGetUint32) \ 347 CPP(DataViewPrototypeSetUint32) \ 348 CPP(DataViewPrototypeGetFloat32) \ 349 CPP(DataViewPrototypeSetFloat32) \ 350 CPP(DataViewPrototypeGetFloat64) \ 351 CPP(DataViewPrototypeSetFloat64) \ 352 \ 353 /* Date */ \ 354 CPP(DateConstructor) \ 355 CPP(DateConstructor_ConstructStub) \ 356 /* ES6 section 20.3.4.2 Date.prototype.getDate ( ) */ \ 357 TFJ(DatePrototypeGetDate, 0) \ 358 /* ES6 section 20.3.4.3 Date.prototype.getDay ( ) */ \ 359 TFJ(DatePrototypeGetDay, 0) \ 360 /* ES6 section 20.3.4.4 Date.prototype.getFullYear ( ) */ \ 361 TFJ(DatePrototypeGetFullYear, 0) \ 362 /* ES6 section 20.3.4.5 Date.prototype.getHours ( ) */ \ 363 TFJ(DatePrototypeGetHours, 0) \ 364 /* ES6 section 20.3.4.6 Date.prototype.getMilliseconds ( ) */ \ 365 TFJ(DatePrototypeGetMilliseconds, 0) \ 366 /* ES6 section 20.3.4.7 Date.prototype.getMinutes ( ) */ \ 367 TFJ(DatePrototypeGetMinutes, 0) \ 368 /* ES6 section 20.3.4.8 Date.prototype.getMonth */ \ 369 TFJ(DatePrototypeGetMonth, 0) \ 370 /* ES6 section 20.3.4.9 Date.prototype.getSeconds ( ) */ \ 371 TFJ(DatePrototypeGetSeconds, 0) \ 372 /* ES6 section 20.3.4.10 Date.prototype.getTime ( ) */ \ 373 TFJ(DatePrototypeGetTime, 0) \ 374 /* ES6 section 20.3.4.11 Date.prototype.getTimezoneOffset ( ) */ \ 375 TFJ(DatePrototypeGetTimezoneOffset, 0) \ 376 /* ES6 section 20.3.4.12 Date.prototype.getUTCDate ( ) */ \ 377 TFJ(DatePrototypeGetUTCDate, 0) \ 378 /* ES6 section 20.3.4.13 Date.prototype.getUTCDay ( ) */ \ 379 TFJ(DatePrototypeGetUTCDay, 0) \ 380 /* ES6 section 20.3.4.14 Date.prototype.getUTCFullYear ( ) */ \ 381 TFJ(DatePrototypeGetUTCFullYear, 0) \ 382 /* ES6 section 20.3.4.15 Date.prototype.getUTCHours ( ) */ \ 383 TFJ(DatePrototypeGetUTCHours, 0) \ 384 /* ES6 section 20.3.4.16 Date.prototype.getUTCMilliseconds ( ) */ \ 385 TFJ(DatePrototypeGetUTCMilliseconds, 0) \ 386 /* ES6 section 20.3.4.17 Date.prototype.getUTCMinutes ( ) */ \ 387 TFJ(DatePrototypeGetUTCMinutes, 0) \ 388 /* ES6 section 20.3.4.18 Date.prototype.getUTCMonth ( ) */ \ 389 TFJ(DatePrototypeGetUTCMonth, 0) \ 390 /* ES6 section 20.3.4.19 Date.prototype.getUTCSeconds ( ) */ \ 391 TFJ(DatePrototypeGetUTCSeconds, 0) \ 392 /* ES6 section 20.3.4.44 Date.prototype.valueOf ( ) */ \ 393 TFJ(DatePrototypeValueOf, 0) \ 394 /* ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint ) */ \ 395 TFJ(DatePrototypeToPrimitive, 1) \ 396 CPP(DatePrototypeGetYear) \ 397 CPP(DatePrototypeSetYear) \ 398 CPP(DateNow) \ 399 CPP(DateParse) \ 400 CPP(DatePrototypeSetDate) \ 401 CPP(DatePrototypeSetFullYear) \ 402 CPP(DatePrototypeSetHours) \ 403 CPP(DatePrototypeSetMilliseconds) \ 404 CPP(DatePrototypeSetMinutes) \ 405 CPP(DatePrototypeSetMonth) \ 406 CPP(DatePrototypeSetSeconds) \ 407 CPP(DatePrototypeSetTime) \ 408 CPP(DatePrototypeSetUTCDate) \ 409 CPP(DatePrototypeSetUTCFullYear) \ 410 CPP(DatePrototypeSetUTCHours) \ 411 CPP(DatePrototypeSetUTCMilliseconds) \ 412 CPP(DatePrototypeSetUTCMinutes) \ 413 CPP(DatePrototypeSetUTCMonth) \ 414 CPP(DatePrototypeSetUTCSeconds) \ 415 CPP(DatePrototypeToDateString) \ 416 CPP(DatePrototypeToISOString) \ 417 CPP(DatePrototypeToUTCString) \ 418 CPP(DatePrototypeToString) \ 419 CPP(DatePrototypeToTimeString) \ 420 CPP(DatePrototypeToJson) \ 421 CPP(DateUTC) \ 422 \ 423 /* Error */ \ 424 CPP(ErrorConstructor) \ 425 CPP(ErrorCaptureStackTrace) \ 426 CPP(ErrorPrototypeToString) \ 427 CPP(MakeError) \ 428 CPP(MakeRangeError) \ 429 CPP(MakeSyntaxError) \ 430 CPP(MakeTypeError) \ 431 CPP(MakeURIError) \ 432 \ 433 /* Function */ \ 434 CPP(FunctionConstructor) \ 435 ASM(FunctionPrototypeApply) \ 436 CPP(FunctionPrototypeBind) \ 437 TFJ(FastFunctionPrototypeBind, \ 438 SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ 439 ASM(FunctionPrototypeCall) \ 440 /* ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V ) */ \ 441 TFJ(FunctionPrototypeHasInstance, 1) \ 442 CPP(FunctionPrototypeToString) \ 443 \ 444 /* Belongs to Objects but is a dependency of GeneratorPrototypeResume */ \ 445 TFS(CreateIterResultObject, BUILTIN, kNoExtraICState, \ 446 CreateIterResultObject, 1) \ 447 \ 448 /* Generator and Async */ \ 449 CPP(GeneratorFunctionConstructor) \ 450 /* ES6 section 25.3.1.2 Generator.prototype.next ( value ) */ \ 451 TFJ(GeneratorPrototypeNext, 1) \ 452 /* ES6 section 25.3.1.3 Generator.prototype.return ( value ) */ \ 453 TFJ(GeneratorPrototypeReturn, 1) \ 454 /* ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) */ \ 455 TFJ(GeneratorPrototypeThrow, 1) \ 456 CPP(AsyncFunctionConstructor) \ 457 \ 458 /* Global object */ \ 459 CPP(GlobalDecodeURI) \ 460 CPP(GlobalDecodeURIComponent) \ 461 CPP(GlobalEncodeURI) \ 462 CPP(GlobalEncodeURIComponent) \ 463 CPP(GlobalEscape) \ 464 CPP(GlobalUnescape) \ 465 CPP(GlobalEval) \ 466 /* ES6 section 18.2.2 isFinite ( number ) */ \ 467 TFJ(GlobalIsFinite, 1) \ 468 /* ES6 section 18.2.3 isNaN ( number ) */ \ 469 TFJ(GlobalIsNaN, 1) \ 470 \ 471 /* JSON */ \ 472 CPP(JsonParse) \ 473 CPP(JsonStringify) \ 474 \ 475 /* ICs */ \ 476 TFS(LoadIC, LOAD_IC, kNoExtraICState, LoadWithVector, 1) \ 477 TFS(LoadICTrampoline, LOAD_IC, kNoExtraICState, Load, 1) \ 478 TFS(KeyedLoadIC, KEYED_LOAD_IC, kNoExtraICState, LoadWithVector, 1) \ 479 TFS(KeyedLoadICTrampoline, KEYED_LOAD_IC, kNoExtraICState, Load, 1) \ 480 TFS(StoreIC, STORE_IC, kNoExtraICState, StoreWithVector, 1) \ 481 TFS(StoreICTrampoline, STORE_IC, kNoExtraICState, Store, 1) \ 482 TFS(StoreICStrict, STORE_IC, kNoExtraICState, StoreWithVector, 1) \ 483 TFS(StoreICStrictTrampoline, STORE_IC, kNoExtraICState, Store, 1) \ 484 TFS(KeyedStoreIC, KEYED_STORE_IC, kNoExtraICState, StoreWithVector, 1) \ 485 TFS(KeyedStoreICTrampoline, KEYED_STORE_IC, kNoExtraICState, Store, 1) \ 486 TFS(KeyedStoreICStrict, KEYED_STORE_IC, kNoExtraICState, StoreWithVector, 1) \ 487 TFS(KeyedStoreICStrictTrampoline, KEYED_STORE_IC, kNoExtraICState, Store, 1) \ 488 TFS(LoadGlobalIC, LOAD_GLOBAL_IC, kNoExtraICState, LoadGlobalWithVector, 1) \ 489 TFS(LoadGlobalICInsideTypeof, LOAD_GLOBAL_IC, kNoExtraICState, \ 490 LoadGlobalWithVector, 1) \ 491 TFS(LoadGlobalICTrampoline, LOAD_GLOBAL_IC, kNoExtraICState, LoadGlobal, 1) \ 492 TFS(LoadGlobalICInsideTypeofTrampoline, LOAD_GLOBAL_IC, kNoExtraICState, \ 493 LoadGlobal, 1) \ 494 \ 495 /* Math */ \ 496 /* ES6 section 20.2.2.1 Math.abs ( x ) */ \ 497 TFJ(MathAbs, 1) \ 498 /* ES6 section 20.2.2.2 Math.acos ( x ) */ \ 499 TFJ(MathAcos, 1) \ 500 /* ES6 section 20.2.2.3 Math.acosh ( x ) */ \ 501 TFJ(MathAcosh, 1) \ 502 /* ES6 section 20.2.2.4 Math.asin ( x ) */ \ 503 TFJ(MathAsin, 1) \ 504 /* ES6 section 20.2.2.5 Math.asinh ( x ) */ \ 505 TFJ(MathAsinh, 1) \ 506 /* ES6 section 20.2.2.6 Math.atan ( x ) */ \ 507 TFJ(MathAtan, 1) \ 508 /* ES6 section 20.2.2.7 Math.atanh ( x ) */ \ 509 TFJ(MathAtanh, 1) \ 510 /* ES6 section 20.2.2.8 Math.atan2 ( y, x ) */ \ 511 TFJ(MathAtan2, 2) \ 512 /* ES6 section 20.2.2.9 Math.cbrt ( x ) */ \ 513 TFJ(MathCbrt, 1) \ 514 /* ES6 section 20.2.2.10 Math.ceil ( x ) */ \ 515 TFJ(MathCeil, 1) \ 516 /* ES6 section 20.2.2.11 Math.clz32 ( x ) */ \ 517 TFJ(MathClz32, 1) \ 518 /* ES6 section 20.2.2.12 Math.cos ( x ) */ \ 519 TFJ(MathCos, 1) \ 520 /* ES6 section 20.2.2.13 Math.cosh ( x ) */ \ 521 TFJ(MathCosh, 1) \ 522 /* ES6 section 20.2.2.14 Math.exp ( x ) */ \ 523 TFJ(MathExp, 1) \ 524 /* ES6 section 20.2.2.15 Math.expm1 ( x ) */ \ 525 TFJ(MathExpm1, 1) \ 526 /* ES6 section 20.2.2.16 Math.floor ( x ) */ \ 527 TFJ(MathFloor, 1) \ 528 /* ES6 section 20.2.2.17 Math.fround ( x ) */ \ 529 TFJ(MathFround, 1) \ 530 /* ES6 section 20.2.2.18 Math.hypot ( value1, value2, ...values ) */ \ 531 CPP(MathHypot) \ 532 /* ES6 section 20.2.2.19 Math.imul ( x, y ) */ \ 533 TFJ(MathImul, 2) \ 534 /* ES6 section 20.2.2.20 Math.log ( x ) */ \ 535 TFJ(MathLog, 1) \ 536 /* ES6 section 20.2.2.21 Math.log1p ( x ) */ \ 537 TFJ(MathLog1p, 1) \ 538 /* ES6 section 20.2.2.22 Math.log10 ( x ) */ \ 539 TFJ(MathLog10, 1) \ 540 /* ES6 section 20.2.2.23 Math.log2 ( x ) */ \ 541 TFJ(MathLog2, 1) \ 542 /* ES6 section 20.2.2.24 Math.max ( value1, value2 , ...values ) */ \ 543 ASM(MathMax) \ 544 /* ES6 section 20.2.2.25 Math.min ( value1, value2 , ...values ) */ \ 545 ASM(MathMin) \ 546 /* ES6 section 20.2.2.26 Math.pow ( x, y ) */ \ 547 TFJ(MathPow, 2) \ 548 /* ES6 section 20.2.2.27 Math.random */ \ 549 TFJ(MathRandom, 0) \ 550 /* ES6 section 20.2.2.28 Math.round ( x ) */ \ 551 TFJ(MathRound, 1) \ 552 /* ES6 section 20.2.2.29 Math.sign ( x ) */ \ 553 TFJ(MathSign, 1) \ 554 /* ES6 section 20.2.2.30 Math.sin ( x ) */ \ 555 TFJ(MathSin, 1) \ 556 /* ES6 section 20.2.2.31 Math.sinh ( x ) */ \ 557 TFJ(MathSinh, 1) \ 558 /* ES6 section 20.2.2.32 Math.sqrt ( x ) */ \ 559 TFJ(MathTan, 1) \ 560 /* ES6 section 20.2.2.33 Math.tan ( x ) */ \ 561 TFJ(MathTanh, 1) \ 562 /* ES6 section 20.2.2.34 Math.tanh ( x ) */ \ 563 TFJ(MathSqrt, 1) \ 564 /* ES6 section 20.2.2.35 Math.trunc ( x ) */ \ 565 TFJ(MathTrunc, 1) \ 566 \ 567 /* Number */ \ 568 /* ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Call]] case */ \ 569 ASM(NumberConstructor) \ 570 /* ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Construct]] case */ \ 571 ASM(NumberConstructor_ConstructStub) \ 572 /* ES6 section 20.1.2.2 Number.isFinite ( number ) */ \ 573 TFJ(NumberIsFinite, 1) \ 574 /* ES6 section 20.1.2.3 Number.isInteger ( number ) */ \ 575 TFJ(NumberIsInteger, 1) \ 576 /* ES6 section 20.1.2.4 Number.isNaN ( number ) */ \ 577 TFJ(NumberIsNaN, 1) \ 578 /* ES6 section 20.1.2.5 Number.isSafeInteger ( number ) */ \ 579 TFJ(NumberIsSafeInteger, 1) \ 580 /* ES6 section 20.1.2.12 Number.parseFloat ( string ) */ \ 581 TFJ(NumberParseFloat, 1) \ 582 /* ES6 section 20.1.2.13 Number.parseInt ( string, radix ) */ \ 583 TFJ(NumberParseInt, 2) \ 584 CPP(NumberPrototypeToExponential) \ 585 CPP(NumberPrototypeToFixed) \ 586 CPP(NumberPrototypeToLocaleString) \ 587 CPP(NumberPrototypeToPrecision) \ 588 CPP(NumberPrototypeToString) \ 589 /* ES6 section 20.1.3.7 Number.prototype.valueOf ( ) */ \ 590 TFJ(NumberPrototypeValueOf, 0) \ 591 TFS(Add, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 592 TFS(Subtract, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 593 TFS(Multiply, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 594 TFS(Divide, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 595 TFS(Modulus, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 596 TFS(BitwiseAnd, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 597 TFS(BitwiseOr, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 598 TFS(BitwiseXor, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 599 TFS(ShiftLeft, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 600 TFS(ShiftRight, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 601 TFS(ShiftRightLogical, BUILTIN, kNoExtraICState, BinaryOp, 1) \ 602 TFS(LessThan, BUILTIN, kNoExtraICState, Compare, 1) \ 603 TFS(LessThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 604 TFS(GreaterThan, BUILTIN, kNoExtraICState, Compare, 1) \ 605 TFS(GreaterThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 606 TFS(Equal, BUILTIN, kNoExtraICState, Compare, 1) \ 607 TFS(NotEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 608 TFS(StrictEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 609 TFS(StrictNotEqual, BUILTIN, kNoExtraICState, Compare, 1) \ 610 \ 611 /* Object */ \ 612 CPP(ObjectAssign) \ 613 TFJ(ObjectCreate, 2) \ 614 CPP(ObjectDefineGetter) \ 615 CPP(ObjectDefineProperties) \ 616 CPP(ObjectDefineProperty) \ 617 CPP(ObjectDefineSetter) \ 618 CPP(ObjectEntries) \ 619 CPP(ObjectFreeze) \ 620 CPP(ObjectGetOwnPropertyDescriptor) \ 621 CPP(ObjectGetOwnPropertyDescriptors) \ 622 CPP(ObjectGetOwnPropertyNames) \ 623 CPP(ObjectGetOwnPropertySymbols) \ 624 CPP(ObjectGetPrototypeOf) \ 625 CPP(ObjectSetPrototypeOf) \ 626 /* ES6 section 19.1.3.2 Object.prototype.hasOwnProperty */ \ 627 TFJ(ObjectHasOwnProperty, 1) \ 628 CPP(ObjectIs) \ 629 CPP(ObjectIsExtensible) \ 630 CPP(ObjectIsFrozen) \ 631 CPP(ObjectIsSealed) \ 632 CPP(ObjectKeys) \ 633 CPP(ObjectLookupGetter) \ 634 CPP(ObjectLookupSetter) \ 635 CPP(ObjectPreventExtensions) \ 636 /* ES6 section 19.1.3.6 Object.prototype.toString () */ \ 637 TFJ(ObjectProtoToString, 0) \ 638 CPP(ObjectPrototypePropertyIsEnumerable) \ 639 CPP(ObjectPrototypeGetProto) \ 640 CPP(ObjectPrototypeSetProto) \ 641 CPP(ObjectSeal) \ 642 CPP(ObjectValues) \ 643 \ 644 /* instanceof */ \ 645 TFS(OrdinaryHasInstance, BUILTIN, kNoExtraICState, Compare, 1) \ 646 TFS(InstanceOf, BUILTIN, kNoExtraICState, Compare, 1) \ 647 \ 648 /* for-in */ \ 649 TFS(ForInFilter, BUILTIN, kNoExtraICState, ForInFilter, 1) \ 650 TFS(ForInNext, BUILTIN, kNoExtraICState, ForInNext, 1) \ 651 TFS(ForInPrepare, BUILTIN, kNoExtraICState, ForInPrepare, 3) \ 652 \ 653 /* Promise */ \ 654 TFJ(PromiseGetCapabilitiesExecutor, 2) \ 655 TFJ(NewPromiseCapability, 2) \ 656 TFJ(PromiseConstructor, 1) \ 657 TFJ(PromiseInternalConstructor, 1) \ 658 TFJ(IsPromise, 1) \ 659 TFJ(PromiseResolveClosure, 1) \ 660 TFJ(PromiseRejectClosure, 1) \ 661 TFJ(PromiseThen, 2) \ 662 TFJ(PromiseCatch, 1) \ 663 TFJ(ResolvePromise, 2) \ 664 TFS(PromiseHandleReject, BUILTIN, kNoExtraICState, PromiseHandleReject, 1) \ 665 TFJ(PromiseHandle, 5) \ 666 TFJ(PromiseResolve, 1) \ 667 TFJ(PromiseReject, 1) \ 668 TFJ(InternalPromiseReject, 3) \ 669 TFJ(PromiseFinally, 1) \ 670 TFJ(PromiseThenFinally, 1) \ 671 TFJ(PromiseCatchFinally, 1) \ 672 TFJ(PromiseValueThunkFinally, 0) \ 673 TFJ(PromiseThrowerFinally, 0) \ 674 \ 675 /* Proxy */ \ 676 CPP(ProxyConstructor) \ 677 CPP(ProxyConstructor_ConstructStub) \ 678 \ 679 /* Reflect */ \ 680 ASM(ReflectApply) \ 681 ASM(ReflectConstruct) \ 682 CPP(ReflectDefineProperty) \ 683 CPP(ReflectDeleteProperty) \ 684 CPP(ReflectGet) \ 685 CPP(ReflectGetOwnPropertyDescriptor) \ 686 CPP(ReflectGetPrototypeOf) \ 687 CPP(ReflectHas) \ 688 CPP(ReflectIsExtensible) \ 689 CPP(ReflectOwnKeys) \ 690 CPP(ReflectPreventExtensions) \ 691 CPP(ReflectSet) \ 692 CPP(ReflectSetPrototypeOf) \ 693 \ 694 /* RegExp */ \ 695 CPP(RegExpCapture1Getter) \ 696 CPP(RegExpCapture2Getter) \ 697 CPP(RegExpCapture3Getter) \ 698 CPP(RegExpCapture4Getter) \ 699 CPP(RegExpCapture5Getter) \ 700 CPP(RegExpCapture6Getter) \ 701 CPP(RegExpCapture7Getter) \ 702 CPP(RegExpCapture8Getter) \ 703 CPP(RegExpCapture9Getter) \ 704 TFJ(RegExpConstructor, 2) \ 705 TFJ(RegExpInternalMatch, 2) \ 706 CPP(RegExpInputGetter) \ 707 CPP(RegExpInputSetter) \ 708 CPP(RegExpLastMatchGetter) \ 709 CPP(RegExpLastParenGetter) \ 710 CPP(RegExpLeftContextGetter) \ 711 TFJ(RegExpPrototypeCompile, 2) \ 712 TFJ(RegExpPrototypeExec, 1) \ 713 TFJ(RegExpPrototypeFlagsGetter, 0) \ 714 TFJ(RegExpPrototypeGlobalGetter, 0) \ 715 TFJ(RegExpPrototypeIgnoreCaseGetter, 0) \ 716 TFJ(RegExpPrototypeMatch, 1) \ 717 TFJ(RegExpPrototypeMultilineGetter, 0) \ 718 TFJ(RegExpPrototypeSearch, 1) \ 719 TFJ(RegExpPrototypeSourceGetter, 0) \ 720 TFJ(RegExpPrototypeStickyGetter, 0) \ 721 TFJ(RegExpPrototypeTest, 1) \ 722 CPP(RegExpPrototypeToString) \ 723 TFJ(RegExpPrototypeUnicodeGetter, 0) \ 724 CPP(RegExpRightContextGetter) \ 725 \ 726 TFS(RegExpReplace, BUILTIN, kNoExtraICState, RegExpReplace, 1) \ 727 TFJ(RegExpPrototypeReplace, 2) \ 728 \ 729 TFS(RegExpSplit, BUILTIN, kNoExtraICState, RegExpSplit, 1) \ 730 TFJ(RegExpPrototypeSplit, 2) \ 731 \ 732 /* SharedArrayBuffer */ \ 733 CPP(SharedArrayBufferPrototypeGetByteLength) \ 734 TFJ(AtomicsLoad, 2) \ 735 TFJ(AtomicsStore, 3) \ 736 \ 737 /* String */ \ 738 ASM(StringConstructor) \ 739 ASM(StringConstructor_ConstructStub) \ 740 CPP(StringFromCodePoint) \ 741 /* ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) */ \ 742 TFJ(StringFromCharCode, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ 743 /* ES6 section 21.1.3.1 String.prototype.charAt ( pos ) */ \ 744 TFJ(StringPrototypeCharAt, 1) \ 745 /* ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) */ \ 746 TFJ(StringPrototypeCharCodeAt, 1) \ 747 /* ES6 section 21.1.3.6 */ \ 748 /* String.prototype.endsWith ( searchString [ , endPosition ] ) */ \ 749 CPP(StringPrototypeEndsWith) \ 750 /* ES6 section 21.1.3.7 */ \ 751 /* String.prototype.includes ( searchString [ , position ] ) */ \ 752 CPP(StringPrototypeIncludes) \ 753 /* ES6 section #sec-string.prototype.indexof */ \ 754 /* String.prototype.indexOf ( searchString [ , position ] ) */ \ 755 TFJ(StringPrototypeIndexOf, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ 756 /* ES6 section 21.1.3.9 */ \ 757 /* String.prototype.lastIndexOf ( searchString [ , position ] ) */ \ 758 CPP(StringPrototypeLastIndexOf) \ 759 /* ES6 section 21.1.3.10 String.prototype.localeCompare ( that ) */ \ 760 CPP(StringPrototypeLocaleCompare) \ 761 /* ES6 section 21.1.3.12 String.prototype.normalize ( [form] ) */ \ 762 CPP(StringPrototypeNormalize) \ 763 /* ES6 section 21.1.3.16 String.prototype.replace ( search, replace ) */ \ 764 TFJ(StringPrototypeReplace, 2) \ 765 /* ES6 section 21.1.3.19 String.prototype.split ( separator, limit ) */ \ 766 TFJ(StringPrototypeSplit, 2) \ 767 /* ES6 section B.2.3.1 String.prototype.substr ( start, length ) */ \ 768 TFJ(StringPrototypeSubstr, 2) \ 769 /* ES6 section 21.1.3.19 String.prototype.substring ( start, end ) */ \ 770 TFJ(StringPrototypeSubstring, 2) \ 771 /* ES6 section 21.1.3.20 */ \ 772 /* String.prototype.startsWith ( searchString [ , position ] ) */ \ 773 CPP(StringPrototypeStartsWith) \ 774 /* ES6 section 21.1.3.25 String.prototype.toString () */ \ 775 TFJ(StringPrototypeToString, 0) \ 776 /* ES #sec-string.prototype.tolocalelowercase */ \ 777 CPP(StringPrototypeToLocaleLowerCase) \ 778 /* ES #sec-string.prototype.tolocaleuppercase */ \ 779 CPP(StringPrototypeToLocaleUpperCase) \ 780 /* ES #sec-string.prototype.tolowercase */ \ 781 CPP(StringPrototypeToLowerCase) \ 782 /* ES #sec-string.prototype.touppercase */ \ 783 CPP(StringPrototypeToUpperCase) \ 784 CPP(StringPrototypeTrim) \ 785 CPP(StringPrototypeTrimLeft) \ 786 CPP(StringPrototypeTrimRight) \ 787 /* ES6 section 21.1.3.28 String.prototype.valueOf () */ \ 788 TFJ(StringPrototypeValueOf, 0) \ 789 /* ES6 #sec-string.prototype-@@iterator */ \ 790 TFJ(StringPrototypeIterator, 0) \ 791 \ 792 /* StringIterator */ \ 793 TFJ(StringIteratorPrototypeNext, 0) \ 794 \ 795 /* Symbol */ \ 796 CPP(SymbolConstructor) \ 797 CPP(SymbolConstructor_ConstructStub) \ 798 /* ES6 section 19.4.2.1 Symbol.for */ \ 799 CPP(SymbolFor) \ 800 /* ES6 section 19.4.2.5 Symbol.keyFor */ \ 801 CPP(SymbolKeyFor) \ 802 /* ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) */ \ 803 TFJ(SymbolPrototypeToPrimitive, 1) \ 804 /* ES6 section 19.4.3.2 Symbol.prototype.toString ( ) */ \ 805 TFJ(SymbolPrototypeToString, 0) \ 806 /* ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) */ \ 807 TFJ(SymbolPrototypeValueOf, 0) \ 808 \ 809 /* TypedArray */ \ 810 CPP(TypedArrayPrototypeBuffer) \ 811 /* ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength */ \ 812 TFJ(TypedArrayPrototypeByteLength, 0) \ 813 /* ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset */ \ 814 TFJ(TypedArrayPrototypeByteOffset, 0) \ 815 /* ES6 section 22.2.3.18 get %TypedArray%.prototype.length */ \ 816 TFJ(TypedArrayPrototypeLength, 0) \ 817 /* ES6 #sec-%typedarray%.prototype.entries */ \ 818 TFJ(TypedArrayPrototypeEntries, 0) \ 819 /* ES6 #sec-%typedarray%.prototype.keys */ \ 820 TFJ(TypedArrayPrototypeKeys, 0) \ 821 /* ES6 #sec-%typedarray%.prototype.values */ \ 822 TFJ(TypedArrayPrototypeValues, 0) \ 823 /* ES6 #sec-%typedarray%.prototype.copywithin */ \ 824 CPP(TypedArrayPrototypeCopyWithin) \ 825 \ 826 /* Wasm */ \ 827 TFS(WasmStackGuard, BUILTIN, kNoExtraICState, WasmRuntimeCall, 1) \ 828 TFS(ThrowWasmTrapUnreachable, BUILTIN, kNoExtraICState, WasmRuntimeCall, 1) \ 829 TFS(ThrowWasmTrapMemOutOfBounds, BUILTIN, kNoExtraICState, WasmRuntimeCall, \ 830 1) \ 831 TFS(ThrowWasmTrapDivByZero, BUILTIN, kNoExtraICState, WasmRuntimeCall, 1) \ 832 TFS(ThrowWasmTrapDivUnrepresentable, BUILTIN, kNoExtraICState, \ 833 WasmRuntimeCall, 1) \ 834 TFS(ThrowWasmTrapRemByZero, BUILTIN, kNoExtraICState, WasmRuntimeCall, 1) \ 835 TFS(ThrowWasmTrapFloatUnrepresentable, BUILTIN, kNoExtraICState, \ 836 WasmRuntimeCall, 1) \ 837 TFS(ThrowWasmTrapFuncInvalid, BUILTIN, kNoExtraICState, WasmRuntimeCall, 1) \ 838 TFS(ThrowWasmTrapFuncSigMismatch, BUILTIN, kNoExtraICState, WasmRuntimeCall, \ 839 1) \ 840 \ 841 /* Async-from-Sync Iterator */ \ 842 \ 843 /* %AsyncFromSyncIteratorPrototype% */ \ 844 /* (proposal-async-iteration/#sec-%asyncfromsynciteratorprototype%-object)*/ \ 845 TFJ(AsyncFromSyncIteratorPrototypeNext, 1) \ 846 TFJ(AsyncFromSyncIteratorPrototypeThrow, 1) \ 847 TFJ(AsyncFromSyncIteratorPrototypeReturn, 1) \ 848 \ 849 /* proposal-async-iteration/#sec-async-iterator-value-unwrap-functions */ \ 850 TFJ(AsyncIteratorValueUnwrap, 1) 851 852 #define IGNORE_BUILTIN(...) 853 854 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V) 855 856 #define BUILTIN_LIST_C(V) \ 857 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 858 IGNORE_BUILTIN, IGNORE_BUILTIN) 859 860 #define BUILTIN_LIST_A(V) \ 861 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 862 V, V, V) 863 864 #define BUILTIN_LIST_DBG(V) \ 865 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 866 IGNORE_BUILTIN, IGNORE_BUILTIN, V) 867 868 // Forward declarations. 869 class ObjectVisitor; 870 enum class InterpreterPushArgsMode : unsigned; 871 namespace compiler { 872 class CodeAssemblerState; 873 } 874 875 class Builtins { 876 public: 877 ~Builtins(); 878 879 // Generate all builtin code objects. Should be called once during 880 // isolate initialization. 881 void SetUp(Isolate* isolate, bool create_heap_objects); 882 void TearDown(); 883 884 // Garbage collection support. 885 void IterateBuiltins(ObjectVisitor* v); 886 887 // Disassembler support. 888 const char* Lookup(byte* pc); 889 890 enum Name : int32_t { 891 #define DEF_ENUM(Name, ...) k##Name, 892 BUILTIN_LIST_ALL(DEF_ENUM) 893 #undef DEF_ENUM 894 builtin_count 895 }; 896 897 #define DECLARE_BUILTIN_ACCESSOR(Name, ...) \ 898 V8_EXPORT_PRIVATE Handle<Code> Name(); 899 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR) 900 #undef DECLARE_BUILTIN_ACCESSOR 901 902 // Convenience wrappers. 903 Handle<Code> CallFunction( 904 ConvertReceiverMode = ConvertReceiverMode::kAny, 905 TailCallMode tail_call_mode = TailCallMode::kDisallow); 906 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, 907 TailCallMode tail_call_mode = TailCallMode::kDisallow); 908 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode); 909 Handle<Code> NonPrimitiveToPrimitive( 910 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); 911 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint); 912 Handle<Code> InterpreterPushArgsAndCall(TailCallMode tail_call_mode, 913 InterpreterPushArgsMode mode); 914 Handle<Code> InterpreterPushArgsAndConstruct(InterpreterPushArgsMode mode); 915 Handle<Code> NewFunctionContext(ScopeType scope_type); 916 Handle<Code> NewCloneShallowArray(AllocationSiteMode allocation_mode); 917 Handle<Code> NewCloneShallowObject(int length); 918 builtin(Name name)919 Code* builtin(Name name) { 920 // Code::cast cannot be used here since we access builtins 921 // during the marking phase of mark sweep. See IC::Clear. 922 return reinterpret_cast<Code*>(builtins_[name]); 923 } 924 builtin_address(Name name)925 Address builtin_address(Name name) { 926 return reinterpret_cast<Address>(&builtins_[name]); 927 } 928 929 static const char* name(int index); 930 931 // Returns the C++ entry point for builtins implemented in C++, and the null 932 // Address otherwise. 933 static Address CppEntryOf(int index); 934 935 static bool IsCpp(int index); 936 static bool IsApi(int index); 937 static bool HasCppImplementation(int index); 938 is_initialized()939 bool is_initialized() const { return initialized_; } 940 941 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction( 942 Isolate* isolate, bool is_construct, Handle<HeapObject> function, 943 Handle<Object> receiver, int argc, Handle<Object> args[], 944 Handle<HeapObject> new_target); 945 946 enum ExitFrameType { EXIT, BUILTIN_EXIT }; 947 948 static void Generate_Adaptor(MacroAssembler* masm, Address builtin_address, 949 ExitFrameType exit_frame_type); 950 951 static bool AllowDynamicFunction(Isolate* isolate, Handle<JSFunction> target, 952 Handle<JSObject> target_global_proxy); 953 954 private: 955 Builtins(); 956 957 static void Generate_CallFunction(MacroAssembler* masm, 958 ConvertReceiverMode mode, 959 TailCallMode tail_call_mode); 960 961 static void Generate_CallBoundFunctionImpl(MacroAssembler* masm, 962 TailCallMode tail_call_mode); 963 964 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, 965 TailCallMode tail_call_mode); 966 static void Generate_CallForwardVarargs(MacroAssembler* masm, 967 Handle<Code> code); 968 969 static void Generate_InterpreterPushArgsAndCallImpl( 970 MacroAssembler* masm, TailCallMode tail_call_mode, 971 InterpreterPushArgsMode mode); 972 973 static void Generate_InterpreterPushArgsAndConstructImpl( 974 MacroAssembler* masm, InterpreterPushArgsMode mode); 975 976 enum class MathMaxMinKind { kMax, kMin }; 977 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); 978 979 #define DECLARE_ASM(Name, ...) \ 980 static void Generate_##Name(MacroAssembler* masm); 981 #define DECLARE_TF(Name, ...) \ 982 static void Generate_##Name(compiler::CodeAssemblerState* state); 983 984 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF, 985 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM) 986 987 #undef DECLARE_ASM 988 #undef DECLARE_TF 989 990 // Note: These are always Code objects, but to conform with 991 // IterateBuiltins() above which assumes Object**'s for the callback 992 // function f, we use an Object* array here. 993 Object* builtins_[builtin_count]; 994 bool initialized_; 995 996 friend class Isolate; 997 998 DISALLOW_COPY_AND_ASSIGN(Builtins); 999 }; 1000 1001 } // namespace internal 1002 } // namespace v8 1003 1004 #endif // V8_BUILTINS_BUILTINS_H_ 1005