| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 enum FunctionKind { | 833 enum FunctionKind { |
| 834 kNormalFunction = 0, | 834 kNormalFunction = 0, |
| 835 kArrowFunction = 1 << 0, | 835 kArrowFunction = 1 << 0, |
| 836 kGeneratorFunction = 1 << 1, | 836 kGeneratorFunction = 1 << 1, |
| 837 kConciseMethod = 1 << 2, | 837 kConciseMethod = 1 << 2, |
| 838 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 838 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
| 839 kAccessorFunction = 1 << 3, | 839 kAccessorFunction = 1 << 3, |
| 840 kDefaultConstructor = 1 << 4, | 840 kDefaultConstructor = 1 << 4, |
| 841 kSubclassConstructor = 1 << 5, | 841 kSubclassConstructor = 1 << 5, |
| 842 kBaseConstructor = 1 << 6, | 842 kBaseConstructor = 1 << 6, |
| 843 kInObjectLiteral = 1 << 7, |
| 843 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 844 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
| 844 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor | 845 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
| 846 kConciseMethodInObjectLiteral = kConciseMethod | kInObjectLiteral, |
| 847 kConciseGeneratorMethodInObjectLiteral = |
| 848 kConciseGeneratorMethod | kInObjectLiteral, |
| 849 kAccessorFunctionInObjectLiteral = kAccessorFunction | kInObjectLiteral, |
| 845 }; | 850 }; |
| 846 | 851 |
| 847 | 852 |
| 848 inline bool IsValidFunctionKind(FunctionKind kind) { | 853 inline bool IsValidFunctionKind(FunctionKind kind) { |
| 849 return kind == FunctionKind::kNormalFunction || | 854 return kind == FunctionKind::kNormalFunction || |
| 850 kind == FunctionKind::kArrowFunction || | 855 kind == FunctionKind::kArrowFunction || |
| 851 kind == FunctionKind::kGeneratorFunction || | 856 kind == FunctionKind::kGeneratorFunction || |
| 852 kind == FunctionKind::kConciseMethod || | 857 kind == FunctionKind::kConciseMethod || |
| 853 kind == FunctionKind::kConciseGeneratorMethod || | 858 kind == FunctionKind::kConciseGeneratorMethod || |
| 854 kind == FunctionKind::kAccessorFunction || | 859 kind == FunctionKind::kAccessorFunction || |
| 855 kind == FunctionKind::kDefaultBaseConstructor || | 860 kind == FunctionKind::kDefaultBaseConstructor || |
| 856 kind == FunctionKind::kDefaultSubclassConstructor || | 861 kind == FunctionKind::kDefaultSubclassConstructor || |
| 857 kind == FunctionKind::kBaseConstructor || | 862 kind == FunctionKind::kBaseConstructor || |
| 858 kind == FunctionKind::kSubclassConstructor; | 863 kind == FunctionKind::kSubclassConstructor || |
| 864 kind == FunctionKind::kConciseMethodInObjectLiteral || |
| 865 kind == FunctionKind::kConciseGeneratorMethodInObjectLiteral || |
| 866 kind == FunctionKind::kAccessorFunctionInObjectLiteral; |
| 859 } | 867 } |
| 860 | 868 |
| 861 | 869 |
| 862 inline bool IsArrowFunction(FunctionKind kind) { | 870 inline bool IsArrowFunction(FunctionKind kind) { |
| 863 DCHECK(IsValidFunctionKind(kind)); | 871 DCHECK(IsValidFunctionKind(kind)); |
| 864 return kind & FunctionKind::kArrowFunction; | 872 return kind & FunctionKind::kArrowFunction; |
| 865 } | 873 } |
| 866 | 874 |
| 867 | 875 |
| 868 inline bool IsGeneratorFunction(FunctionKind kind) { | 876 inline bool IsGeneratorFunction(FunctionKind kind) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 return kind & FunctionKind::kSubclassConstructor; | 908 return kind & FunctionKind::kSubclassConstructor; |
| 901 } | 909 } |
| 902 | 910 |
| 903 | 911 |
| 904 inline bool IsConstructor(FunctionKind kind) { | 912 inline bool IsConstructor(FunctionKind kind) { |
| 905 DCHECK(IsValidFunctionKind(kind)); | 913 DCHECK(IsValidFunctionKind(kind)); |
| 906 return kind & | 914 return kind & |
| 907 (FunctionKind::kBaseConstructor | FunctionKind::kSubclassConstructor | | 915 (FunctionKind::kBaseConstructor | FunctionKind::kSubclassConstructor | |
| 908 FunctionKind::kDefaultConstructor); | 916 FunctionKind::kDefaultConstructor); |
| 909 } | 917 } |
| 918 |
| 919 |
| 920 inline bool IsInObjectLiteral(FunctionKind kind) { |
| 921 DCHECK(IsValidFunctionKind(kind)); |
| 922 return kind & FunctionKind::kInObjectLiteral; |
| 923 } |
| 924 |
| 925 |
| 926 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
| 927 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
| 928 DCHECK(IsValidFunctionKind(kind)); |
| 929 return kind; |
| 930 } |
| 910 } } // namespace v8::internal | 931 } } // namespace v8::internal |
| 911 | 932 |
| 912 namespace i = v8::internal; | 933 namespace i = v8::internal; |
| 913 | 934 |
| 914 #endif // V8_GLOBALS_H_ | 935 #endif // V8_GLOBALS_H_ |
| OLD | NEW |