OLD | NEW |
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_GLOBALS_H_ | 5 #ifndef V8_GLOBALS_H_ |
6 #define V8_GLOBALS_H_ | 6 #define V8_GLOBALS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 777 |
778 enum Signedness { kSigned, kUnsigned }; | 778 enum Signedness { kSigned, kUnsigned }; |
779 | 779 |
780 | 780 |
781 enum FunctionKind { | 781 enum FunctionKind { |
782 kNormalFunction = 0, | 782 kNormalFunction = 0, |
783 kArrowFunction = 1, | 783 kArrowFunction = 1, |
784 kGeneratorFunction = 2, | 784 kGeneratorFunction = 2, |
785 kConciseMethod = 4, | 785 kConciseMethod = 4, |
786 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 786 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
787 kDefaultConstructor = 8, | 787 kDefaultConstructor = 8 |
788 kDefaultConstructorCallSuper = 16 | |
789 }; | 788 }; |
790 | 789 |
791 | 790 |
792 inline bool IsValidFunctionKind(FunctionKind kind) { | 791 inline bool IsValidFunctionKind(FunctionKind kind) { |
793 return kind == FunctionKind::kNormalFunction || | 792 return kind == FunctionKind::kNormalFunction || |
794 kind == FunctionKind::kArrowFunction || | 793 kind == FunctionKind::kArrowFunction || |
795 kind == FunctionKind::kGeneratorFunction || | 794 kind == FunctionKind::kGeneratorFunction || |
796 kind == FunctionKind::kConciseMethod || | 795 kind == FunctionKind::kConciseMethod || |
797 kind == FunctionKind::kConciseGeneratorMethod || | 796 kind == FunctionKind::kConciseGeneratorMethod || |
798 kind == FunctionKind::kDefaultConstructor || | 797 kind == FunctionKind::kDefaultConstructor; |
799 kind == FunctionKind::kDefaultConstructorCallSuper; | |
800 } | 798 } |
801 | 799 |
802 | 800 |
803 inline bool IsArrowFunction(FunctionKind kind) { | 801 inline bool IsArrowFunction(FunctionKind kind) { |
804 DCHECK(IsValidFunctionKind(kind)); | 802 DCHECK(IsValidFunctionKind(kind)); |
805 return kind & FunctionKind::kArrowFunction; | 803 return kind & FunctionKind::kArrowFunction; |
806 } | 804 } |
807 | 805 |
808 | 806 |
809 inline bool IsGeneratorFunction(FunctionKind kind) { | 807 inline bool IsGeneratorFunction(FunctionKind kind) { |
810 DCHECK(IsValidFunctionKind(kind)); | 808 DCHECK(IsValidFunctionKind(kind)); |
811 return kind & FunctionKind::kGeneratorFunction; | 809 return kind & FunctionKind::kGeneratorFunction; |
812 } | 810 } |
813 | 811 |
814 | 812 |
815 inline bool IsConciseMethod(FunctionKind kind) { | 813 inline bool IsConciseMethod(FunctionKind kind) { |
816 DCHECK(IsValidFunctionKind(kind)); | 814 DCHECK(IsValidFunctionKind(kind)); |
817 return kind & FunctionKind::kConciseMethod; | 815 return kind & FunctionKind::kConciseMethod; |
818 } | 816 } |
819 | 817 |
820 | 818 |
821 inline bool IsDefaultConstructor(FunctionKind kind) { | 819 inline bool IsDefaultConstructor(FunctionKind kind) { |
822 DCHECK(IsValidFunctionKind(kind)); | 820 DCHECK(IsValidFunctionKind(kind)); |
823 return kind & FunctionKind::kDefaultConstructor; | 821 return kind & FunctionKind::kDefaultConstructor; |
824 } | 822 } |
825 | 823 |
826 | 824 |
827 inline bool IsDefaultConstructorCallSuper(FunctionKind kind) { | |
828 DCHECK(IsValidFunctionKind(kind)); | |
829 return kind & FunctionKind::kDefaultConstructorCallSuper; | |
830 } | |
831 } } // namespace v8::internal | 825 } } // namespace v8::internal |
832 | 826 |
833 namespace i = v8::internal; | 827 namespace i = v8::internal; |
834 | 828 |
835 #endif // V8_GLOBALS_H_ | 829 #endif // V8_GLOBALS_H_ |
OLD | NEW |