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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
811 | 811 |
812 enum Signedness { kSigned, kUnsigned }; | 812 enum Signedness { kSigned, kUnsigned }; |
813 | 813 |
814 | 814 |
815 enum FunctionKind { | 815 enum FunctionKind { |
816 kNormalFunction = 0, | 816 kNormalFunction = 0, |
817 kArrowFunction = 1, | 817 kArrowFunction = 1, |
818 kGeneratorFunction = 2, | 818 kGeneratorFunction = 2, |
819 kConciseMethod = 4, | 819 kConciseMethod = 4, |
820 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 820 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
821 kDefaultConstructor = 8, | 821 kAccessorFunction = 8, |
822 kSubclassConstructor = 16 | 822 kDefaultConstructor = 16, |
823 kSubclassConstructor = 32 | |
adamk
2015/02/05 23:18:43
Maybe switch to shift-lefts now that this is getti
arv (Not doing code reviews)
2015/02/05 23:34:01
Done.
| |
823 }; | 824 }; |
824 | 825 |
825 | 826 |
826 inline bool IsValidFunctionKind(FunctionKind kind) { | 827 inline bool IsValidFunctionKind(FunctionKind kind) { |
827 return kind == FunctionKind::kNormalFunction || | 828 return kind == FunctionKind::kNormalFunction || |
828 kind == FunctionKind::kArrowFunction || | 829 kind == FunctionKind::kArrowFunction || |
829 kind == FunctionKind::kGeneratorFunction || | 830 kind == FunctionKind::kGeneratorFunction || |
830 kind == FunctionKind::kConciseMethod || | 831 kind == FunctionKind::kConciseMethod || |
831 kind == FunctionKind::kConciseGeneratorMethod || | 832 kind == FunctionKind::kConciseGeneratorMethod || |
833 kind == FunctionKind::kAccessorFunction || | |
832 kind == FunctionKind::kDefaultConstructor || | 834 kind == FunctionKind::kDefaultConstructor || |
833 kind == FunctionKind::kSubclassConstructor; | 835 kind == FunctionKind::kSubclassConstructor; |
834 } | 836 } |
835 | 837 |
836 | 838 |
837 inline bool IsArrowFunction(FunctionKind kind) { | 839 inline bool IsArrowFunction(FunctionKind kind) { |
838 DCHECK(IsValidFunctionKind(kind)); | 840 DCHECK(IsValidFunctionKind(kind)); |
839 return kind & FunctionKind::kArrowFunction; | 841 return kind & FunctionKind::kArrowFunction; |
840 } | 842 } |
841 | 843 |
842 | 844 |
843 inline bool IsGeneratorFunction(FunctionKind kind) { | 845 inline bool IsGeneratorFunction(FunctionKind kind) { |
844 DCHECK(IsValidFunctionKind(kind)); | 846 DCHECK(IsValidFunctionKind(kind)); |
845 return kind & FunctionKind::kGeneratorFunction; | 847 return kind & FunctionKind::kGeneratorFunction; |
846 } | 848 } |
847 | 849 |
848 | 850 |
849 inline bool IsConciseMethod(FunctionKind kind) { | 851 inline bool IsConciseMethod(FunctionKind kind) { |
850 DCHECK(IsValidFunctionKind(kind)); | 852 DCHECK(IsValidFunctionKind(kind)); |
851 return kind & FunctionKind::kConciseMethod; | 853 return kind & FunctionKind::kConciseMethod; |
852 } | 854 } |
853 | 855 |
854 | 856 |
857 inline bool IsAccessorFunction(FunctionKind kind) { | |
858 DCHECK(IsValidFunctionKind(kind)); | |
859 return kind & FunctionKind::kAccessorFunction; | |
860 } | |
861 | |
862 | |
855 inline bool IsDefaultConstructor(FunctionKind kind) { | 863 inline bool IsDefaultConstructor(FunctionKind kind) { |
856 DCHECK(IsValidFunctionKind(kind)); | 864 DCHECK(IsValidFunctionKind(kind)); |
857 return kind & FunctionKind::kDefaultConstructor; | 865 return kind & FunctionKind::kDefaultConstructor; |
858 } | 866 } |
859 | 867 |
868 | |
860 inline bool IsSubclassConstructor(FunctionKind kind) { | 869 inline bool IsSubclassConstructor(FunctionKind kind) { |
861 DCHECK(IsValidFunctionKind(kind)); | 870 DCHECK(IsValidFunctionKind(kind)); |
862 return kind & FunctionKind::kSubclassConstructor; | 871 return kind & FunctionKind::kSubclassConstructor; |
863 } | 872 } |
864 } } // namespace v8::internal | 873 } } // namespace v8::internal |
865 | 874 |
866 namespace i = v8::internal; | 875 namespace i = v8::internal; |
867 | 876 |
868 #endif // V8_GLOBALS_H_ | 877 #endif // V8_GLOBALS_H_ |
OLD | NEW |