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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 966 |
967 | 967 |
968 enum MinusZeroMode { | 968 enum MinusZeroMode { |
969 TREAT_MINUS_ZERO_AS_ZERO, | 969 TREAT_MINUS_ZERO_AS_ZERO, |
970 FAIL_ON_MINUS_ZERO | 970 FAIL_ON_MINUS_ZERO |
971 }; | 971 }; |
972 | 972 |
973 | 973 |
974 enum Signedness { kSigned, kUnsigned }; | 974 enum Signedness { kSigned, kUnsigned }; |
975 | 975 |
976 | |
977 enum FunctionKind { | 976 enum FunctionKind { |
978 kNormalFunction = 0, | 977 kNormalFunction = 0, |
979 kArrowFunction = 1 << 0, | 978 kArrowFunction = 1 << 0, |
980 kGeneratorFunction = 1 << 1, | 979 kGeneratorFunction = 1 << 1, |
981 kConciseMethod = 1 << 2, | 980 kConciseMethod = 1 << 2, |
982 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 981 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
983 kAccessorFunction = 1 << 3, | 982 kDefaultConstructor = 1 << 3, |
984 kDefaultConstructor = 1 << 4, | 983 kSubclassConstructor = 1 << 4, |
985 kSubclassConstructor = 1 << 5, | 984 kBaseConstructor = 1 << 5, |
986 kBaseConstructor = 1 << 6, | 985 kGetterFunction = 1 << 6, |
| 986 kSetterFunction = 1 << 7, |
| 987 kAccessorFunction = kGetterFunction | kSetterFunction, |
987 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 988 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
988 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 989 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
989 kClassConstructor = | 990 kClassConstructor = |
990 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | 991 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, |
991 }; | 992 }; |
992 | 993 |
993 | |
994 inline bool IsValidFunctionKind(FunctionKind kind) { | 994 inline bool IsValidFunctionKind(FunctionKind kind) { |
995 return kind == FunctionKind::kNormalFunction || | 995 return kind == FunctionKind::kNormalFunction || |
996 kind == FunctionKind::kArrowFunction || | 996 kind == FunctionKind::kArrowFunction || |
997 kind == FunctionKind::kGeneratorFunction || | 997 kind == FunctionKind::kGeneratorFunction || |
998 kind == FunctionKind::kConciseMethod || | 998 kind == FunctionKind::kConciseMethod || |
999 kind == FunctionKind::kConciseGeneratorMethod || | 999 kind == FunctionKind::kConciseGeneratorMethod || |
| 1000 kind == FunctionKind::kGetterFunction || |
| 1001 kind == FunctionKind::kSetterFunction || |
1000 kind == FunctionKind::kAccessorFunction || | 1002 kind == FunctionKind::kAccessorFunction || |
1001 kind == FunctionKind::kDefaultBaseConstructor || | 1003 kind == FunctionKind::kDefaultBaseConstructor || |
1002 kind == FunctionKind::kDefaultSubclassConstructor || | 1004 kind == FunctionKind::kDefaultSubclassConstructor || |
1003 kind == FunctionKind::kBaseConstructor || | 1005 kind == FunctionKind::kBaseConstructor || |
1004 kind == FunctionKind::kSubclassConstructor; | 1006 kind == FunctionKind::kSubclassConstructor; |
1005 } | 1007 } |
1006 | 1008 |
1007 | 1009 |
1008 inline bool IsArrowFunction(FunctionKind kind) { | 1010 inline bool IsArrowFunction(FunctionKind kind) { |
1009 DCHECK(IsValidFunctionKind(kind)); | 1011 DCHECK(IsValidFunctionKind(kind)); |
1010 return kind & FunctionKind::kArrowFunction; | 1012 return kind & FunctionKind::kArrowFunction; |
1011 } | 1013 } |
1012 | 1014 |
1013 | 1015 |
1014 inline bool IsGeneratorFunction(FunctionKind kind) { | 1016 inline bool IsGeneratorFunction(FunctionKind kind) { |
1015 DCHECK(IsValidFunctionKind(kind)); | 1017 DCHECK(IsValidFunctionKind(kind)); |
1016 return kind & FunctionKind::kGeneratorFunction; | 1018 return kind & FunctionKind::kGeneratorFunction; |
1017 } | 1019 } |
1018 | 1020 |
1019 | 1021 |
1020 inline bool IsConciseMethod(FunctionKind kind) { | 1022 inline bool IsConciseMethod(FunctionKind kind) { |
1021 DCHECK(IsValidFunctionKind(kind)); | 1023 DCHECK(IsValidFunctionKind(kind)); |
1022 return kind & FunctionKind::kConciseMethod; | 1024 return kind & FunctionKind::kConciseMethod; |
1023 } | 1025 } |
1024 | 1026 |
| 1027 inline bool IsGetterFunction(FunctionKind kind) { |
| 1028 DCHECK(IsValidFunctionKind(kind)); |
| 1029 return kind & FunctionKind::kGetterFunction; |
| 1030 } |
| 1031 |
| 1032 inline bool IsSetterFunction(FunctionKind kind) { |
| 1033 DCHECK(IsValidFunctionKind(kind)); |
| 1034 return kind & FunctionKind::kSetterFunction; |
| 1035 } |
1025 | 1036 |
1026 inline bool IsAccessorFunction(FunctionKind kind) { | 1037 inline bool IsAccessorFunction(FunctionKind kind) { |
1027 DCHECK(IsValidFunctionKind(kind)); | 1038 DCHECK(IsValidFunctionKind(kind)); |
1028 return kind & FunctionKind::kAccessorFunction; | 1039 return kind & FunctionKind::kAccessorFunction; |
1029 } | 1040 } |
1030 | 1041 |
1031 | 1042 |
1032 inline bool IsDefaultConstructor(FunctionKind kind) { | 1043 inline bool IsDefaultConstructor(FunctionKind kind) { |
1033 DCHECK(IsValidFunctionKind(kind)); | 1044 DCHECK(IsValidFunctionKind(kind)); |
1034 return kind & FunctionKind::kDefaultConstructor; | 1045 return kind & FunctionKind::kDefaultConstructor; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1080 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1070 kPointerSizeLog2); | 1081 kPointerSizeLog2); |
1071 } | 1082 } |
1072 | 1083 |
1073 } // namespace internal | 1084 } // namespace internal |
1074 } // namespace v8 | 1085 } // namespace v8 |
1075 | 1086 |
1076 namespace i = v8::internal; | 1087 namespace i = v8::internal; |
1077 | 1088 |
1078 #endif // V8_GLOBALS_H_ | 1089 #endif // V8_GLOBALS_H_ |
OLD | NEW |