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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 /* Testing */ \ | 586 /* Testing */ \ |
587 F(ListNatives, 0, 1) | 587 F(ListNatives, 0, 1) |
588 #else | 588 #else |
589 #define RUNTIME_FUNCTION_LIST_DEBUG(F) | 589 #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
590 #endif | 590 #endif |
591 | 591 |
592 // ---------------------------------------------------------------------------- | 592 // ---------------------------------------------------------------------------- |
593 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed | 593 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
594 // either directly by id (via the code generator), or indirectly | 594 // either directly by id (via the code generator), or indirectly |
595 // via a native call by name (from within JS code). | 595 // via a native call by name (from within JS code). |
596 // Entries have the form F(name, number of arguments, number of return values). | |
596 | 597 |
597 #define RUNTIME_FUNCTION_LIST(F) \ | 598 #define RUNTIME_FUNCTION_LIST(F) \ |
598 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ | 599 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
599 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 600 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
600 RUNTIME_FUNCTION_LIST_DEBUG(F) \ | 601 RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
601 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ | 602 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
602 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \ | 603 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) |
603 INLINE_RUNTIME_FUNCTION_LIST(F) | 604 |
605 // RUNTIME_HIDDEN_FUNCTION_LIST defined all runtime functions accessed | |
Yang
2014/03/25 13:19:59
s/defined/defines/
| |
606 // by id from code generator, but not via native call by name. | |
607 // Entries have the form F(name, number of arguments, number of return values). | |
608 #define RUNTIME_HIDDEN_FUNCTION_LIST(F) \ | |
609 F(NumberToString, 1, 1) \ | |
610 F(RegExpConstructResult, 3, 1) \ | |
611 F(RegExpExec, 4, 1) \ | |
612 F(StringAdd, 2, 1) \ | |
613 F(SubString, 3, 1) \ | |
614 F(StringCompare, 2, 1) \ | |
615 F(StringCharCodeAt, 2, 1) \ | |
616 F(Log, 3, 1) \ | |
617 F(GetFromCache, 2, 1) | |
604 | 618 |
605 // ---------------------------------------------------------------------------- | 619 // ---------------------------------------------------------------------------- |
606 // INLINE_FUNCTION_LIST defines all inlined functions accessed | 620 // INLINE_FUNCTION_LIST defines all inlined functions accessed |
607 // with a native call of the form %_name from within JS code. | 621 // with a native call of the form %_name from within JS code. |
608 // Entries have the form F(name, number of arguments, number of return values). | 622 // Entries have the form F(name, number of arguments, number of return values). |
609 #define INLINE_FUNCTION_LIST(F) \ | 623 #define INLINE_FUNCTION_LIST(F) \ |
610 F(IsSmi, 1, 1) \ | 624 F(IsSmi, 1, 1) \ |
611 F(IsNonNegativeSmi, 1, 1) \ | 625 F(IsNonNegativeSmi, 1, 1) \ |
612 F(IsArray, 1, 1) \ | 626 F(IsArray, 1, 1) \ |
613 F(IsRegExp, 1, 1) \ | 627 F(IsRegExp, 1, 1) \ |
(...skipping 17 matching lines...) Expand all Loading... | |
631 F(MathPow, 2, 1) \ | 645 F(MathPow, 2, 1) \ |
632 F(MathSqrt, 1, 1) \ | 646 F(MathSqrt, 1, 1) \ |
633 F(MathLog, 1, 1) \ | 647 F(MathLog, 1, 1) \ |
634 F(IsMinusZero, 1, 1) \ | 648 F(IsMinusZero, 1, 1) \ |
635 F(HasCachedArrayIndex, 1, 1) \ | 649 F(HasCachedArrayIndex, 1, 1) \ |
636 F(GetCachedArrayIndex, 1, 1) \ | 650 F(GetCachedArrayIndex, 1, 1) \ |
637 F(FastAsciiArrayJoin, 2, 1) \ | 651 F(FastAsciiArrayJoin, 2, 1) \ |
638 F(GeneratorNext, 2, 1) \ | 652 F(GeneratorNext, 2, 1) \ |
639 F(GeneratorThrow, 2, 1) \ | 653 F(GeneratorThrow, 2, 1) \ |
640 F(DebugBreakInOptimizedCode, 0, 1) \ | 654 F(DebugBreakInOptimizedCode, 0, 1) \ |
641 INLINE_RUNTIME_FUNCTION_LIST(F) | |
642 | |
643 | |
644 // ---------------------------------------------------------------------------- | |
645 // INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed | |
646 // with a native call of the form %_name from within JS code that also have | |
647 // a corresponding runtime function, that is called for slow cases. | |
648 // Entries have the form F(name, number of arguments, number of return values). | |
649 #define INLINE_RUNTIME_FUNCTION_LIST(F) \ | |
650 F(ClassOf, 1, 1) \ | 655 F(ClassOf, 1, 1) \ |
651 F(StringCharCodeAt, 2, 1) \ | 656 F(StringCharCodeAt, 2, 1) \ |
652 F(Log, 3, 1) \ | 657 F(Log, 3, 1) \ |
653 F(StringAdd, 2, 1) \ | 658 F(StringAdd, 2, 1) \ |
654 F(SubString, 3, 1) \ | 659 F(SubString, 3, 1) \ |
655 F(StringCompare, 2, 1) \ | 660 F(StringCompare, 2, 1) \ |
656 F(RegExpExec, 4, 1) \ | 661 F(RegExpExec, 4, 1) \ |
657 F(RegExpConstructResult, 3, 1) \ | 662 F(RegExpConstructResult, 3, 1) \ |
658 F(GetFromCache, 2, 1) \ | 663 F(GetFromCache, 2, 1) \ |
659 F(NumberToString, 1, 1) \ | 664 F(NumberToString, 1, 1) |
665 | |
666 | |
667 // ---------------------------------------------------------------------------- | |
668 // INLINE_OPTIMIZED_FUNCTION_LIST defines all inlined functions accessed | |
669 // with a native call of the form %_name from within JS code that also have | |
670 // a corresponding runtime function, that is called from non-optimized code. | |
671 // Entries have the form F(name, number of arguments, number of return values). | |
672 #define INLINE_OPTIMIZED_FUNCTION_LIST(F) \ | |
660 F(DoubleHi, 1, 1) \ | 673 F(DoubleHi, 1, 1) \ |
661 F(DoubleLo, 1, 1) \ | 674 F(DoubleLo, 1, 1) \ |
662 F(ConstructDouble, 2, 1) \ | 675 F(ConstructDouble, 2, 1) \ |
663 F(TypedArrayInitialize, 5, 1) \ | 676 F(TypedArrayInitialize, 5, 1) \ |
664 F(DataViewInitialize, 4, 1) \ | 677 F(DataViewInitialize, 4, 1) \ |
665 F(MaxSmi, 0, 1) | 678 F(MaxSmi, 0, 1) |
666 | 679 |
667 | 680 |
668 //--------------------------------------------------------------------------- | 681 //--------------------------------------------------------------------------- |
669 // Runtime provides access to all C++ runtime functions. | 682 // Runtime provides access to all C++ runtime functions. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
709 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | 722 DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
710 }; | 723 }; |
711 | 724 |
712 | 725 |
713 class Runtime : public AllStatic { | 726 class Runtime : public AllStatic { |
714 public: | 727 public: |
715 enum FunctionId { | 728 enum FunctionId { |
716 #define F(name, nargs, ressize) k##name, | 729 #define F(name, nargs, ressize) k##name, |
717 RUNTIME_FUNCTION_LIST(F) | 730 RUNTIME_FUNCTION_LIST(F) |
718 #undef F | 731 #undef F |
732 #define F(name, nargs, ressize) kHidden##name, | |
733 RUNTIME_HIDDEN_FUNCTION_LIST(F) | |
734 #undef F | |
719 #define F(name, nargs, ressize) kInline##name, | 735 #define F(name, nargs, ressize) kInline##name, |
720 INLINE_FUNCTION_LIST(F) | 736 INLINE_FUNCTION_LIST(F) |
721 #undef F | 737 #undef F |
738 #define F(name, nargs, ressize) kInlineOptimized##name, | |
739 INLINE_OPTIMIZED_FUNCTION_LIST(F) | |
740 #undef F | |
722 kNumFunctions, | 741 kNumFunctions, |
723 kFirstInlineFunction = kInlineIsSmi | 742 kFirstInlineFunction = kInlineIsSmi |
724 }; | 743 }; |
725 | 744 |
726 enum IntrinsicType { | 745 enum IntrinsicType { |
727 RUNTIME, | 746 RUNTIME, |
728 INLINE | 747 RUNTIME_HIDDEN, |
748 INLINE, | |
749 INLINE_OPTIMIZED | |
729 }; | 750 }; |
730 | 751 |
731 // Intrinsic function descriptor. | 752 // Intrinsic function descriptor. |
732 struct Function { | 753 struct Function { |
733 FunctionId function_id; | 754 FunctionId function_id; |
734 IntrinsicType intrinsic_type; | 755 IntrinsicType intrinsic_type; |
735 // The JS name of the function. | 756 // The JS name of the function. |
736 const char* name; | 757 const char* name; |
737 | 758 |
738 // The C++ (native) entry point. NULL if the function is inlined. | 759 // The C++ (native) entry point. NULL if the function is inlined. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; | 891 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; |
871 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; | 892 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; |
872 | 893 |
873 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; | 894 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
874 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; | 895 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
875 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; | 896 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; |
876 | 897 |
877 } } // namespace v8::internal | 898 } } // namespace v8::internal |
878 | 899 |
879 #endif // V8_RUNTIME_H_ | 900 #endif // V8_RUNTIME_H_ |
OLD | NEW |