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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 kArrowFunction = 1 << 0, | 1071 kArrowFunction = 1 << 0, |
1072 kGeneratorFunction = 1 << 1, | 1072 kGeneratorFunction = 1 << 1, |
1073 kConciseMethod = 1 << 2, | 1073 kConciseMethod = 1 << 2, |
1074 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 1074 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
1075 kDefaultConstructor = 1 << 3, | 1075 kDefaultConstructor = 1 << 3, |
1076 kSubclassConstructor = 1 << 4, | 1076 kSubclassConstructor = 1 << 4, |
1077 kBaseConstructor = 1 << 5, | 1077 kBaseConstructor = 1 << 5, |
1078 kGetterFunction = 1 << 6, | 1078 kGetterFunction = 1 << 6, |
1079 kSetterFunction = 1 << 7, | 1079 kSetterFunction = 1 << 7, |
1080 kAsyncFunction = 1 << 8, | 1080 kAsyncFunction = 1 << 8, |
1081 kModule = 1 << 9, | |
1082 kAccessorFunction = kGetterFunction | kSetterFunction, | 1081 kAccessorFunction = kGetterFunction | kSetterFunction, |
1083 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 1082 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
1084 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 1083 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
1085 kClassConstructor = | 1084 kClassConstructor = |
1086 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | 1085 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, |
1087 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, | 1086 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, |
1088 kAsyncConciseMethod = kAsyncFunction | kConciseMethod | 1087 kAsyncConciseMethod = kAsyncFunction | kConciseMethod |
1089 }; | 1088 }; |
1090 | 1089 |
1091 inline bool IsValidFunctionKind(FunctionKind kind) { | 1090 inline bool IsValidFunctionKind(FunctionKind kind) { |
1092 return kind == FunctionKind::kNormalFunction || | 1091 return kind == FunctionKind::kNormalFunction || |
1093 kind == FunctionKind::kArrowFunction || | 1092 kind == FunctionKind::kArrowFunction || |
1094 kind == FunctionKind::kGeneratorFunction || | 1093 kind == FunctionKind::kGeneratorFunction || |
1095 kind == FunctionKind::kModule || | |
1096 kind == FunctionKind::kConciseMethod || | 1094 kind == FunctionKind::kConciseMethod || |
1097 kind == FunctionKind::kConciseGeneratorMethod || | 1095 kind == FunctionKind::kConciseGeneratorMethod || |
1098 kind == FunctionKind::kGetterFunction || | 1096 kind == FunctionKind::kGetterFunction || |
1099 kind == FunctionKind::kSetterFunction || | 1097 kind == FunctionKind::kSetterFunction || |
1100 kind == FunctionKind::kAccessorFunction || | 1098 kind == FunctionKind::kAccessorFunction || |
1101 kind == FunctionKind::kDefaultBaseConstructor || | 1099 kind == FunctionKind::kDefaultBaseConstructor || |
1102 kind == FunctionKind::kDefaultSubclassConstructor || | 1100 kind == FunctionKind::kDefaultSubclassConstructor || |
1103 kind == FunctionKind::kBaseConstructor || | 1101 kind == FunctionKind::kBaseConstructor || |
1104 kind == FunctionKind::kSubclassConstructor || | 1102 kind == FunctionKind::kSubclassConstructor || |
1105 kind == FunctionKind::kAsyncFunction || | 1103 kind == FunctionKind::kAsyncFunction || |
1106 kind == FunctionKind::kAsyncArrowFunction || | 1104 kind == FunctionKind::kAsyncArrowFunction || |
1107 kind == FunctionKind::kAsyncConciseMethod; | 1105 kind == FunctionKind::kAsyncConciseMethod; |
1108 } | 1106 } |
1109 | 1107 |
1110 | 1108 |
1111 inline bool IsArrowFunction(FunctionKind kind) { | 1109 inline bool IsArrowFunction(FunctionKind kind) { |
1112 DCHECK(IsValidFunctionKind(kind)); | 1110 DCHECK(IsValidFunctionKind(kind)); |
1113 return kind & FunctionKind::kArrowFunction; | 1111 return kind & FunctionKind::kArrowFunction; |
1114 } | 1112 } |
1115 | 1113 |
1116 | 1114 |
1117 inline bool IsGeneratorFunction(FunctionKind kind) { | 1115 inline bool IsGeneratorFunction(FunctionKind kind) { |
1118 DCHECK(IsValidFunctionKind(kind)); | 1116 DCHECK(IsValidFunctionKind(kind)); |
1119 return kind & FunctionKind::kGeneratorFunction; | 1117 return kind & FunctionKind::kGeneratorFunction; |
1120 } | 1118 } |
1121 | 1119 |
1122 inline bool IsModule(FunctionKind kind) { | |
1123 DCHECK(IsValidFunctionKind(kind)); | |
1124 return kind & FunctionKind::kModule; | |
1125 } | |
1126 | |
1127 inline bool IsAsyncFunction(FunctionKind kind) { | 1120 inline bool IsAsyncFunction(FunctionKind kind) { |
1128 DCHECK(IsValidFunctionKind(kind)); | 1121 DCHECK(IsValidFunctionKind(kind)); |
1129 return kind & FunctionKind::kAsyncFunction; | 1122 return kind & FunctionKind::kAsyncFunction; |
1130 } | 1123 } |
1131 | 1124 |
1132 inline bool IsResumableFunction(FunctionKind kind) { | 1125 inline bool IsResumableFunction(FunctionKind kind) { |
1133 return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind); | 1126 return IsGeneratorFunction(kind) || IsAsyncFunction(kind); |
1134 } | 1127 } |
1135 | 1128 |
1136 inline bool IsConciseMethod(FunctionKind kind) { | 1129 inline bool IsConciseMethod(FunctionKind kind) { |
1137 DCHECK(IsValidFunctionKind(kind)); | 1130 DCHECK(IsValidFunctionKind(kind)); |
1138 return kind & FunctionKind::kConciseMethod; | 1131 return kind & FunctionKind::kConciseMethod; |
1139 } | 1132 } |
1140 | 1133 |
1141 inline bool IsGetterFunction(FunctionKind kind) { | 1134 inline bool IsGetterFunction(FunctionKind kind) { |
1142 DCHECK(IsValidFunctionKind(kind)); | 1135 DCHECK(IsValidFunctionKind(kind)); |
1143 return kind & FunctionKind::kGetterFunction; | 1136 return kind & FunctionKind::kGetterFunction; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 LIVE_EDIT_FRAME_DROPPED_IN_RETURN_CALL, | 1230 LIVE_EDIT_FRAME_DROPPED_IN_RETURN_CALL, |
1238 LIVE_EDIT_CURRENTLY_SET_MODE | 1231 LIVE_EDIT_CURRENTLY_SET_MODE |
1239 }; | 1232 }; |
1240 | 1233 |
1241 } // namespace internal | 1234 } // namespace internal |
1242 } // namespace v8 | 1235 } // namespace v8 |
1243 | 1236 |
1244 namespace i = v8::internal; | 1237 namespace i = v8::internal; |
1245 | 1238 |
1246 #endif // V8_GLOBALS_H_ | 1239 #endif // V8_GLOBALS_H_ |
OLD | NEW |