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

Side by Side Diff: src/runtime/runtime.h

Issue 989273003: Converted FullCode to have its own list of known intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed comment. Rebased Created 5 years, 9 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
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | src/runtime/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_RUNTIME_RUNTIME_H_ 5 #ifndef V8_RUNTIME_RUNTIME_H_
6 #define V8_RUNTIME_RUNTIME_H_ 6 #define V8_RUNTIME_RUNTIME_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 // The interface to C++ runtime functions. 15 // The interface to C++ runtime functions.
16 16
17 // ---------------------------------------------------------------------------- 17 // ----------------------------------------------------------------------------
18 // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both
19 // release and debug mode.
20 // This macro should only be used by the macro RUNTIME_FUNCTION_LIST.
21
22 // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused 18 // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused
23 // MSVC Intellisense to crash. It was broken into two macros to work around 19 // MSVC Intellisense to crash. It was broken into two macros to work around
24 // this problem. Please avoid large recursive macros whenever possible. 20 // this problem. Please avoid large recursive macros whenever possible.
25 #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ 21 #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
26 /* Property access */ \ 22 /* Property access */ \
27 F(GetProperty, 2, 1) \ 23 F(GetProperty, 2, 1) \
28 F(KeyedGetProperty, 2, 1) \ 24 F(KeyedGetProperty, 2, 1) \
29 F(DeleteProperty, 3, 1) \ 25 F(DeleteProperty, 3, 1) \
30 F(HasOwnProperty, 2, 1) \ 26 F(HasOwnProperty, 2, 1) \
31 F(HasProperty, 2, 1) \ 27 F(HasProperty, 2, 1) \
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 F(BreakIteratorFirst, 1, 1) \ 619 F(BreakIteratorFirst, 1, 1) \
624 F(BreakIteratorNext, 1, 1) \ 620 F(BreakIteratorNext, 1, 1) \
625 F(BreakIteratorCurrent, 1, 1) \ 621 F(BreakIteratorCurrent, 1, 1) \
626 F(BreakIteratorBreakType, 1, 1) 622 F(BreakIteratorBreakType, 1, 1)
627 623
628 #else 624 #else
629 #define RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) 625 #define RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F)
630 #endif 626 #endif
631 627
632 628
633 // ----------------------------------------------------------------------------
634 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed
635 // either directly by id (via the code generator), or indirectly
636 // via a native call by name (from within JS code).
637 // Entries have the form F(name, number of arguments, number of return values).
638
639 #define RUNTIME_FUNCTION_LIST_RETURN_OBJECT(F) \ 629 #define RUNTIME_FUNCTION_LIST_RETURN_OBJECT(F) \
640 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ 630 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
641 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ 631 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
642 RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \ 632 RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \
643 RUNTIME_FUNCTION_LIST_DEBUGGER(F) \ 633 RUNTIME_FUNCTION_LIST_DEBUGGER(F) \
644 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) 634 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F)
645 635
646 636
637 // RUNTIME_FUNCTION_LIST_ defines the intrinsics typically implemented only
638 // as runtime functions. These come in 2 flavors, either returning an object or
639 // returning a pair.
640 // Entries have the form F(name, number of arguments, number of return values).
647 #define RUNTIME_FUNCTION_LIST(F) \ 641 #define RUNTIME_FUNCTION_LIST(F) \
648 RUNTIME_FUNCTION_LIST_RETURN_OBJECT(F) \ 642 RUNTIME_FUNCTION_LIST_RETURN_OBJECT(F) \
649 RUNTIME_FUNCTION_LIST_RETURN_PAIR(F) 643 RUNTIME_FUNCTION_LIST_RETURN_PAIR(F)
650 644
645
651 // ---------------------------------------------------------------------------- 646 // ----------------------------------------------------------------------------
652 // INLINE_FUNCTION_LIST defines all inlined functions accessed 647 // INLINE_FUNCTION_LIST defines the intrinsics typically handled specially by
653 // with a native call of the form %_name from within JS code. 648 // the various compilers.
654 // Entries have the form F(name, number of arguments, number of return values). 649 // Entries have the form F(name, number of arguments, number of return values).
655 #define INLINE_FUNCTION_LIST(F) \ 650 #define INLINE_FUNCTION_LIST(F) \
656 F(IsSmi, 1, 1) \ 651 F(IsSmi, 1, 1) \
657 F(IsNonNegativeSmi, 1, 1) \ 652 F(IsNonNegativeSmi, 1, 1) \
658 F(IsArray, 1, 1) \ 653 F(IsArray, 1, 1) \
659 F(IsRegExp, 1, 1) \ 654 F(IsRegExp, 1, 1) \
660 F(IsJSProxy, 1, 1) \ 655 F(IsJSProxy, 1, 1) \
661 F(IsConstructCall, 0, 1) \ 656 F(IsConstructCall, 0, 1) \
662 F(CallFunction, -1 /* receiver + n args + function */, 1) \ 657 F(CallFunction, -1 /* receiver + n args + function */, 1) \
663 F(DefaultConstructorCallSuper, 0, 1) \ 658 F(DefaultConstructorCallSuper, 0, 1) \
(...skipping 26 matching lines...) Expand all
690 F(SubString, 3, 1) \ 685 F(SubString, 3, 1) \
691 F(StringCompare, 2, 1) \ 686 F(StringCompare, 2, 1) \
692 F(RegExpExec, 4, 1) \ 687 F(RegExpExec, 4, 1) \
693 F(RegExpConstructResult, 3, 1) \ 688 F(RegExpConstructResult, 3, 1) \
694 F(GetFromCache, 2, 1) \ 689 F(GetFromCache, 2, 1) \
695 F(NumberToString, 1, 1) \ 690 F(NumberToString, 1, 1) \
696 F(DebugIsActive, 0, 1) 691 F(DebugIsActive, 0, 1)
697 692
698 693
699 // ---------------------------------------------------------------------------- 694 // ----------------------------------------------------------------------------
700 // INLINE_OPTIMIZED_FUNCTION_LIST defines all inlined functions accessed 695 // INLINE_OPTIMIZED_FUNCTION_LIST defines the intrinsics typically handled
701 // with a native call of the form %_name from within JS code that also have 696 // specially by Crankshaft.
702 // a corresponding runtime function, that is called from non-optimized code.
703 // For the benefit of (fuzz) tests, the runtime version can also be called
704 // directly as %name (i.e. without the leading underscore).
705 // Entries have the form F(name, number of arguments, number of return values). 697 // Entries have the form F(name, number of arguments, number of return values).
706 #define INLINE_OPTIMIZED_FUNCTION_LIST(F) \ 698 #define INLINE_OPTIMIZED_FUNCTION_LIST(F) \
707 /* Typed Arrays */ \ 699 /* Typed Arrays */ \
708 F(TypedArrayInitialize, 5, 1) \ 700 F(TypedArrayInitialize, 5, 1) \
709 F(DataViewInitialize, 4, 1) \ 701 F(DataViewInitialize, 4, 1) \
710 F(MaxSmi, 0, 1) \ 702 F(MaxSmi, 0, 1) \
711 F(TypedArrayMaxSizeInHeap, 0, 1) \ 703 F(TypedArrayMaxSizeInHeap, 0, 1) \
712 F(ArrayBufferViewGetByteLength, 1, 1) \ 704 F(ArrayBufferViewGetByteLength, 1, 1) \
713 F(ArrayBufferViewGetByteOffset, 1, 1) \ 705 F(ArrayBufferViewGetByteOffset, 1, 1) \
714 F(TypedArrayGetLength, 1, 1) \ 706 F(TypedArrayGetLength, 1, 1) \
(...skipping 18 matching lines...) Expand all
733 F(SetClear, 1, 1) \ 725 F(SetClear, 1, 1) \
734 F(SetDelete, 2, 1) \ 726 F(SetDelete, 2, 1) \
735 F(SetGetSize, 1, 1) \ 727 F(SetGetSize, 1, 1) \
736 F(SetHas, 2, 1) \ 728 F(SetHas, 2, 1) \
737 F(SetInitialize, 1, 1) \ 729 F(SetInitialize, 1, 1) \
738 /* Arrays */ \ 730 /* Arrays */ \
739 F(HasFastPackedElements, 1, 1) \ 731 F(HasFastPackedElements, 1, 1) \
740 F(GetPrototype, 1, 1) 732 F(GetPrototype, 1, 1)
741 733
742 734
735 #define FOR_EACH_INTRINSIC(F) \
736 RUNTIME_FUNCTION_LIST(F) \
737 INLINE_FUNCTION_LIST(F) \
738 INLINE_OPTIMIZED_FUNCTION_LIST(F)
739
743 //--------------------------------------------------------------------------- 740 //---------------------------------------------------------------------------
744 // Runtime provides access to all C++ runtime functions. 741 // Runtime provides access to all C++ runtime functions.
745 742
746 class RuntimeState { 743 class RuntimeState {
747 public: 744 public:
748 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { 745 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() {
749 return &to_upper_mapping_; 746 return &to_upper_mapping_;
750 } 747 }
751 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { 748 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() {
752 return &to_lower_mapping_; 749 return &to_lower_mapping_;
(...skipping 12 matching lines...) Expand all
765 762
766 763
767 class JavaScriptFrameIterator; // Forward declaration. 764 class JavaScriptFrameIterator; // Forward declaration.
768 765
769 766
770 class Runtime : public AllStatic { 767 class Runtime : public AllStatic {
771 public: 768 public:
772 enum FunctionId { 769 enum FunctionId {
773 #define F(name, nargs, ressize) k##name, 770 #define F(name, nargs, ressize) k##name,
774 #define I(name, nargs, ressize) kInline##name, 771 #define I(name, nargs, ressize) kInline##name,
775 RUNTIME_FUNCTION_LIST(F) INLINE_FUNCTION_LIST(F) 772 FOR_EACH_INTRINSIC(F) FOR_EACH_INTRINSIC(I)
776 INLINE_OPTIMIZED_FUNCTION_LIST(F) RUNTIME_FUNCTION_LIST(I)
777 INLINE_FUNCTION_LIST(I) INLINE_OPTIMIZED_FUNCTION_LIST(I)
778 #undef I 773 #undef I
779 #undef F 774 #undef F
780 kNumFunctions, 775 kNumFunctions,
781 // TODO(svenpanne) The values below are cruel hacks, remove them!
782 kFirstInlineFunction = kInlineIsSmi,
783 kLastInlineFunction = kInlineDebugIsActive
784 }; 776 };
785 777
786 enum IntrinsicType { RUNTIME, INLINE }; 778 enum IntrinsicType { RUNTIME, INLINE };
787 779
788 // Intrinsic function descriptor. 780 // Intrinsic function descriptor.
789 struct Function { 781 struct Function {
790 FunctionId function_id; 782 FunctionId function_id;
791 IntrinsicType intrinsic_type; 783 IntrinsicType intrinsic_type;
792 // The JS name of the function. 784 // The JS name of the function.
793 const char* name; 785 const char* name;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 896
905 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; 897 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {};
906 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; 898 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {};
907 STATIC_ASSERT(LANGUAGE_END == 3); 899 STATIC_ASSERT(LANGUAGE_END == 3);
908 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; 900 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {};
909 901
910 } // namespace internal 902 } // namespace internal
911 } // namespace v8 903 } // namespace v8
912 904
913 #endif // V8_RUNTIME_RUNTIME_H_ 905 #endif // V8_RUNTIME_RUNTIME_H_
OLDNEW
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | src/runtime/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698