OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 /* Testing */ \ | 596 /* Testing */ \ |
597 F(ListNatives, 0, 1) | 597 F(ListNatives, 0, 1) |
598 #else | 598 #else |
599 #define RUNTIME_FUNCTION_LIST_DEBUG(F) | 599 #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
600 #endif | 600 #endif |
601 | 601 |
602 // ---------------------------------------------------------------------------- | 602 // ---------------------------------------------------------------------------- |
603 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed | 603 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
604 // either directly by id (via the code generator), or indirectly | 604 // either directly by id (via the code generator), or indirectly |
605 // via a native call by name (from within JS code). | 605 // via a native call by name (from within JS code). |
| 606 // Entries have the form F(name, number of arguments, number of return values). |
606 | 607 |
607 #define RUNTIME_FUNCTION_LIST(F) \ | 608 #define RUNTIME_FUNCTION_LIST(F) \ |
608 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ | 609 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
609 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 610 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
610 RUNTIME_FUNCTION_LIST_DEBUG(F) \ | 611 RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
611 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ | 612 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
612 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \ | 613 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) |
613 INLINE_RUNTIME_FUNCTION_LIST(F) | 614 |
| 615 // RUNTIME_HIDDEN_FUNCTION_LIST defines all runtime functions accessed |
| 616 // by id from code generator, but not via native call by name. |
| 617 // Entries have the form F(name, number of arguments, number of return values). |
| 618 #define RUNTIME_HIDDEN_FUNCTION_LIST(F) \ |
| 619 F(NumberToString, 1, 1) \ |
| 620 F(RegExpConstructResult, 3, 1) \ |
| 621 F(RegExpExec, 4, 1) \ |
| 622 F(StringAdd, 2, 1) \ |
| 623 F(SubString, 3, 1) \ |
| 624 F(StringCompare, 2, 1) \ |
| 625 F(StringCharCodeAt, 2, 1) \ |
| 626 F(Log, 3, 1) \ |
| 627 F(GetFromCache, 2, 1) |
614 | 628 |
615 // ---------------------------------------------------------------------------- | 629 // ---------------------------------------------------------------------------- |
616 // INLINE_FUNCTION_LIST defines all inlined functions accessed | 630 // INLINE_FUNCTION_LIST defines all inlined functions accessed |
617 // with a native call of the form %_name from within JS code. | 631 // with a native call of the form %_name from within JS code. |
618 // Entries have the form F(name, number of arguments, number of return values). | 632 // Entries have the form F(name, number of arguments, number of return values). |
619 #define INLINE_FUNCTION_LIST(F) \ | 633 #define INLINE_FUNCTION_LIST(F) \ |
620 F(IsSmi, 1, 1) \ | 634 F(IsSmi, 1, 1) \ |
621 F(IsNonNegativeSmi, 1, 1) \ | 635 F(IsNonNegativeSmi, 1, 1) \ |
622 F(IsArray, 1, 1) \ | 636 F(IsArray, 1, 1) \ |
623 F(IsRegExp, 1, 1) \ | 637 F(IsRegExp, 1, 1) \ |
(...skipping 17 matching lines...) Expand all Loading... |
641 F(MathPow, 2, 1) \ | 655 F(MathPow, 2, 1) \ |
642 F(MathSqrt, 1, 1) \ | 656 F(MathSqrt, 1, 1) \ |
643 F(MathLog, 1, 1) \ | 657 F(MathLog, 1, 1) \ |
644 F(IsMinusZero, 1, 1) \ | 658 F(IsMinusZero, 1, 1) \ |
645 F(HasCachedArrayIndex, 1, 1) \ | 659 F(HasCachedArrayIndex, 1, 1) \ |
646 F(GetCachedArrayIndex, 1, 1) \ | 660 F(GetCachedArrayIndex, 1, 1) \ |
647 F(FastAsciiArrayJoin, 2, 1) \ | 661 F(FastAsciiArrayJoin, 2, 1) \ |
648 F(GeneratorNext, 2, 1) \ | 662 F(GeneratorNext, 2, 1) \ |
649 F(GeneratorThrow, 2, 1) \ | 663 F(GeneratorThrow, 2, 1) \ |
650 F(DebugBreakInOptimizedCode, 0, 1) \ | 664 F(DebugBreakInOptimizedCode, 0, 1) \ |
651 INLINE_RUNTIME_FUNCTION_LIST(F) | |
652 | |
653 | |
654 // ---------------------------------------------------------------------------- | |
655 // INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed | |
656 // with a native call of the form %_name from within JS code that also have | |
657 // a corresponding runtime function, that is called for slow cases. | |
658 // Entries have the form F(name, number of arguments, number of return values). | |
659 #define INLINE_RUNTIME_FUNCTION_LIST(F) \ | |
660 F(ClassOf, 1, 1) \ | 665 F(ClassOf, 1, 1) \ |
661 F(StringCharCodeAt, 2, 1) \ | 666 F(StringCharCodeAt, 2, 1) \ |
662 F(Log, 3, 1) \ | 667 F(Log, 3, 1) \ |
663 F(StringAdd, 2, 1) \ | 668 F(StringAdd, 2, 1) \ |
664 F(SubString, 3, 1) \ | 669 F(SubString, 3, 1) \ |
665 F(StringCompare, 2, 1) \ | 670 F(StringCompare, 2, 1) \ |
666 F(RegExpExec, 4, 1) \ | 671 F(RegExpExec, 4, 1) \ |
667 F(RegExpConstructResult, 3, 1) \ | 672 F(RegExpConstructResult, 3, 1) \ |
668 F(GetFromCache, 2, 1) \ | 673 F(GetFromCache, 2, 1) \ |
669 F(NumberToString, 1, 1) \ | 674 F(NumberToString, 1, 1) |
| 675 |
| 676 |
| 677 // ---------------------------------------------------------------------------- |
| 678 // INLINE_OPTIMIZED_FUNCTION_LIST defines all inlined functions accessed |
| 679 // with a native call of the form %_name from within JS code that also have |
| 680 // a corresponding runtime function, that is called from non-optimized code. |
| 681 // Entries have the form F(name, number of arguments, number of return values). |
| 682 #define INLINE_OPTIMIZED_FUNCTION_LIST(F) \ |
670 F(DoubleHi, 1, 1) \ | 683 F(DoubleHi, 1, 1) \ |
671 F(DoubleLo, 1, 1) \ | 684 F(DoubleLo, 1, 1) \ |
672 F(ConstructDouble, 2, 1) \ | 685 F(ConstructDouble, 2, 1) \ |
673 F(TypedArrayInitialize, 5, 1) \ | 686 F(TypedArrayInitialize, 5, 1) \ |
674 F(DataViewInitialize, 4, 1) \ | 687 F(DataViewInitialize, 4, 1) \ |
675 F(MaxSmi, 0, 1) \ | 688 F(MaxSmi, 0, 1) \ |
676 F(TypedArrayMaxSizeInHeap, 0, 1) | 689 F(TypedArrayMaxSizeInHeap, 0, 1) |
677 | 690 |
678 | 691 |
679 //--------------------------------------------------------------------------- | 692 //--------------------------------------------------------------------------- |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | 733 DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
721 }; | 734 }; |
722 | 735 |
723 | 736 |
724 class Runtime : public AllStatic { | 737 class Runtime : public AllStatic { |
725 public: | 738 public: |
726 enum FunctionId { | 739 enum FunctionId { |
727 #define F(name, nargs, ressize) k##name, | 740 #define F(name, nargs, ressize) k##name, |
728 RUNTIME_FUNCTION_LIST(F) | 741 RUNTIME_FUNCTION_LIST(F) |
729 #undef F | 742 #undef F |
| 743 #define F(name, nargs, ressize) kHidden##name, |
| 744 RUNTIME_HIDDEN_FUNCTION_LIST(F) |
| 745 #undef F |
730 #define F(name, nargs, ressize) kInline##name, | 746 #define F(name, nargs, ressize) kInline##name, |
731 INLINE_FUNCTION_LIST(F) | 747 INLINE_FUNCTION_LIST(F) |
732 #undef F | 748 #undef F |
| 749 #define F(name, nargs, ressize) kInlineOptimized##name, |
| 750 INLINE_OPTIMIZED_FUNCTION_LIST(F) |
| 751 #undef F |
733 kNumFunctions, | 752 kNumFunctions, |
734 kFirstInlineFunction = kInlineIsSmi | 753 kFirstInlineFunction = kInlineIsSmi |
735 }; | 754 }; |
736 | 755 |
737 enum IntrinsicType { | 756 enum IntrinsicType { |
738 RUNTIME, | 757 RUNTIME, |
739 INLINE | 758 RUNTIME_HIDDEN, |
| 759 INLINE, |
| 760 INLINE_OPTIMIZED |
740 }; | 761 }; |
741 | 762 |
742 // Intrinsic function descriptor. | 763 // Intrinsic function descriptor. |
743 struct Function { | 764 struct Function { |
744 FunctionId function_id; | 765 FunctionId function_id; |
745 IntrinsicType intrinsic_type; | 766 IntrinsicType intrinsic_type; |
746 // The JS name of the function. | 767 // The JS name of the function. |
747 const char* name; | 768 const char* name; |
748 | 769 |
749 // The C++ (native) entry point. NULL if the function is inlined. | 770 // The C++ (native) entry point. NULL if the function is inlined. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; | 900 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; |
880 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; | 901 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; |
881 | 902 |
882 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; | 903 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
883 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; | 904 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
884 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; | 905 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; |
885 | 906 |
886 } } // namespace v8::internal | 907 } } // namespace v8::internal |
887 | 908 |
888 #endif // V8_RUNTIME_H_ | 909 #endif // V8_RUNTIME_H_ |
OLD | NEW |