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