Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/builtins.h

Issue 2116753002: [builtins] Unify most of the remaining Math builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2102223005
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 V(GlobalEncodeURI, BUILTIN_EXIT) \ 110 V(GlobalEncodeURI, BUILTIN_EXIT) \
111 V(GlobalEncodeURIComponent, BUILTIN_EXIT) \ 111 V(GlobalEncodeURIComponent, BUILTIN_EXIT) \
112 V(GlobalEscape, BUILTIN_EXIT) \ 112 V(GlobalEscape, BUILTIN_EXIT) \
113 V(GlobalUnescape, BUILTIN_EXIT) \ 113 V(GlobalUnescape, BUILTIN_EXIT) \
114 \ 114 \
115 V(GlobalEval, BUILTIN_EXIT) \ 115 V(GlobalEval, BUILTIN_EXIT) \
116 \ 116 \
117 V(JsonParse, BUILTIN_EXIT) \ 117 V(JsonParse, BUILTIN_EXIT) \
118 V(JsonStringify, BUILTIN_EXIT) \ 118 V(JsonStringify, BUILTIN_EXIT) \
119 \ 119 \
120 V(MathAcos, BUILTIN_EXIT) \
121 V(MathAsin, BUILTIN_EXIT) \
122 V(MathFround, BUILTIN_EXIT) \
123 V(MathHypot, BUILTIN_EXIT) \ 120 V(MathHypot, BUILTIN_EXIT) \
124 V(MathImul, BUILTIN_EXIT) \
125 \ 121 \
126 V(ObjectAssign, BUILTIN_EXIT) \ 122 V(ObjectAssign, BUILTIN_EXIT) \
127 V(ObjectCreate, BUILTIN_EXIT) \ 123 V(ObjectCreate, BUILTIN_EXIT) \
128 V(ObjectDefineGetter, BUILTIN_EXIT) \ 124 V(ObjectDefineGetter, BUILTIN_EXIT) \
129 V(ObjectDefineProperties, BUILTIN_EXIT) \ 125 V(ObjectDefineProperties, BUILTIN_EXIT) \
130 V(ObjectDefineProperty, BUILTIN_EXIT) \ 126 V(ObjectDefineProperty, BUILTIN_EXIT) \
131 V(ObjectDefineSetter, BUILTIN_EXIT) \ 127 V(ObjectDefineSetter, BUILTIN_EXIT) \
132 V(ObjectEntries, BUILTIN_EXIT) \ 128 V(ObjectEntries, BUILTIN_EXIT) \
133 V(ObjectFreeze, BUILTIN_EXIT) \ 129 V(ObjectFreeze, BUILTIN_EXIT) \
134 V(ObjectGetOwnPropertyDescriptor, BUILTIN_EXIT) \ 130 V(ObjectGetOwnPropertyDescriptor, BUILTIN_EXIT) \
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 V(MarkCodeAsExecutedOnce, BUILTIN, kNoExtraICState) \ 296 V(MarkCodeAsExecutedOnce, BUILTIN, kNoExtraICState) \
301 V(MarkCodeAsExecutedTwice, BUILTIN, kNoExtraICState) \ 297 V(MarkCodeAsExecutedTwice, BUILTIN, kNoExtraICState) \
302 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V) 298 CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V)
303 299
304 // Define list of builtins implemented in TurboFan (with JS linkage). 300 // Define list of builtins implemented in TurboFan (with JS linkage).
305 #define BUILTIN_LIST_T(V) \ 301 #define BUILTIN_LIST_T(V) \
306 V(FunctionPrototypeHasInstance, 2) \ 302 V(FunctionPrototypeHasInstance, 2) \
307 V(GeneratorPrototypeNext, 2) \ 303 V(GeneratorPrototypeNext, 2) \
308 V(GeneratorPrototypeReturn, 2) \ 304 V(GeneratorPrototypeReturn, 2) \
309 V(GeneratorPrototypeThrow, 2) \ 305 V(GeneratorPrototypeThrow, 2) \
306 V(MathAcos, 2) \
307 V(MathAcosh, 2) \
308 V(MathAsin, 2) \
309 V(MathAsinh, 2) \
310 V(MathAtan, 2) \ 310 V(MathAtan, 2) \
311 V(MathAtanh, 2) \
311 V(MathAtan2, 3) \ 312 V(MathAtan2, 3) \
312 V(MathAtanh, 2) \
313 V(MathCeil, 2) \ 313 V(MathCeil, 2) \
314 V(MathCbrt, 2) \ 314 V(MathCbrt, 2) \
315 V(MathAbs, 2) \ 315 V(MathAbs, 2) \
316 V(MathExpm1, 2) \ 316 V(MathExpm1, 2) \
317 V(MathClz32, 2) \ 317 V(MathClz32, 2) \
318 V(MathCos, 2) \ 318 V(MathCos, 2) \
319 V(MathCosh, 2) \ 319 V(MathCosh, 2) \
320 V(MathExp, 2) \ 320 V(MathExp, 2) \
321 V(MathFloor, 2) \ 321 V(MathFloor, 2) \
322 V(MathFround, 2) \
323 V(MathImul, 3) \
322 V(MathLog, 2) \ 324 V(MathLog, 2) \
323 V(MathLog1p, 2) \ 325 V(MathLog1p, 2) \
324 V(MathLog10, 2) \ 326 V(MathLog10, 2) \
325 V(MathLog2, 2) \ 327 V(MathLog2, 2) \
326 V(MathRound, 2) \ 328 V(MathRound, 2) \
327 V(MathPow, 3) \ 329 V(MathPow, 3) \
330 V(MathSign, 2) \
328 V(MathSin, 2) \ 331 V(MathSin, 2) \
329 V(MathSinh, 2) \ 332 V(MathSinh, 2) \
330 V(MathTan, 2) \ 333 V(MathTan, 2) \
331 V(MathTanh, 2) \ 334 V(MathTanh, 2) \
332 V(MathSqrt, 2) \ 335 V(MathSqrt, 2) \
333 V(MathTrunc, 2) \ 336 V(MathTrunc, 2) \
334 V(ObjectHasOwnProperty, 2) \ 337 V(ObjectHasOwnProperty, 2) \
335 V(ArrayIsArray, 2) \ 338 V(ArrayIsArray, 2) \
336 V(StringFromCharCode, 2) \ 339 V(StringFromCharCode, 2) \
337 V(StringPrototypeCharAt, 2) \ 340 V(StringPrototypeCharAt, 2) \
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 static void Generate_FunctionPrototypeCall(MacroAssembler* masm); 631 static void Generate_FunctionPrototypeCall(MacroAssembler* masm);
629 632
630 static void Generate_ReflectApply(MacroAssembler* masm); 633 static void Generate_ReflectApply(MacroAssembler* masm);
631 static void Generate_ReflectConstruct(MacroAssembler* masm); 634 static void Generate_ReflectConstruct(MacroAssembler* masm);
632 635
633 static void Generate_InternalArrayCode(MacroAssembler* masm); 636 static void Generate_InternalArrayCode(MacroAssembler* masm);
634 static void Generate_ArrayCode(MacroAssembler* masm); 637 static void Generate_ArrayCode(MacroAssembler* masm);
635 638
636 // ES6 section 20.2.2.1 Math.abs ( x ) 639 // ES6 section 20.2.2.1 Math.abs ( x )
637 static void Generate_MathAbs(CodeStubAssembler* assembler); 640 static void Generate_MathAbs(CodeStubAssembler* assembler);
641 // ES6 section 20.2.2.2 Math.acos ( x )
642 static void Generate_MathAcos(CodeStubAssembler* assembler);
643 // ES6 section 20.2.2.3 Math.acosh ( x )
644 static void Generate_MathAcosh(CodeStubAssembler* assembler);
645 // ES6 section 20.2.2.4 Math.asin ( x )
646 static void Generate_MathAsin(CodeStubAssembler* assembler);
647 // ES6 section 20.2.2.5 Math.asinh ( x )
648 static void Generate_MathAsinh(CodeStubAssembler* assembler);
638 // ES6 section 20.2.2.6 Math.atan ( x ) 649 // ES6 section 20.2.2.6 Math.atan ( x )
639 static void Generate_MathAtan(CodeStubAssembler* assembler); 650 static void Generate_MathAtan(CodeStubAssembler* assembler);
651 // ES6 section 20.2.2.7 Math.atanh ( x )
652 static void Generate_MathAtanh(CodeStubAssembler* assembler);
640 // ES6 section 20.2.2.8 Math.atan2 ( y, x ) 653 // ES6 section 20.2.2.8 Math.atan2 ( y, x )
641 static void Generate_MathAtan2(CodeStubAssembler* assembler); 654 static void Generate_MathAtan2(CodeStubAssembler* assembler);
642 // ES6 section 20.2.2.7 Math.atanh ( x )
643 static void Generate_MathAtanh(CodeStubAssembler* assembler);
644 // ES6 section 20.2.2.10 Math.ceil ( x ) 655 // ES6 section 20.2.2.10 Math.ceil ( x )
645 static void Generate_MathCeil(CodeStubAssembler* assembler); 656 static void Generate_MathCeil(CodeStubAssembler* assembler);
646 // ES6 section 20.2.2.9 Math.ceil ( x ) 657 // ES6 section 20.2.2.9 Math.ceil ( x )
647 static void Generate_MathCbrt(CodeStubAssembler* assembler); 658 static void Generate_MathCbrt(CodeStubAssembler* assembler);
648 // ES6 section 20.2.2.15 Math.expm1 ( x ) 659 // ES6 section 20.2.2.15 Math.expm1 ( x )
649 static void Generate_MathExpm1(CodeStubAssembler* assembler); 660 static void Generate_MathExpm1(CodeStubAssembler* assembler);
650 // ES6 section 20.2.2.11 Math.clz32 ( x ) 661 // ES6 section 20.2.2.11 Math.clz32 ( x )
651 static void Generate_MathClz32(CodeStubAssembler* assembler); 662 static void Generate_MathClz32(CodeStubAssembler* assembler);
652 // ES6 section 20.2.2.12 Math.cos ( x ) 663 // ES6 section 20.2.2.12 Math.cos ( x )
653 static void Generate_MathCos(CodeStubAssembler* assembler); 664 static void Generate_MathCos(CodeStubAssembler* assembler);
654 // ES6 section 20.2.2.13 Math.cosh ( x ) 665 // ES6 section 20.2.2.13 Math.cosh ( x )
655 static void Generate_MathCosh(CodeStubAssembler* assembler); 666 static void Generate_MathCosh(CodeStubAssembler* assembler);
656 // ES6 section 20.2.2.14 Math.exp ( x ) 667 // ES6 section 20.2.2.14 Math.exp ( x )
657 static void Generate_MathExp(CodeStubAssembler* assembler); 668 static void Generate_MathExp(CodeStubAssembler* assembler);
658 // ES6 section 20.2.2.16 Math.floor ( x ) 669 // ES6 section 20.2.2.16 Math.floor ( x )
659 static void Generate_MathFloor(CodeStubAssembler* assembler); 670 static void Generate_MathFloor(CodeStubAssembler* assembler);
671 // ES6 section 20.2.2.17 Math.fround ( x )
672 static void Generate_MathFround(CodeStubAssembler* assembler);
673 // ES6 section 20.2.2.20 Math.imul ( x, y )
674 static void Generate_MathImul(CodeStubAssembler* assembler);
660 // ES6 section 20.2.2.20 Math.log ( x ) 675 // ES6 section 20.2.2.20 Math.log ( x )
661 static void Generate_MathLog(CodeStubAssembler* assembler); 676 static void Generate_MathLog(CodeStubAssembler* assembler);
662 // ES6 section 20.2.2.21 Math.log ( x ) 677 // ES6 section 20.2.2.21 Math.log ( x )
663 static void Generate_MathLog1p(CodeStubAssembler* assembler); 678 static void Generate_MathLog1p(CodeStubAssembler* assembler);
664 679
665 static void Generate_MathLog2(CodeStubAssembler* assembler); 680 static void Generate_MathLog2(CodeStubAssembler* assembler);
666 static void Generate_MathLog10(CodeStubAssembler* assembler); 681 static void Generate_MathLog10(CodeStubAssembler* assembler);
667 682
668 enum class MathMaxMinKind { kMax, kMin }; 683 enum class MathMaxMinKind { kMax, kMin };
669 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); 684 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind);
670 // ES6 section 20.2.2.24 Math.max ( value1, value2 , ...values ) 685 // ES6 section 20.2.2.24 Math.max ( value1, value2 , ...values )
671 static void Generate_MathMax(MacroAssembler* masm) { 686 static void Generate_MathMax(MacroAssembler* masm) {
672 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); 687 Generate_MathMaxMin(masm, MathMaxMinKind::kMax);
673 } 688 }
674 // ES6 section 20.2.2.25 Math.min ( value1, value2 , ...values ) 689 // ES6 section 20.2.2.25 Math.min ( value1, value2 , ...values )
675 static void Generate_MathMin(MacroAssembler* masm) { 690 static void Generate_MathMin(MacroAssembler* masm) {
676 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); 691 Generate_MathMaxMin(masm, MathMaxMinKind::kMin);
677 } 692 }
678 // ES6 section 20.2.2.26 Math.pow ( x, y ) 693 // ES6 section 20.2.2.26 Math.pow ( x, y )
679 static void Generate_MathPow(CodeStubAssembler* assembler); 694 static void Generate_MathPow(CodeStubAssembler* assembler);
680 // ES6 section 20.2.2.28 Math.round ( x ) 695 // ES6 section 20.2.2.28 Math.round ( x )
681 static void Generate_MathRound(CodeStubAssembler* assembler); 696 static void Generate_MathRound(CodeStubAssembler* assembler);
682 // ES6 section 20.2.2.20 Math.sin ( x ) 697 // ES6 section 20.2.2.29 Math.sign ( x )
698 static void Generate_MathSign(CodeStubAssembler* assembler);
699 // ES6 section 20.2.2.30 Math.sin ( x )
683 static void Generate_MathSin(CodeStubAssembler* assembler); 700 static void Generate_MathSin(CodeStubAssembler* assembler);
684 // ES6 section 20.2.2.21 Math.sinh ( x ) 701 // ES6 section 20.2.2.31 Math.sinh ( x )
685 static void Generate_MathSinh(CodeStubAssembler* assembler); 702 static void Generate_MathSinh(CodeStubAssembler* assembler);
686 // ES6 section 20.2.2.32 Math.sqrt ( x ) 703 // ES6 section 20.2.2.32 Math.sqrt ( x )
687 static void Generate_MathSqrt(CodeStubAssembler* assembler); 704 static void Generate_MathSqrt(CodeStubAssembler* assembler);
688 // ES6 section 20.2.2.33 Math.tan ( x ) 705 // ES6 section 20.2.2.33 Math.tan ( x )
689 static void Generate_MathTan(CodeStubAssembler* assembler); 706 static void Generate_MathTan(CodeStubAssembler* assembler);
690 // ES6 section 20.2.2.34 Math.tanh ( x ) 707 // ES6 section 20.2.2.34 Math.tanh ( x )
691 static void Generate_MathTanh(CodeStubAssembler* assembler); 708 static void Generate_MathTanh(CodeStubAssembler* assembler);
692 // ES6 section 20.2.2.35 Math.trunc ( x ) 709 // ES6 section 20.2.2.35 Math.trunc ( x )
693 static void Generate_MathTrunc(CodeStubAssembler* assembler); 710 static void Generate_MathTrunc(CodeStubAssembler* assembler);
694 711
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 friend class BuiltinFunctionTable; 790 friend class BuiltinFunctionTable;
774 friend class Isolate; 791 friend class Isolate;
775 792
776 DISALLOW_COPY_AND_ASSIGN(Builtins); 793 DISALLOW_COPY_AND_ASSIGN(Builtins);
777 }; 794 };
778 795
779 } // namespace internal 796 } // namespace internal
780 } // namespace v8 797 } // namespace v8
781 798
782 #endif // V8_BUILTINS_H_ 799 #endif // V8_BUILTINS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698