| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2011 the V8 project authors. All rights reserved. | 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 | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #ifndef V8_BUILTINS_H_ | 6 #ifndef V8_BUILTINS_H_ |
| 7 #define V8_BUILTINS_H_ | 7 #define V8_BUILTINS_H_ |
| 8 | 8 |
| 9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
| 10 #include "src/handles.h" | 10 #include "src/handles.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 V(ArraySlice, BUILTIN_EXIT) \ | 51 V(ArraySlice, BUILTIN_EXIT) \ |
| 52 V(ArraySplice, BUILTIN_EXIT) \ | 52 V(ArraySplice, BUILTIN_EXIT) \ |
| 53 V(ArrayUnshift, BUILTIN_EXIT) \ | 53 V(ArrayUnshift, BUILTIN_EXIT) \ |
| 54 \ | 54 \ |
| 55 V(ArrayBufferConstructor, BUILTIN_EXIT) \ | 55 V(ArrayBufferConstructor, BUILTIN_EXIT) \ |
| 56 V(ArrayBufferConstructor_ConstructStub, BUILTIN_EXIT) \ | 56 V(ArrayBufferConstructor_ConstructStub, BUILTIN_EXIT) \ |
| 57 V(ArrayBufferIsView, BUILTIN_EXIT) \ | 57 V(ArrayBufferIsView, BUILTIN_EXIT) \ |
| 58 \ | 58 \ |
| 59 V(BooleanConstructor, BUILTIN_EXIT) \ | 59 V(BooleanConstructor, BUILTIN_EXIT) \ |
| 60 V(BooleanConstructor_ConstructStub, BUILTIN_EXIT) \ | 60 V(BooleanConstructor_ConstructStub, BUILTIN_EXIT) \ |
| 61 V(BooleanPrototypeToString, BUILTIN_EXIT) \ |
| 62 V(BooleanPrototypeValueOf, BUILTIN_EXIT) \ |
| 61 \ | 63 \ |
| 62 V(DataViewConstructor, BUILTIN_EXIT) \ | 64 V(DataViewConstructor, BUILTIN_EXIT) \ |
| 63 V(DataViewConstructor_ConstructStub, BUILTIN_EXIT) \ | 65 V(DataViewConstructor_ConstructStub, BUILTIN_EXIT) \ |
| 64 V(DataViewPrototypeGetBuffer, BUILTIN_EXIT) \ | 66 V(DataViewPrototypeGetBuffer, BUILTIN_EXIT) \ |
| 65 V(DataViewPrototypeGetByteLength, BUILTIN_EXIT) \ | 67 V(DataViewPrototypeGetByteLength, BUILTIN_EXIT) \ |
| 66 V(DataViewPrototypeGetByteOffset, BUILTIN_EXIT) \ | 68 V(DataViewPrototypeGetByteOffset, BUILTIN_EXIT) \ |
| 67 \ | 69 \ |
| 68 V(DateConstructor, BUILTIN_EXIT) \ | 70 V(DateConstructor, BUILTIN_EXIT) \ |
| 69 V(DateConstructor_ConstructStub, BUILTIN_EXIT) \ | 71 V(DateConstructor_ConstructStub, BUILTIN_EXIT) \ |
| 70 V(DateNow, BUILTIN_EXIT) \ | 72 V(DateNow, BUILTIN_EXIT) \ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 V(GlobalEscape, BUILTIN_EXIT) \ | 112 V(GlobalEscape, BUILTIN_EXIT) \ |
| 111 V(GlobalUnescape, BUILTIN_EXIT) \ | 113 V(GlobalUnescape, BUILTIN_EXIT) \ |
| 112 \ | 114 \ |
| 113 V(GlobalEval, BUILTIN_EXIT) \ | 115 V(GlobalEval, BUILTIN_EXIT) \ |
| 114 \ | 116 \ |
| 115 V(JsonParse, BUILTIN_EXIT) \ | 117 V(JsonParse, BUILTIN_EXIT) \ |
| 116 V(JsonStringify, BUILTIN_EXIT) \ | 118 V(JsonStringify, BUILTIN_EXIT) \ |
| 117 \ | 119 \ |
| 118 V(MathHypot, BUILTIN_EXIT) \ | 120 V(MathHypot, BUILTIN_EXIT) \ |
| 119 \ | 121 \ |
| 120 V(NumberPrototypeToExponential, BUILTIN_EXIT) \ | |
| 121 V(NumberPrototypeToFixed, BUILTIN_EXIT) \ | |
| 122 V(NumberPrototypeToPrecision, BUILTIN_EXIT) \ | |
| 123 V(NumberPrototypeToString, BUILTIN_EXIT) \ | |
| 124 \ | |
| 125 V(ObjectAssign, BUILTIN_EXIT) \ | 122 V(ObjectAssign, BUILTIN_EXIT) \ |
| 126 V(ObjectCreate, BUILTIN_EXIT) \ | 123 V(ObjectCreate, BUILTIN_EXIT) \ |
| 127 V(ObjectDefineGetter, BUILTIN_EXIT) \ | 124 V(ObjectDefineGetter, BUILTIN_EXIT) \ |
| 128 V(ObjectDefineProperties, BUILTIN_EXIT) \ | 125 V(ObjectDefineProperties, BUILTIN_EXIT) \ |
| 129 V(ObjectDefineProperty, BUILTIN_EXIT) \ | 126 V(ObjectDefineProperty, BUILTIN_EXIT) \ |
| 130 V(ObjectDefineSetter, BUILTIN_EXIT) \ | 127 V(ObjectDefineSetter, BUILTIN_EXIT) \ |
| 131 V(ObjectEntries, BUILTIN_EXIT) \ | 128 V(ObjectEntries, BUILTIN_EXIT) \ |
| 132 V(ObjectFreeze, BUILTIN_EXIT) \ | 129 V(ObjectFreeze, BUILTIN_EXIT) \ |
| 133 V(ObjectGetOwnPropertyDescriptor, BUILTIN_EXIT) \ | 130 V(ObjectGetOwnPropertyDescriptor, BUILTIN_EXIT) \ |
| 134 V(ObjectGetOwnPropertyDescriptors, BUILTIN_EXIT) \ | 131 V(ObjectGetOwnPropertyDescriptors, BUILTIN_EXIT) \ |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 V(InterruptCheck, BUILTIN, kNoExtraICState) \ | 293 V(InterruptCheck, BUILTIN, kNoExtraICState) \ |
| 297 V(StackCheck, BUILTIN, kNoExtraICState) \ | 294 V(StackCheck, BUILTIN, kNoExtraICState) \ |
| 298 \ | 295 \ |
| 299 V(MarkCodeAsToBeExecutedOnce, BUILTIN, kNoExtraICState) \ | 296 V(MarkCodeAsToBeExecutedOnce, BUILTIN, kNoExtraICState) \ |
| 300 V(MarkCodeAsExecutedOnce, BUILTIN, kNoExtraICState) \ | 297 V(MarkCodeAsExecutedOnce, BUILTIN, kNoExtraICState) \ |
| 301 V(MarkCodeAsExecutedTwice, BUILTIN, kNoExtraICState) \ | 298 V(MarkCodeAsExecutedTwice, BUILTIN, kNoExtraICState) \ |
| 302 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) | 299 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) |
| 303 | 300 |
| 304 // Define list of builtins implemented in TurboFan (with JS linkage). | 301 // Define list of builtins implemented in TurboFan (with JS linkage). |
| 305 #define BUILTIN_LIST_T(V) \ | 302 #define BUILTIN_LIST_T(V) \ |
| 306 V(BooleanPrototypeToString, 1) \ | |
| 307 V(BooleanPrototypeValueOf, 1) \ | |
| 308 V(FunctionPrototypeHasInstance, 2) \ | 303 V(FunctionPrototypeHasInstance, 2) \ |
| 309 V(GeneratorPrototypeNext, 2) \ | 304 V(GeneratorPrototypeNext, 2) \ |
| 310 V(GeneratorPrototypeReturn, 2) \ | 305 V(GeneratorPrototypeReturn, 2) \ |
| 311 V(GeneratorPrototypeThrow, 2) \ | 306 V(GeneratorPrototypeThrow, 2) \ |
| 312 V(MathAcos, 2) \ | 307 V(MathAcos, 2) \ |
| 313 V(MathAcosh, 2) \ | 308 V(MathAcosh, 2) \ |
| 314 V(MathAsin, 2) \ | 309 V(MathAsin, 2) \ |
| 315 V(MathAsinh, 2) \ | 310 V(MathAsinh, 2) \ |
| 316 V(MathAtan, 2) \ | 311 V(MathAtan, 2) \ |
| 317 V(MathAtanh, 2) \ | 312 V(MathAtanh, 2) \ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 333 V(MathLog2, 2) \ | 328 V(MathLog2, 2) \ |
| 334 V(MathRound, 2) \ | 329 V(MathRound, 2) \ |
| 335 V(MathPow, 3) \ | 330 V(MathPow, 3) \ |
| 336 V(MathSign, 2) \ | 331 V(MathSign, 2) \ |
| 337 V(MathSin, 2) \ | 332 V(MathSin, 2) \ |
| 338 V(MathSinh, 2) \ | 333 V(MathSinh, 2) \ |
| 339 V(MathTan, 2) \ | 334 V(MathTan, 2) \ |
| 340 V(MathTanh, 2) \ | 335 V(MathTanh, 2) \ |
| 341 V(MathSqrt, 2) \ | 336 V(MathSqrt, 2) \ |
| 342 V(MathTrunc, 2) \ | 337 V(MathTrunc, 2) \ |
| 343 V(NumberPrototypeValueOf, 1) \ | |
| 344 V(ObjectHasOwnProperty, 2) \ | 338 V(ObjectHasOwnProperty, 2) \ |
| 345 V(ArrayIsArray, 2) \ | 339 V(ArrayIsArray, 2) \ |
| 346 V(StringFromCharCode, 2) \ | 340 V(StringFromCharCode, 2) \ |
| 347 V(StringPrototypeCharAt, 2) \ | 341 V(StringPrototypeCharAt, 2) \ |
| 348 V(StringPrototypeCharCodeAt, 2) \ | 342 V(StringPrototypeCharCodeAt, 2) \ |
| 349 V(StringPrototypeToString, 1) \ | |
| 350 V(StringPrototypeValueOf, 1) \ | |
| 351 V(SymbolPrototypeToPrimitive, 2) \ | |
| 352 V(SymbolPrototypeToString, 1) \ | |
| 353 V(SymbolPrototypeValueOf, 1) \ | |
| 354 V(TypedArrayPrototypeByteLength, 1) \ | 343 V(TypedArrayPrototypeByteLength, 1) \ |
| 355 V(TypedArrayPrototypeByteOffset, 1) \ | 344 V(TypedArrayPrototypeByteOffset, 1) \ |
| 356 V(TypedArrayPrototypeLength, 1) \ | 345 V(TypedArrayPrototypeLength, 1) \ |
| 357 V(AtomicsLoad, 3) \ | 346 V(AtomicsLoad, 3) \ |
| 358 V(AtomicsStore, 4) | 347 V(AtomicsStore, 4) |
| 359 | 348 |
| 360 // Define list of builtins implemented in TurboFan (with CallStub linkage). | 349 // Define list of builtins implemented in TurboFan (with CallStub linkage). |
| 361 #define BUILTIN_LIST_S(V) \ | 350 #define BUILTIN_LIST_S(V) \ |
| 362 V(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector) \ | 351 V(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector) \ |
| 363 V(LoadGlobalIC_SlowNotInsideTypeof, HANDLER, Code::LOAD_GLOBAL_IC, \ | 352 V(LoadGlobalIC_SlowNotInsideTypeof, HANDLER, Code::LOAD_GLOBAL_IC, \ |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 static void Generate_ConstructFunction(MacroAssembler* masm); | 583 static void Generate_ConstructFunction(MacroAssembler* masm); |
| 595 // ES6 section 9.4.1.2 [[Construct]] (argumentsList, newTarget) | 584 // ES6 section 9.4.1.2 [[Construct]] (argumentsList, newTarget) |
| 596 static void Generate_ConstructBoundFunction(MacroAssembler* masm); | 585 static void Generate_ConstructBoundFunction(MacroAssembler* masm); |
| 597 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) | 586 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) |
| 598 static void Generate_ConstructProxy(MacroAssembler* masm); | 587 static void Generate_ConstructProxy(MacroAssembler* masm); |
| 599 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) | 588 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) |
| 600 static void Generate_Construct(MacroAssembler* masm); | 589 static void Generate_Construct(MacroAssembler* masm); |
| 601 | 590 |
| 602 static void Generate_HandleFastApiCall(MacroAssembler* masm); | 591 static void Generate_HandleFastApiCall(MacroAssembler* masm); |
| 603 | 592 |
| 604 // ES6 section 19.3.3.2 Boolean.prototype.toString ( ) | |
| 605 static void Generate_BooleanPrototypeToString(CodeStubAssembler* assembler); | |
| 606 // ES6 section 19.3.3.3 Boolean.prototype.valueOf ( ) | |
| 607 static void Generate_BooleanPrototypeValueOf(CodeStubAssembler* assembler); | |
| 608 | |
| 609 static void Generate_DatePrototype_GetField(MacroAssembler* masm, | 593 static void Generate_DatePrototype_GetField(MacroAssembler* masm, |
| 610 int field_index); | 594 int field_index); |
| 611 // ES6 section 20.3.4.2 Date.prototype.getDate ( ) | 595 // ES6 section 20.3.4.2 Date.prototype.getDate ( ) |
| 612 static void Generate_DatePrototypeGetDate(MacroAssembler* masm); | 596 static void Generate_DatePrototypeGetDate(MacroAssembler* masm); |
| 613 // ES6 section 20.3.4.3 Date.prototype.getDay ( ) | 597 // ES6 section 20.3.4.3 Date.prototype.getDay ( ) |
| 614 static void Generate_DatePrototypeGetDay(MacroAssembler* masm); | 598 static void Generate_DatePrototypeGetDay(MacroAssembler* masm); |
| 615 // ES6 section 20.3.4.4 Date.prototype.getFullYear ( ) | 599 // ES6 section 20.3.4.4 Date.prototype.getFullYear ( ) |
| 616 static void Generate_DatePrototypeGetFullYear(MacroAssembler* masm); | 600 static void Generate_DatePrototypeGetFullYear(MacroAssembler* masm); |
| 617 // ES6 section 20.3.4.5 Date.prototype.getHours ( ) | 601 // ES6 section 20.3.4.5 Date.prototype.getHours ( ) |
| 618 static void Generate_DatePrototypeGetHours(MacroAssembler* masm); | 602 static void Generate_DatePrototypeGetHours(MacroAssembler* masm); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 static void Generate_MathTan(CodeStubAssembler* assembler); | 708 static void Generate_MathTan(CodeStubAssembler* assembler); |
| 725 // ES6 section 20.2.2.34 Math.tanh ( x ) | 709 // ES6 section 20.2.2.34 Math.tanh ( x ) |
| 726 static void Generate_MathTanh(CodeStubAssembler* assembler); | 710 static void Generate_MathTanh(CodeStubAssembler* assembler); |
| 727 // ES6 section 20.2.2.35 Math.trunc ( x ) | 711 // ES6 section 20.2.2.35 Math.trunc ( x ) |
| 728 static void Generate_MathTrunc(CodeStubAssembler* assembler); | 712 static void Generate_MathTrunc(CodeStubAssembler* assembler); |
| 729 | 713 |
| 730 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Call]] case. | 714 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Call]] case. |
| 731 static void Generate_NumberConstructor(MacroAssembler* masm); | 715 static void Generate_NumberConstructor(MacroAssembler* masm); |
| 732 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Construct]] case. | 716 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Construct]] case. |
| 733 static void Generate_NumberConstructor_ConstructStub(MacroAssembler* masm); | 717 static void Generate_NumberConstructor_ConstructStub(MacroAssembler* masm); |
| 734 // ES6 section 20.1.3.7 Number.prototype.valueOf ( ) | |
| 735 static void Generate_NumberPrototypeValueOf(CodeStubAssembler* assembler); | |
| 736 | 718 |
| 737 // ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V ) | 719 // ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V ) |
| 738 static void Generate_FunctionPrototypeHasInstance( | 720 static void Generate_FunctionPrototypeHasInstance( |
| 739 CodeStubAssembler* assembler); | 721 CodeStubAssembler* assembler); |
| 740 | 722 |
| 741 // ES6 section 25.3.1.2 Generator.prototype.next ( value ) | 723 // ES6 section 25.3.1.2 Generator.prototype.next ( value ) |
| 742 static void Generate_GeneratorPrototypeNext(CodeStubAssembler* assembler); | 724 static void Generate_GeneratorPrototypeNext(CodeStubAssembler* assembler); |
| 743 // ES6 section 25.3.1.3 Generator.prototype.return ( value ) | 725 // ES6 section 25.3.1.3 Generator.prototype.return ( value ) |
| 744 static void Generate_GeneratorPrototypeReturn(CodeStubAssembler* assembler); | 726 static void Generate_GeneratorPrototypeReturn(CodeStubAssembler* assembler); |
| 745 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) | 727 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) |
| 746 static void Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler); | 728 static void Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler); |
| 747 | 729 |
| 748 // ES6 section 19.1.3.2 Object.prototype.hasOwnProperty | 730 // ES6 section 19.1.3.2 Object.prototype.hasOwnProperty |
| 749 static void Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler); | 731 static void Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler); |
| 750 | 732 |
| 751 // ES6 section 22.1.2.2 Array.isArray | 733 // ES6 section 22.1.2.2 Array.isArray |
| 752 static void Generate_ArrayIsArray(CodeStubAssembler* assembler); | 734 static void Generate_ArrayIsArray(CodeStubAssembler* assembler); |
| 753 | 735 |
| 754 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) | 736 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) |
| 755 static void Generate_StringFromCharCode(CodeStubAssembler* assembler); | 737 static void Generate_StringFromCharCode(CodeStubAssembler* assembler); |
| 756 // ES6 section 21.1.3.1 String.prototype.charAt ( pos ) | 738 // ES6 section 21.1.3.1 String.prototype.charAt ( pos ) |
| 757 static void Generate_StringPrototypeCharAt(CodeStubAssembler* assembler); | 739 static void Generate_StringPrototypeCharAt(CodeStubAssembler* assembler); |
| 758 // ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) | 740 // ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) |
| 759 static void Generate_StringPrototypeCharCodeAt(CodeStubAssembler* assembler); | 741 static void Generate_StringPrototypeCharCodeAt(CodeStubAssembler* assembler); |
| 760 // ES6 section 21.1.3.25 String.prototype.toString () | |
| 761 static void Generate_StringPrototypeToString(CodeStubAssembler* assembler); | |
| 762 // ES6 section 21.1.3.28 String.prototype.valueOf () | |
| 763 static void Generate_StringPrototypeValueOf(CodeStubAssembler* assembler); | |
| 764 | 742 |
| 765 static void Generate_StringConstructor(MacroAssembler* masm); | 743 static void Generate_StringConstructor(MacroAssembler* masm); |
| 766 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); | 744 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); |
| 767 | 745 |
| 768 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) | |
| 769 static void Generate_SymbolPrototypeToPrimitive(CodeStubAssembler* assembler); | |
| 770 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) | |
| 771 static void Generate_SymbolPrototypeToString(CodeStubAssembler* assembler); | |
| 772 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) | |
| 773 static void Generate_SymbolPrototypeValueOf(CodeStubAssembler* assembler); | |
| 774 | |
| 775 // ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength | 746 // ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength |
| 776 static void Generate_TypedArrayPrototypeByteLength( | 747 static void Generate_TypedArrayPrototypeByteLength( |
| 777 CodeStubAssembler* assembler); | 748 CodeStubAssembler* assembler); |
| 778 // ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset | 749 // ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset |
| 779 static void Generate_TypedArrayPrototypeByteOffset( | 750 static void Generate_TypedArrayPrototypeByteOffset( |
| 780 CodeStubAssembler* assembler); | 751 CodeStubAssembler* assembler); |
| 781 // ES6 section 22.2.3.18 get %TypedArray%.prototype.length | 752 // ES6 section 22.2.3.18 get %TypedArray%.prototype.length |
| 782 static void Generate_TypedArrayPrototypeLength(CodeStubAssembler* assembler); | 753 static void Generate_TypedArrayPrototypeLength(CodeStubAssembler* assembler); |
| 783 | 754 |
| 784 static void Generate_OnStackReplacement(MacroAssembler* masm); | 755 static void Generate_OnStackReplacement(MacroAssembler* masm); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 friend class BuiltinFunctionTable; | 792 friend class BuiltinFunctionTable; |
| 822 friend class Isolate; | 793 friend class Isolate; |
| 823 | 794 |
| 824 DISALLOW_COPY_AND_ASSIGN(Builtins); | 795 DISALLOW_COPY_AND_ASSIGN(Builtins); |
| 825 }; | 796 }; |
| 826 | 797 |
| 827 } // namespace internal | 798 } // namespace internal |
| 828 } // namespace v8 | 799 } // namespace v8 |
| 829 | 800 |
| 830 #endif // V8_BUILTINS_H_ | 801 #endif // V8_BUILTINS_H_ |
| OLD | NEW |