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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 kGeneratorFunction = 1 << 1, | 928 kGeneratorFunction = 1 << 1, |
929 kConciseMethod = 1 << 2, | 929 kConciseMethod = 1 << 2, |
930 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 930 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
931 kAccessorFunction = 1 << 3, | 931 kAccessorFunction = 1 << 3, |
932 kDefaultConstructor = 1 << 4, | 932 kDefaultConstructor = 1 << 4, |
933 kSubclassConstructor = 1 << 5, | 933 kSubclassConstructor = 1 << 5, |
934 kBaseConstructor = 1 << 6, | 934 kBaseConstructor = 1 << 6, |
935 kInObjectLiteral = 1 << 7, | 935 kInObjectLiteral = 1 << 7, |
936 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 936 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
937 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 937 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
938 kClassConstructor = | |
939 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | |
940 kConciseMethodInObjectLiteral = kConciseMethod | kInObjectLiteral, | 938 kConciseMethodInObjectLiteral = kConciseMethod | kInObjectLiteral, |
941 kConciseGeneratorMethodInObjectLiteral = | 939 kConciseGeneratorMethodInObjectLiteral = |
942 kConciseGeneratorMethod | kInObjectLiteral, | 940 kConciseGeneratorMethod | kInObjectLiteral, |
943 kAccessorFunctionInObjectLiteral = kAccessorFunction | kInObjectLiteral, | 941 kAccessorFunctionInObjectLiteral = kAccessorFunction | kInObjectLiteral, |
944 }; | 942 }; |
945 | 943 |
946 | 944 |
947 inline bool IsValidFunctionKind(FunctionKind kind) { | 945 inline bool IsValidFunctionKind(FunctionKind kind) { |
948 return kind == FunctionKind::kNormalFunction || | 946 return kind == FunctionKind::kNormalFunction || |
949 kind == FunctionKind::kArrowFunction || | 947 kind == FunctionKind::kArrowFunction || |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 | 996 |
999 | 997 |
1000 inline bool IsSubclassConstructor(FunctionKind kind) { | 998 inline bool IsSubclassConstructor(FunctionKind kind) { |
1001 DCHECK(IsValidFunctionKind(kind)); | 999 DCHECK(IsValidFunctionKind(kind)); |
1002 return kind & FunctionKind::kSubclassConstructor; | 1000 return kind & FunctionKind::kSubclassConstructor; |
1003 } | 1001 } |
1004 | 1002 |
1005 | 1003 |
1006 inline bool IsClassConstructor(FunctionKind kind) { | 1004 inline bool IsClassConstructor(FunctionKind kind) { |
1007 DCHECK(IsValidFunctionKind(kind)); | 1005 DCHECK(IsValidFunctionKind(kind)); |
1008 return kind & FunctionKind::kClassConstructor; | 1006 return kind & |
| 1007 (FunctionKind::kBaseConstructor | FunctionKind::kSubclassConstructor | |
| 1008 FunctionKind::kDefaultConstructor); |
1009 } | 1009 } |
1010 | 1010 |
1011 | 1011 |
1012 inline bool IsInObjectLiteral(FunctionKind kind) { | 1012 inline bool IsInObjectLiteral(FunctionKind kind) { |
1013 DCHECK(IsValidFunctionKind(kind)); | 1013 DCHECK(IsValidFunctionKind(kind)); |
1014 return kind & FunctionKind::kInObjectLiteral; | 1014 return kind & FunctionKind::kInObjectLiteral; |
1015 } | 1015 } |
1016 | 1016 |
1017 | 1017 |
1018 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { | 1018 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
1019 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 1019 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
1020 DCHECK(IsValidFunctionKind(kind)); | 1020 DCHECK(IsValidFunctionKind(kind)); |
1021 return kind; | 1021 return kind; |
1022 } | 1022 } |
1023 } // namespace internal | 1023 } // namespace internal |
1024 } // namespace v8 | 1024 } // namespace v8 |
1025 | 1025 |
1026 namespace i = v8::internal; | 1026 namespace i = v8::internal; |
1027 | 1027 |
1028 #endif // V8_GLOBALS_H_ | 1028 #endif // V8_GLOBALS_H_ |
OLD | NEW |