| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 813 |
| 814 | 814 |
| 815 enum FunctionKind { | 815 enum FunctionKind { |
| 816 kNormalFunction = 0, | 816 kNormalFunction = 0, |
| 817 kArrowFunction = 1 << 0, | 817 kArrowFunction = 1 << 0, |
| 818 kGeneratorFunction = 1 << 1, | 818 kGeneratorFunction = 1 << 1, |
| 819 kConciseMethod = 1 << 2, | 819 kConciseMethod = 1 << 2, |
| 820 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 820 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
| 821 kAccessorFunction = 1 << 3, | 821 kAccessorFunction = 1 << 3, |
| 822 kDefaultConstructor = 1 << 4, | 822 kDefaultConstructor = 1 << 4, |
| 823 kSubclassConstructor = 1 << 5 | 823 kSubclassConstructor = 1 << 5, |
| 824 kBaseConstructor = 1 << 6, |
| 824 }; | 825 }; |
| 825 | 826 |
| 826 | 827 |
| 827 inline bool IsValidFunctionKind(FunctionKind kind) { | 828 inline bool IsValidFunctionKind(FunctionKind kind) { |
| 828 return kind == FunctionKind::kNormalFunction || | 829 return kind == FunctionKind::kNormalFunction || |
| 829 kind == FunctionKind::kArrowFunction || | 830 kind == FunctionKind::kArrowFunction || |
| 830 kind == FunctionKind::kGeneratorFunction || | 831 kind == FunctionKind::kGeneratorFunction || |
| 831 kind == FunctionKind::kConciseMethod || | 832 kind == FunctionKind::kConciseMethod || |
| 832 kind == FunctionKind::kConciseGeneratorMethod || | 833 kind == FunctionKind::kConciseGeneratorMethod || |
| 833 kind == FunctionKind::kAccessorFunction || | 834 kind == FunctionKind::kAccessorFunction || |
| 834 kind == FunctionKind::kDefaultConstructor || | 835 kind == FunctionKind::kDefaultConstructor || |
| 836 kind == FunctionKind::kBaseConstructor || |
| 835 kind == FunctionKind::kSubclassConstructor; | 837 kind == FunctionKind::kSubclassConstructor; |
| 836 } | 838 } |
| 837 | 839 |
| 838 | 840 |
| 839 inline bool IsArrowFunction(FunctionKind kind) { | 841 inline bool IsArrowFunction(FunctionKind kind) { |
| 840 DCHECK(IsValidFunctionKind(kind)); | 842 DCHECK(IsValidFunctionKind(kind)); |
| 841 return kind & FunctionKind::kArrowFunction; | 843 return kind & FunctionKind::kArrowFunction; |
| 842 } | 844 } |
| 843 | 845 |
| 844 | 846 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 859 return kind & FunctionKind::kAccessorFunction; | 861 return kind & FunctionKind::kAccessorFunction; |
| 860 } | 862 } |
| 861 | 863 |
| 862 | 864 |
| 863 inline bool IsDefaultConstructor(FunctionKind kind) { | 865 inline bool IsDefaultConstructor(FunctionKind kind) { |
| 864 DCHECK(IsValidFunctionKind(kind)); | 866 DCHECK(IsValidFunctionKind(kind)); |
| 865 return kind & FunctionKind::kDefaultConstructor; | 867 return kind & FunctionKind::kDefaultConstructor; |
| 866 } | 868 } |
| 867 | 869 |
| 868 | 870 |
| 871 inline bool IsBaseConstructor(FunctionKind kind) { |
| 872 DCHECK(IsValidFunctionKind(kind)); |
| 873 return kind & FunctionKind::kBaseConstructor; |
| 874 } |
| 875 |
| 876 |
| 869 inline bool IsSubclassConstructor(FunctionKind kind) { | 877 inline bool IsSubclassConstructor(FunctionKind kind) { |
| 870 DCHECK(IsValidFunctionKind(kind)); | 878 DCHECK(IsValidFunctionKind(kind)); |
| 871 return kind & FunctionKind::kSubclassConstructor; | 879 return kind & FunctionKind::kSubclassConstructor; |
| 872 } | 880 } |
| 881 |
| 882 |
| 883 inline bool IsConstructor(FunctionKind kind) { |
| 884 DCHECK(IsValidFunctionKind(kind)); |
| 885 return kind & |
| 886 (FunctionKind::kBaseConstructor | FunctionKind::kSubclassConstructor | |
| 887 FunctionKind::kDefaultConstructor); |
| 888 } |
| 873 } } // namespace v8::internal | 889 } } // namespace v8::internal |
| 874 | 890 |
| 875 namespace i = v8::internal; | 891 namespace i = v8::internal; |
| 876 | 892 |
| 877 #endif // V8_GLOBALS_H_ | 893 #endif // V8_GLOBALS_H_ |
| OLD | NEW |