| 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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 return kind & FunctionKind::kSubclassConstructor; | 1028 return kind & FunctionKind::kSubclassConstructor; |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 | 1031 |
| 1032 inline bool IsClassConstructor(FunctionKind kind) { | 1032 inline bool IsClassConstructor(FunctionKind kind) { |
| 1033 DCHECK(IsValidFunctionKind(kind)); | 1033 DCHECK(IsValidFunctionKind(kind)); |
| 1034 return kind & FunctionKind::kClassConstructor; | 1034 return kind & FunctionKind::kClassConstructor; |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 | 1037 |
| 1038 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { |
| 1039 if (IsAccessorFunction(kind)) return false; |
| 1040 if (IsConciseMethod(kind) && !IsGeneratorFunction(kind)) return false; |
| 1041 if (IsArrowFunction(kind)) return false; |
| 1042 if (is_strong(mode)) return IsClassConstructor(kind); |
| 1043 return true; |
| 1044 } |
| 1045 |
| 1046 |
| 1038 inline bool IsInObjectLiteral(FunctionKind kind) { | 1047 inline bool IsInObjectLiteral(FunctionKind kind) { |
| 1039 DCHECK(IsValidFunctionKind(kind)); | 1048 DCHECK(IsValidFunctionKind(kind)); |
| 1040 return kind & FunctionKind::kInObjectLiteral; | 1049 return kind & FunctionKind::kInObjectLiteral; |
| 1041 } | 1050 } |
| 1042 | 1051 |
| 1043 | 1052 |
| 1044 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { | 1053 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
| 1045 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 1054 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
| 1046 DCHECK(IsValidFunctionKind(kind)); | 1055 DCHECK(IsValidFunctionKind(kind)); |
| 1047 return kind; | 1056 return kind; |
| 1048 } | 1057 } |
| 1049 } // namespace internal | 1058 } // namespace internal |
| 1050 } // namespace v8 | 1059 } // namespace v8 |
| 1051 | 1060 |
| 1052 namespace i = v8::internal; | 1061 namespace i = v8::internal; |
| 1053 | 1062 |
| 1054 #endif // V8_GLOBALS_H_ | 1063 #endif // V8_GLOBALS_H_ |
| OLD | NEW |