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