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