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_RUNTIME_RUNTIME_H_ | 5 #ifndef V8_RUNTIME_RUNTIME_H_ |
6 #define V8_RUNTIME_RUNTIME_H_ | 6 #define V8_RUNTIME_RUNTIME_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 F(GrowArrayElements, 2, 1) \ | 46 F(GrowArrayElements, 2, 1) \ |
47 F(HasComplexElements, 1, 1) \ | 47 F(HasComplexElements, 1, 1) \ |
48 F(IsArray, 1, 1) \ | 48 F(IsArray, 1, 1) \ |
49 F(HasCachedArrayIndex, 1, 1) \ | 49 F(HasCachedArrayIndex, 1, 1) \ |
50 F(GetCachedArrayIndex, 1, 1) \ | 50 F(GetCachedArrayIndex, 1, 1) \ |
51 F(FixedArrayGet, 2, 1) \ | 51 F(FixedArrayGet, 2, 1) \ |
52 F(FixedArraySet, 3, 1) \ | 52 F(FixedArraySet, 3, 1) \ |
53 F(FastOneByteArrayJoin, 2, 1) | 53 F(FastOneByteArrayJoin, 2, 1) |
54 | 54 |
55 | 55 |
| 56 #define FOR_EACH_INTRINSIC_ATOMICS(F) \ |
| 57 F(AtomicsCompareExchange, 4, 1) \ |
| 58 F(AtomicsLoad, 2, 1) \ |
| 59 F(AtomicsStore, 3, 1) \ |
| 60 F(AtomicsAdd, 3, 1) \ |
| 61 F(AtomicsSub, 3, 1) \ |
| 62 F(AtomicsAnd, 3, 1) \ |
| 63 F(AtomicsOr, 3, 1) \ |
| 64 F(AtomicsXor, 3, 1) \ |
| 65 F(AtomicsExchange, 3, 1) \ |
| 66 F(AtomicsIsLockFree, 1, 1) |
| 67 |
| 68 |
56 #define FOR_EACH_INTRINSIC_CLASSES(F) \ | 69 #define FOR_EACH_INTRINSIC_CLASSES(F) \ |
57 F(ThrowNonMethodError, 0, 1) \ | 70 F(ThrowNonMethodError, 0, 1) \ |
58 F(ThrowUnsupportedSuperError, 0, 1) \ | 71 F(ThrowUnsupportedSuperError, 0, 1) \ |
59 F(ThrowConstructorNonCallableError, 0, 1) \ | 72 F(ThrowConstructorNonCallableError, 0, 1) \ |
60 F(ThrowArrayNotSubclassableError, 0, 1) \ | 73 F(ThrowArrayNotSubclassableError, 0, 1) \ |
61 F(ThrowStaticPrototypeError, 0, 1) \ | 74 F(ThrowStaticPrototypeError, 0, 1) \ |
62 F(ThrowIfStaticPrototype, 1, 1) \ | 75 F(ThrowIfStaticPrototype, 1, 1) \ |
63 F(ToMethod, 2, 1) \ | 76 F(ToMethod, 2, 1) \ |
64 F(HomeObjectSymbol, 0, 1) \ | 77 F(HomeObjectSymbol, 0, 1) \ |
65 F(DefineClass, 6, 1) \ | 78 F(DefineClass, 6, 1) \ |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 F(TypedArrayInitialize, 5, 1) \ | 660 F(TypedArrayInitialize, 5, 1) \ |
648 F(TypedArrayInitializeFromArrayLike, 4, 1) \ | 661 F(TypedArrayInitializeFromArrayLike, 4, 1) \ |
649 F(ArrayBufferViewGetByteLength, 1, 1) \ | 662 F(ArrayBufferViewGetByteLength, 1, 1) \ |
650 F(ArrayBufferViewGetByteOffset, 1, 1) \ | 663 F(ArrayBufferViewGetByteOffset, 1, 1) \ |
651 F(TypedArrayGetLength, 1, 1) \ | 664 F(TypedArrayGetLength, 1, 1) \ |
652 F(DataViewGetBuffer, 1, 1) \ | 665 F(DataViewGetBuffer, 1, 1) \ |
653 F(TypedArrayGetBuffer, 1, 1) \ | 666 F(TypedArrayGetBuffer, 1, 1) \ |
654 F(TypedArraySetFastCases, 3, 1) \ | 667 F(TypedArraySetFastCases, 3, 1) \ |
655 F(TypedArrayMaxSizeInHeap, 0, 1) \ | 668 F(TypedArrayMaxSizeInHeap, 0, 1) \ |
656 F(IsTypedArray, 1, 1) \ | 669 F(IsTypedArray, 1, 1) \ |
| 670 F(IsSharedTypedArray, 1, 1) \ |
| 671 F(IsSharedIntegerTypedArray, 1, 1) \ |
657 F(DataViewInitialize, 4, 1) \ | 672 F(DataViewInitialize, 4, 1) \ |
658 F(DataViewGetUint8, 3, 1) \ | 673 F(DataViewGetUint8, 3, 1) \ |
659 F(DataViewGetInt8, 3, 1) \ | 674 F(DataViewGetInt8, 3, 1) \ |
660 F(DataViewGetUint16, 3, 1) \ | 675 F(DataViewGetUint16, 3, 1) \ |
661 F(DataViewGetInt16, 3, 1) \ | 676 F(DataViewGetInt16, 3, 1) \ |
662 F(DataViewGetUint32, 3, 1) \ | 677 F(DataViewGetUint32, 3, 1) \ |
663 F(DataViewGetInt32, 3, 1) \ | 678 F(DataViewGetInt32, 3, 1) \ |
664 F(DataViewGetFloat32, 3, 1) \ | 679 F(DataViewGetFloat32, 3, 1) \ |
665 F(DataViewGetFloat64, 3, 1) \ | 680 F(DataViewGetFloat64, 3, 1) \ |
666 F(DataViewSetUint8, 4, 1) \ | 681 F(DataViewSetUint8, 4, 1) \ |
(...skipping 12 matching lines...) Expand all Loading... |
679 | 694 |
680 | 695 |
681 #define FOR_EACH_INTRINSIC_RETURN_PAIR(F) \ | 696 #define FOR_EACH_INTRINSIC_RETURN_PAIR(F) \ |
682 F(LoadLookupSlot, 2, 2) \ | 697 F(LoadLookupSlot, 2, 2) \ |
683 F(LoadLookupSlotNoReferenceError, 2, 2) \ | 698 F(LoadLookupSlotNoReferenceError, 2, 2) \ |
684 F(ResolvePossiblyDirectEval, 6, 2) | 699 F(ResolvePossiblyDirectEval, 6, 2) |
685 | 700 |
686 | 701 |
687 #define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \ | 702 #define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \ |
688 FOR_EACH_INTRINSIC_ARRAY(F) \ | 703 FOR_EACH_INTRINSIC_ARRAY(F) \ |
| 704 FOR_EACH_INTRINSIC_ATOMICS(F) \ |
689 FOR_EACH_INTRINSIC_CLASSES(F) \ | 705 FOR_EACH_INTRINSIC_CLASSES(F) \ |
690 FOR_EACH_INTRINSIC_COLLECTIONS(F) \ | 706 FOR_EACH_INTRINSIC_COLLECTIONS(F) \ |
691 FOR_EACH_INTRINSIC_COMPILER(F) \ | 707 FOR_EACH_INTRINSIC_COMPILER(F) \ |
692 FOR_EACH_INTRINSIC_DATE(F) \ | 708 FOR_EACH_INTRINSIC_DATE(F) \ |
693 FOR_EACH_INTRINSIC_DEBUG(F) \ | 709 FOR_EACH_INTRINSIC_DEBUG(F) \ |
694 FOR_EACH_INTRINSIC_FORIN(F) \ | 710 FOR_EACH_INTRINSIC_FORIN(F) \ |
695 FOR_EACH_INTRINSIC_FUNCTION(F) \ | 711 FOR_EACH_INTRINSIC_FUNCTION(F) \ |
696 FOR_EACH_INTRINSIC_GENERATOR(F) \ | 712 FOR_EACH_INTRINSIC_GENERATOR(F) \ |
697 FOR_EACH_INTRINSIC_I18N(F) \ | 713 FOR_EACH_INTRINSIC_I18N(F) \ |
698 FOR_EACH_INTRINSIC_INTERNAL(F) \ | 714 FOR_EACH_INTRINSIC_INTERNAL(F) \ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 static void WeakCollectionSet(Handle<JSWeakCollection> weak_collection, | 882 static void WeakCollectionSet(Handle<JSWeakCollection> weak_collection, |
867 Handle<Object> key, Handle<Object> value, | 883 Handle<Object> key, Handle<Object> value, |
868 int32_t hash); | 884 int32_t hash); |
869 static bool WeakCollectionDelete(Handle<JSWeakCollection> weak_collection, | 885 static bool WeakCollectionDelete(Handle<JSWeakCollection> weak_collection, |
870 Handle<Object> key); | 886 Handle<Object> key); |
871 static bool WeakCollectionDelete(Handle<JSWeakCollection> weak_collection, | 887 static bool WeakCollectionDelete(Handle<JSWeakCollection> weak_collection, |
872 Handle<Object> key, int32_t hash); | 888 Handle<Object> key, int32_t hash); |
873 | 889 |
874 static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate, | 890 static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate, |
875 Handle<Object>); | 891 Handle<Object>); |
| 892 |
| 893 static bool AtomicIsLockFree(uint32_t size); |
876 }; | 894 }; |
877 | 895 |
878 | 896 |
879 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); | 897 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); |
880 | 898 |
881 //--------------------------------------------------------------------------- | 899 //--------------------------------------------------------------------------- |
882 // Constants used by interface to runtime functions. | 900 // Constants used by interface to runtime functions. |
883 | 901 |
884 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 902 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
885 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 903 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
886 | 904 |
887 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 905 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
888 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 906 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
889 STATIC_ASSERT(LANGUAGE_END == 3); | 907 STATIC_ASSERT(LANGUAGE_END == 3); |
890 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 908 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
891 | 909 |
| 910 //--------------------------------------------------------------------------- |
| 911 // Inline functions |
| 912 |
| 913 // Assume that 32-bit architectures don't have 64-bit atomic ops. |
| 914 // TODO(binji): can we do better here? |
| 915 #if V8_TARGET_ARCH_64_BIT && V8_HOST_ARCH_64_BIT |
| 916 |
| 917 #define ATOMICS_REQUIRE_LOCK_64_BIT 0 |
| 918 |
| 919 inline bool Runtime::AtomicIsLockFree(uint32_t size) { |
| 920 return size == 1 || size == 2 || size == 4 || size == 8; |
| 921 } |
| 922 |
| 923 #else |
| 924 |
| 925 #define ATOMICS_REQUIRE_LOCK_64_BIT 1 |
| 926 |
| 927 inline bool Runtime::AtomicIsLockFree(uint32_t size) { |
| 928 return size == 1 || size == 2 || size == 4; |
| 929 } |
| 930 |
| 931 #endif |
| 932 |
892 } // namespace internal | 933 } // namespace internal |
893 } // namespace v8 | 934 } // namespace v8 |
894 | 935 |
895 #endif // V8_RUNTIME_RUNTIME_H_ | 936 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |