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