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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 | 772 |
773 enum Signedness { kSigned, kUnsigned }; | 773 enum Signedness { kSigned, kUnsigned }; |
774 | 774 |
775 | 775 |
776 enum FunctionKind { | 776 enum FunctionKind { |
777 kNormalFunction = 0, | 777 kNormalFunction = 0, |
778 kArrowFunction = 1, | 778 kArrowFunction = 1, |
779 kGeneratorFunction = 2, | 779 kGeneratorFunction = 2, |
780 kConciseMethod = 4, | 780 kConciseMethod = 4, |
781 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 781 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
782 kDefaultConstructor = 8 | 782 kDefaultConstructor = 8, |
| 783 kSubclassConstructor = 16 |
783 }; | 784 }; |
784 | 785 |
785 | 786 |
786 inline bool IsValidFunctionKind(FunctionKind kind) { | 787 inline bool IsValidFunctionKind(FunctionKind kind) { |
787 return kind == FunctionKind::kNormalFunction || | 788 return kind == FunctionKind::kNormalFunction || |
788 kind == FunctionKind::kArrowFunction || | 789 kind == FunctionKind::kArrowFunction || |
789 kind == FunctionKind::kGeneratorFunction || | 790 kind == FunctionKind::kGeneratorFunction || |
790 kind == FunctionKind::kConciseMethod || | 791 kind == FunctionKind::kConciseMethod || |
791 kind == FunctionKind::kConciseGeneratorMethod || | 792 kind == FunctionKind::kConciseGeneratorMethod || |
792 kind == FunctionKind::kDefaultConstructor; | 793 kind == FunctionKind::kDefaultConstructor || |
| 794 kind == FunctionKind::kSubclassConstructor; |
793 } | 795 } |
794 | 796 |
795 | 797 |
796 inline bool IsArrowFunction(FunctionKind kind) { | 798 inline bool IsArrowFunction(FunctionKind kind) { |
797 DCHECK(IsValidFunctionKind(kind)); | 799 DCHECK(IsValidFunctionKind(kind)); |
798 return kind & FunctionKind::kArrowFunction; | 800 return kind & FunctionKind::kArrowFunction; |
799 } | 801 } |
800 | 802 |
801 | 803 |
802 inline bool IsGeneratorFunction(FunctionKind kind) { | 804 inline bool IsGeneratorFunction(FunctionKind kind) { |
803 DCHECK(IsValidFunctionKind(kind)); | 805 DCHECK(IsValidFunctionKind(kind)); |
804 return kind & FunctionKind::kGeneratorFunction; | 806 return kind & FunctionKind::kGeneratorFunction; |
805 } | 807 } |
806 | 808 |
807 | 809 |
808 inline bool IsConciseMethod(FunctionKind kind) { | 810 inline bool IsConciseMethod(FunctionKind kind) { |
809 DCHECK(IsValidFunctionKind(kind)); | 811 DCHECK(IsValidFunctionKind(kind)); |
810 return kind & FunctionKind::kConciseMethod; | 812 return kind & FunctionKind::kConciseMethod; |
811 } | 813 } |
812 | 814 |
813 | 815 |
814 inline bool IsDefaultConstructor(FunctionKind kind) { | 816 inline bool IsDefaultConstructor(FunctionKind kind) { |
815 DCHECK(IsValidFunctionKind(kind)); | 817 DCHECK(IsValidFunctionKind(kind)); |
816 return kind & FunctionKind::kDefaultConstructor; | 818 return kind & FunctionKind::kDefaultConstructor; |
817 } | 819 } |
818 | 820 |
819 | 821 inline bool IsSubclassConstructor(FunctionKind kind) { |
| 822 DCHECK(IsValidFunctionKind(kind)); |
| 823 return kind & FunctionKind::kSubclassConstructor; |
| 824 } |
820 } } // namespace v8::internal | 825 } } // namespace v8::internal |
821 | 826 |
822 namespace i = v8::internal; | 827 namespace i = v8::internal; |
823 | 828 |
824 #endif // V8_GLOBALS_H_ | 829 #endif // V8_GLOBALS_H_ |
OLD | NEW |