Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: src/objects.h

Issue 143633007: A64: Synchronize with r18764. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 /* Object::IsExternalArray(). */ \ 381 /* Object::IsExternalArray(). */ \
382 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 382 V(EXTERNAL_BYTE_ARRAY_TYPE) \
383 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ 383 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \
384 V(EXTERNAL_SHORT_ARRAY_TYPE) \ 384 V(EXTERNAL_SHORT_ARRAY_TYPE) \
385 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ 385 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \
386 V(EXTERNAL_INT_ARRAY_TYPE) \ 386 V(EXTERNAL_INT_ARRAY_TYPE) \
387 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ 387 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \
388 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ 388 V(EXTERNAL_FLOAT_ARRAY_TYPE) \
389 V(EXTERNAL_DOUBLE_ARRAY_TYPE) \ 389 V(EXTERNAL_DOUBLE_ARRAY_TYPE) \
390 V(EXTERNAL_PIXEL_ARRAY_TYPE) \ 390 V(EXTERNAL_PIXEL_ARRAY_TYPE) \
391 \
392 V(FIXED_INT8_ARRAY_TYPE) \
393 V(FIXED_UINT8_ARRAY_TYPE) \
394 V(FIXED_INT16_ARRAY_TYPE) \
395 V(FIXED_UINT16_ARRAY_TYPE) \
396 V(FIXED_INT32_ARRAY_TYPE) \
397 V(FIXED_UINT32_ARRAY_TYPE) \
398 V(FIXED_FLOAT32_ARRAY_TYPE) \
399 V(FIXED_FLOAT64_ARRAY_TYPE) \
400 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
401 \
391 V(FILLER_TYPE) \ 402 V(FILLER_TYPE) \
392 \ 403 \
393 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \ 404 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \
394 V(DECLARED_ACCESSOR_INFO_TYPE) \ 405 V(DECLARED_ACCESSOR_INFO_TYPE) \
395 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ 406 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \
396 V(ACCESSOR_PAIR_TYPE) \ 407 V(ACCESSOR_PAIR_TYPE) \
397 V(ACCESS_CHECK_INFO_TYPE) \ 408 V(ACCESS_CHECK_INFO_TYPE) \
398 V(INTERCEPTOR_INFO_TYPE) \ 409 V(INTERCEPTOR_INFO_TYPE) \
399 V(CALL_HANDLER_INFO_TYPE) \ 410 V(CALL_HANDLER_INFO_TYPE) \
400 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 411 V(FUNCTION_TEMPLATE_INFO_TYPE) \
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 FREE_SPACE_TYPE, 726 FREE_SPACE_TYPE,
716 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 727 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
717 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 728 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
718 EXTERNAL_SHORT_ARRAY_TYPE, 729 EXTERNAL_SHORT_ARRAY_TYPE,
719 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 730 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
720 EXTERNAL_INT_ARRAY_TYPE, 731 EXTERNAL_INT_ARRAY_TYPE,
721 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 732 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
722 EXTERNAL_FLOAT_ARRAY_TYPE, 733 EXTERNAL_FLOAT_ARRAY_TYPE,
723 EXTERNAL_DOUBLE_ARRAY_TYPE, 734 EXTERNAL_DOUBLE_ARRAY_TYPE,
724 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 735 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
736
737 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
738 FIXED_UINT8_ARRAY_TYPE,
739 FIXED_INT16_ARRAY_TYPE,
740 FIXED_UINT16_ARRAY_TYPE,
741 FIXED_INT32_ARRAY_TYPE,
742 FIXED_UINT32_ARRAY_TYPE,
743 FIXED_FLOAT32_ARRAY_TYPE,
744 FIXED_FLOAT64_ARRAY_TYPE,
745 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE
746
725 FIXED_DOUBLE_ARRAY_TYPE, 747 FIXED_DOUBLE_ARRAY_TYPE,
726 FILLER_TYPE, // LAST_DATA_TYPE 748 FILLER_TYPE, // LAST_DATA_TYPE
727 749
728 // Structs. 750 // Structs.
729 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, 751 DECLARED_ACCESSOR_DESCRIPTOR_TYPE,
730 DECLARED_ACCESSOR_INFO_TYPE, 752 DECLARED_ACCESSOR_INFO_TYPE,
731 EXECUTABLE_ACCESSOR_INFO_TYPE, 753 EXECUTABLE_ACCESSOR_INFO_TYPE,
732 ACCESSOR_PAIR_TYPE, 754 ACCESSOR_PAIR_TYPE,
733 ACCESS_CHECK_INFO_TYPE, 755 ACCESS_CHECK_INFO_TYPE,
734 INTERCEPTOR_INFO_TYPE, 756 INTERCEPTOR_INFO_TYPE,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 FIRST_TYPE = 0x0, 814 FIRST_TYPE = 0x0,
793 LAST_TYPE = JS_FUNCTION_TYPE, 815 LAST_TYPE = JS_FUNCTION_TYPE,
794 FIRST_NAME_TYPE = FIRST_TYPE, 816 FIRST_NAME_TYPE = FIRST_TYPE,
795 LAST_NAME_TYPE = SYMBOL_TYPE, 817 LAST_NAME_TYPE = SYMBOL_TYPE,
796 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 818 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
797 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 819 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
798 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, 820 FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
799 // Boundaries for testing for an external array. 821 // Boundaries for testing for an external array.
800 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 822 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
801 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, 823 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
824 // Boundaries for testing for a fixed typed array.
825 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
826 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
802 // Boundary for promotion to old data space/old pointer space. 827 // Boundary for promotion to old data space/old pointer space.
803 LAST_DATA_TYPE = FILLER_TYPE, 828 LAST_DATA_TYPE = FILLER_TYPE,
804 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 829 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
805 // Note that there is no range for JSObject or JSProxy, since their subtypes 830 // Note that there is no range for JSObject or JSProxy, since their subtypes
806 // are not continuous in this enum! The enum ranges instead reflect the 831 // are not continuous in this enum! The enum ranges instead reflect the
807 // external class names, where proxies are treated as either ordinary objects, 832 // external class names, where proxies are treated as either ordinary objects,
808 // or functions. 833 // or functions.
809 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE, 834 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE,
810 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 835 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
811 // Boundaries for testing the types represented as JSObject 836 // Boundaries for testing the types represented as JSObject
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 class AllocationSite; 901 class AllocationSite;
877 class AllocationSiteCreationContext; 902 class AllocationSiteCreationContext;
878 class AllocationSiteUsageContext; 903 class AllocationSiteUsageContext;
879 class DictionaryElementsAccessor; 904 class DictionaryElementsAccessor;
880 class ElementsAccessor; 905 class ElementsAccessor;
881 class Failure; 906 class Failure;
882 class FixedArrayBase; 907 class FixedArrayBase;
883 class GlobalObject; 908 class GlobalObject;
884 class ObjectVisitor; 909 class ObjectVisitor;
885 class StringStream; 910 class StringStream;
886 // We cannot just say "class Type;" if it is created from a template... =8-? 911 // We cannot just say "class HeapType;" if it is created from a template... =8-?
887 template<class> class TypeImpl; 912 template<class> class TypeImpl;
888 struct HeapTypeConfig; 913 struct HeapTypeConfig;
889 typedef TypeImpl<HeapTypeConfig> Type; 914 typedef TypeImpl<HeapTypeConfig> HeapType;
890 915
891 916
892 // A template-ized version of the IsXXX functions. 917 // A template-ized version of the IsXXX functions.
893 template <class C> inline bool Is(Object* obj); 918 template <class C> inline bool Is(Object* obj);
894 919
895 #ifdef VERIFY_HEAP 920 #ifdef VERIFY_HEAP
896 #define DECLARE_VERIFIER(Name) void Name##Verify(); 921 #define DECLARE_VERIFIER(Name) void Name##Verify();
897 #else 922 #else
898 #define DECLARE_VERIFIER(Name) 923 #define DECLARE_VERIFIER(Name)
899 #endif 924 #endif
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 V(ExternalArray) \ 1009 V(ExternalArray) \
985 V(ExternalByteArray) \ 1010 V(ExternalByteArray) \
986 V(ExternalUnsignedByteArray) \ 1011 V(ExternalUnsignedByteArray) \
987 V(ExternalShortArray) \ 1012 V(ExternalShortArray) \
988 V(ExternalUnsignedShortArray) \ 1013 V(ExternalUnsignedShortArray) \
989 V(ExternalIntArray) \ 1014 V(ExternalIntArray) \
990 V(ExternalUnsignedIntArray) \ 1015 V(ExternalUnsignedIntArray) \
991 V(ExternalFloatArray) \ 1016 V(ExternalFloatArray) \
992 V(ExternalDoubleArray) \ 1017 V(ExternalDoubleArray) \
993 V(ExternalPixelArray) \ 1018 V(ExternalPixelArray) \
1019 V(FixedTypedArrayBase) \
1020 V(FixedUint8Array) \
1021 V(FixedInt8Array) \
1022 V(FixedUint16Array) \
1023 V(FixedInt16Array) \
1024 V(FixedUint32Array) \
1025 V(FixedInt32Array) \
1026 V(FixedFloat32Array) \
1027 V(FixedFloat64Array) \
1028 V(FixedUint8ClampedArray) \
994 V(ByteArray) \ 1029 V(ByteArray) \
995 V(FreeSpace) \ 1030 V(FreeSpace) \
996 V(JSReceiver) \ 1031 V(JSReceiver) \
997 V(JSObject) \ 1032 V(JSObject) \
998 V(JSContextExtensionObject) \ 1033 V(JSContextExtensionObject) \
999 V(JSGeneratorObject) \ 1034 V(JSGeneratorObject) \
1000 V(JSModule) \ 1035 V(JSModule) \
1001 V(Map) \ 1036 V(Map) \
1002 V(DescriptorArray) \ 1037 V(DescriptorArray) \
1003 V(TransitionArray) \ 1038 V(TransitionArray) \
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 // Returns true if an object has any of the fast elements kinds. 2178 // Returns true if an object has any of the fast elements kinds.
2144 inline bool HasFastElements(); 2179 inline bool HasFastElements();
2145 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS 2180 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
2146 // ElementsKind. 2181 // ElementsKind.
2147 inline bool HasFastDoubleElements(); 2182 inline bool HasFastDoubleElements();
2148 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS 2183 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
2149 // ElementsKind. 2184 // ElementsKind.
2150 inline bool HasFastHoleyElements(); 2185 inline bool HasFastHoleyElements();
2151 inline bool HasNonStrictArgumentsElements(); 2186 inline bool HasNonStrictArgumentsElements();
2152 inline bool HasDictionaryElements(); 2187 inline bool HasDictionaryElements();
2188
2153 inline bool HasExternalPixelElements(); 2189 inline bool HasExternalPixelElements();
2154 inline bool HasExternalArrayElements(); 2190 inline bool HasExternalArrayElements();
2155 inline bool HasExternalByteElements(); 2191 inline bool HasExternalByteElements();
2156 inline bool HasExternalUnsignedByteElements(); 2192 inline bool HasExternalUnsignedByteElements();
2157 inline bool HasExternalShortElements(); 2193 inline bool HasExternalShortElements();
2158 inline bool HasExternalUnsignedShortElements(); 2194 inline bool HasExternalUnsignedShortElements();
2159 inline bool HasExternalIntElements(); 2195 inline bool HasExternalIntElements();
2160 inline bool HasExternalUnsignedIntElements(); 2196 inline bool HasExternalUnsignedIntElements();
2161 inline bool HasExternalFloatElements(); 2197 inline bool HasExternalFloatElements();
2162 inline bool HasExternalDoubleElements(); 2198 inline bool HasExternalDoubleElements();
2199
2200 inline bool HasFixedTypedArrayElements();
2201
2163 bool HasFastArgumentsElements(); 2202 bool HasFastArgumentsElements();
2164 bool HasDictionaryArgumentsElements(); 2203 bool HasDictionaryArgumentsElements();
2165 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. 2204 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements.
2166 2205
2167 inline void set_map_and_elements( 2206 inline void set_map_and_elements(
2168 Map* map, 2207 Map* map,
2169 FixedArrayBase* value, 2208 FixedArrayBase* value,
2170 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 2209 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
2171 2210
2172 // Requires: HasFastElements(). 2211 // Requires: HasFastElements().
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 inline void set_undefined(int index); 3014 inline void set_undefined(int index);
2976 inline void set_null(int index); 3015 inline void set_null(int index);
2977 inline void set_the_hole(int index); 3016 inline void set_the_hole(int index);
2978 3017
2979 inline Object** GetFirstElementAddress(); 3018 inline Object** GetFirstElementAddress();
2980 inline bool ContainsOnlySmisOrHoles(); 3019 inline bool ContainsOnlySmisOrHoles();
2981 3020
2982 // Gives access to raw memory which stores the array's data. 3021 // Gives access to raw memory which stores the array's data.
2983 inline Object** data_start(); 3022 inline Object** data_start();
2984 3023
3024 // Shrink length and insert filler objects.
3025 void Shrink(int length);
3026
2985 // Copy operations. 3027 // Copy operations.
2986 MUST_USE_RESULT inline MaybeObject* Copy(); 3028 MUST_USE_RESULT inline MaybeObject* Copy();
2987 MUST_USE_RESULT MaybeObject* CopySize(int new_length, 3029 MUST_USE_RESULT MaybeObject* CopySize(int new_length,
2988 PretenureFlag pretenure = NOT_TENURED); 3030 PretenureFlag pretenure = NOT_TENURED);
2989 3031
2990 // Add the elements of a JSArray to this FixedArray. 3032 // Add the elements of a JSArray to this FixedArray.
2991 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); 3033 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array);
2992 3034
2993 // Compute the union of this and other. 3035 // Compute the union of this and other.
2994 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other); 3036 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other);
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
3762 // StringTable. 3804 // StringTable.
3763 // 3805 //
3764 // No special elements in the prefix and the element size is 1 3806 // No special elements in the prefix and the element size is 1
3765 // because only the string itself (the key) needs to be stored. 3807 // because only the string itself (the key) needs to be stored.
3766 class StringTable: public HashTable<StringTableShape, HashTableKey*> { 3808 class StringTable: public HashTable<StringTableShape, HashTableKey*> {
3767 public: 3809 public:
3768 // Find string in the string table. If it is not there yet, it is 3810 // Find string in the string table. If it is not there yet, it is
3769 // added. The return value is the string table which might have 3811 // added. The return value is the string table which might have
3770 // been enlarged. If the return value is not a failure, the string 3812 // been enlarged. If the return value is not a failure, the string
3771 // pointer *s is set to the string found. 3813 // pointer *s is set to the string found.
3772 MUST_USE_RESULT MaybeObject* LookupUtf8String(
3773 Vector<const char> str,
3774 Object** s);
3775 MUST_USE_RESULT MaybeObject* LookupOneByteString(
3776 Vector<const uint8_t> str,
3777 Object** s);
3778 MUST_USE_RESULT MaybeObject* LookupSubStringOneByteString(
3779 Handle<SeqOneByteString> str,
3780 int from,
3781 int length,
3782 Object** s);
3783 MUST_USE_RESULT MaybeObject* LookupTwoByteString(
3784 Vector<const uc16> str,
3785 Object** s);
3786 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); 3814 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s);
3815 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s);
3787 3816
3788 // Looks up a string that is equal to the given string and returns 3817 // Looks up a string that is equal to the given string and returns
3789 // true if it is found, assigning the string to the given output 3818 // true if it is found, assigning the string to the given output
3790 // parameter. 3819 // parameter.
3791 bool LookupStringIfExists(String* str, String** result); 3820 bool LookupStringIfExists(String* str, String** result);
3792 bool LookupTwoCharsStringIfExists(uint16_t c1, uint16_t c2, String** result); 3821 bool LookupTwoCharsStringIfExists(uint16_t c1, uint16_t c2, String** result);
3793 3822
3794 // Casting. 3823 // Casting.
3795 static inline StringTable* cast(Object* obj); 3824 static inline StringTable* cast(Object* obj);
3796 3825
3797 private: 3826 private:
3798 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s);
3799
3800 template <bool seq_ascii> friend class JsonParser; 3827 template <bool seq_ascii> friend class JsonParser;
3801 3828
3802 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); 3829 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable);
3803 }; 3830 };
3804 3831
3805 3832
3806 class MapCacheShape : public BaseShape<HashTableKey*> { 3833 class MapCacheShape : public BaseShape<HashTableKey*> {
3807 public: 3834 public:
3808 static inline bool IsMatch(HashTableKey* key, Object* value) { 3835 static inline bool IsMatch(HashTableKey* key, Object* value) {
3809 return key->IsMatch(value); 3836 return key->IsMatch(value);
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
4862 4889
4863 // Dispatched behavior. 4890 // Dispatched behavior.
4864 DECLARE_PRINTER(ExternalDoubleArray) 4891 DECLARE_PRINTER(ExternalDoubleArray)
4865 DECLARE_VERIFIER(ExternalDoubleArray) 4892 DECLARE_VERIFIER(ExternalDoubleArray)
4866 4893
4867 private: 4894 private:
4868 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray); 4895 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray);
4869 }; 4896 };
4870 4897
4871 4898
4899 class FixedTypedArrayBase: public FixedArrayBase {
4900 public:
4901 // Casting:
4902 static inline FixedTypedArrayBase* cast(Object* obj);
4903
4904 static const int kDataOffset = kHeaderSize;
4905
4906 inline int size();
4907
4908 private:
4909 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase);
4910 };
4911
4912
4913 template <class Traits>
4914 class FixedTypedArray: public FixedTypedArrayBase {
4915 public:
4916 typedef typename Traits::ElementType ElementType;
4917 static const InstanceType kInstanceType = Traits::kInstanceType;
4918
4919 // Casting:
4920 static inline FixedTypedArray<Traits>* cast(Object* obj);
4921
4922 static inline int SizeFor(int length) {
4923 return kDataOffset + length * sizeof(ElementType);
4924 }
4925
4926 inline ElementType get_scalar(int index);
4927 MUST_USE_RESULT inline MaybeObject* get(int index);
4928 inline void set(int index, ElementType value);
4929
4930 // This accessor applies the correct conversion from Smi, HeapNumber
4931 // and undefined.
4932 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4933
4934 static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array,
4935 uint32_t index,
4936 Handle<Object> value);
4937
4938 DECLARE_PRINTER(FixedTypedArray)
4939 DECLARE_VERIFIER(FixedTypedArray)
4940
4941 private:
4942 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
4943 };
4944
4945 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType) \
4946 class Type##ArrayTraits { \
4947 public: \
4948 typedef elementType ElementType; \
4949 static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE; \
4950 static const char* Designator() { return #type " array"; } \
4951 static inline MaybeObject* ToObject(Heap* heap, elementType scalar); \
4952 static elementType defaultValue() { return 0; } \
4953 }; \
4954 \
4955 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
4956
4957 FIXED_TYPED_ARRAY_TRAITS(Uint8, uint8, UINT8, uint8_t)
4958 FIXED_TYPED_ARRAY_TRAITS(Int8, int8, INT8, int8_t)
4959 FIXED_TYPED_ARRAY_TRAITS(Uint16, uint16, UINT16, uint16_t)
4960 FIXED_TYPED_ARRAY_TRAITS(Int16, int16, INT16, int16_t)
4961 FIXED_TYPED_ARRAY_TRAITS(Uint32, uint32, UINT32, uint32_t)
4962 FIXED_TYPED_ARRAY_TRAITS(Int32, int32, INT32, int32_t)
4963 FIXED_TYPED_ARRAY_TRAITS(Float32, float32, FLOAT32, float)
4964 FIXED_TYPED_ARRAY_TRAITS(Float64, float64, FLOAT64, double)
4965 FIXED_TYPED_ARRAY_TRAITS(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t)
4966
4967 #undef FIXED_TYPED_ARRAY_TRAITS
4968
4872 // DeoptimizationInputData is a fixed array used to hold the deoptimization 4969 // DeoptimizationInputData is a fixed array used to hold the deoptimization
4873 // data for code generated by the Hydrogen/Lithium compiler. It also 4970 // data for code generated by the Hydrogen/Lithium compiler. It also
4874 // contains information about functions that were inlined. If N different 4971 // contains information about functions that were inlined. If N different
4875 // functions were inlined then first N elements of the literal array will 4972 // functions were inlined then first N elements of the literal array will
4876 // contain these functions. 4973 // contain these functions.
4877 // 4974 //
4878 // It can be empty. 4975 // It can be empty.
4879 class DeoptimizationInputData: public FixedArray { 4976 class DeoptimizationInputData: public FixedArray {
4880 public: 4977 public:
4881 // Layout description. Indices in the array. 4978 // Layout description. Indices in the array.
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5174 inline ExtraICState extended_extra_ic_state(); // Only valid for 5271 inline ExtraICState extended_extra_ic_state(); // Only valid for
5175 // non-call IC stubs. 5272 // non-call IC stubs.
5176 static bool needs_extended_extra_ic_state(Kind kind) { 5273 static bool needs_extended_extra_ic_state(Kind kind) {
5177 // TODO(danno): This is a bit of a hack right now since there are still 5274 // TODO(danno): This is a bit of a hack right now since there are still
5178 // clients of this API that pass "extra" values in for argc. These clients 5275 // clients of this API that pass "extra" values in for argc. These clients
5179 // should be retrofitted to used ExtendedExtraICState. 5276 // should be retrofitted to used ExtendedExtraICState.
5180 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC || 5277 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC ||
5181 kind == BINARY_OP_IC; 5278 kind == BINARY_OP_IC;
5182 } 5279 }
5183 5280
5184 bool IsContextual(); // Only valid for IC stubs.
5185 inline StubType type(); // Only valid for monomorphic IC stubs. 5281 inline StubType type(); // Only valid for monomorphic IC stubs.
5186 inline int arguments_count(); // Only valid for call IC stubs. 5282 inline int arguments_count(); // Only valid for call IC stubs.
5187 5283
5188 // Testers for IC stub kinds. 5284 // Testers for IC stub kinds.
5189 inline bool is_inline_cache_stub(); 5285 inline bool is_inline_cache_stub();
5190 inline bool is_debug_stub(); 5286 inline bool is_debug_stub();
5191 inline bool is_handler() { return kind() == HANDLER; } 5287 inline bool is_handler() { return kind() == HANDLER; }
5192 inline bool is_load_stub() { return kind() == LOAD_IC; } 5288 inline bool is_load_stub() { return kind() == LOAD_IC; }
5193 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 5289 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
5194 inline bool is_store_stub() { return kind() == STORE_IC; } 5290 inline bool is_store_stub() { return kind() == STORE_IC; }
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
5871 } 5967 }
5872 5968
5873 inline bool has_non_strict_arguments_elements() { 5969 inline bool has_non_strict_arguments_elements() {
5874 return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; 5970 return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
5875 } 5971 }
5876 5972
5877 inline bool has_external_array_elements() { 5973 inline bool has_external_array_elements() {
5878 return IsExternalArrayElementsKind(elements_kind()); 5974 return IsExternalArrayElementsKind(elements_kind());
5879 } 5975 }
5880 5976
5977 inline bool has_fixed_typed_array_elements() {
5978 return IsFixedTypedArrayElementsKind(elements_kind());
5979 }
5980
5881 inline bool has_dictionary_elements() { 5981 inline bool has_dictionary_elements() {
5882 return IsDictionaryElementsKind(elements_kind()); 5982 return IsDictionaryElementsKind(elements_kind());
5883 } 5983 }
5884 5984
5885 inline bool has_slow_elements_kind() { 5985 inline bool has_slow_elements_kind() {
5886 return elements_kind() == DICTIONARY_ELEMENTS 5986 return elements_kind() == DICTIONARY_ELEMENTS
5887 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; 5987 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
5888 } 5988 }
5889 5989
5890 static bool IsValidElementsTransition(ElementsKind from_kind, 5990 static bool IsValidElementsTransition(ElementsKind from_kind,
(...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after
9448 kSize> BodyDescriptor; 9548 kSize> BodyDescriptor;
9449 9549
9450 private: 9550 private:
9451 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); 9551 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell);
9452 }; 9552 };
9453 9553
9454 9554
9455 class PropertyCell: public Cell { 9555 class PropertyCell: public Cell {
9456 public: 9556 public:
9457 // [type]: type of the global property. 9557 // [type]: type of the global property.
9458 Type* type(); 9558 HeapType* type();
9459 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 9559 void set_type(HeapType* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
9460 9560
9461 // [dependent_code]: dependent code that depends on the type of the global 9561 // [dependent_code]: dependent code that depends on the type of the global
9462 // property. 9562 // property.
9463 DECL_ACCESSORS(dependent_code, DependentCode) 9563 DECL_ACCESSORS(dependent_code, DependentCode)
9464 9564
9465 // Sets the value of the cell and updates the type field to be the union 9565 // Sets the value of the cell and updates the type field to be the union
9466 // of the cell's current type and the value's type. If the change causes 9566 // of the cell's current type and the value's type. If the change causes
9467 // a change of the type of the cell's contents, code dependent on the cell 9567 // a change of the type of the cell's contents, code dependent on the cell
9468 // will be deoptimized. 9568 // will be deoptimized.
9469 static void SetValueInferType(Handle<PropertyCell> cell, 9569 static void SetValueInferType(Handle<PropertyCell> cell,
9470 Handle<Object> value); 9570 Handle<Object> value);
9471 9571
9472 // Computes the new type of the cell's contents for the given value, but 9572 // Computes the new type of the cell's contents for the given value, but
9473 // without actually modifying the 'type' field. 9573 // without actually modifying the 'type' field.
9474 static Handle<Type> UpdatedType(Handle<PropertyCell> cell, 9574 static Handle<HeapType> UpdatedType(Handle<PropertyCell> cell,
9475 Handle<Object> value); 9575 Handle<Object> value);
9476 9576
9477 void AddDependentCompilationInfo(CompilationInfo* info); 9577 void AddDependentCompilationInfo(CompilationInfo* info);
9478 9578
9479 void AddDependentCode(Handle<Code> code); 9579 void AddDependentCode(Handle<Code> code);
9480 9580
9481 // Casting. 9581 // Casting.
9482 static inline PropertyCell* cast(Object* obj); 9582 static inline PropertyCell* cast(Object* obj);
9483 9583
9484 inline Address TypeAddress() { 9584 inline Address TypeAddress() {
9485 return address() + kTypeOffset; 9585 return address() + kTypeOffset;
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
10699 } else { 10799 } else {
10700 value &= ~(1 << bit_position); 10800 value &= ~(1 << bit_position);
10701 } 10801 }
10702 return value; 10802 return value;
10703 } 10803 }
10704 }; 10804 };
10705 10805
10706 } } // namespace v8::internal 10806 } } // namespace v8::internal
10707 10807
10708 #endif // V8_OBJECTS_H_ 10808 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698