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

Side by Side Diff: src/objects.h

Issue 132233012: Revert "Implement in-heap backing store for typed arrays." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/ic.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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 /* Object::IsExternalArray(). */ \ 379 /* Object::IsExternalArray(). */ \
380 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 380 V(EXTERNAL_BYTE_ARRAY_TYPE) \
381 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ 381 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \
382 V(EXTERNAL_SHORT_ARRAY_TYPE) \ 382 V(EXTERNAL_SHORT_ARRAY_TYPE) \
383 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ 383 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \
384 V(EXTERNAL_INT_ARRAY_TYPE) \ 384 V(EXTERNAL_INT_ARRAY_TYPE) \
385 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ 385 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \
386 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ 386 V(EXTERNAL_FLOAT_ARRAY_TYPE) \
387 V(EXTERNAL_DOUBLE_ARRAY_TYPE) \ 387 V(EXTERNAL_DOUBLE_ARRAY_TYPE) \
388 V(EXTERNAL_PIXEL_ARRAY_TYPE) \ 388 V(EXTERNAL_PIXEL_ARRAY_TYPE) \
389 \
390 V(FIXED_INT8_ARRAY_TYPE) \
391 V(FIXED_UINT8_ARRAY_TYPE) \
392 V(FIXED_INT16_ARRAY_TYPE) \
393 V(FIXED_UINT16_ARRAY_TYPE) \
394 V(FIXED_INT32_ARRAY_TYPE) \
395 V(FIXED_UINT32_ARRAY_TYPE) \
396 V(FIXED_FLOAT32_ARRAY_TYPE) \
397 V(FIXED_FLOAT64_ARRAY_TYPE) \
398 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
399 \
400 V(FILLER_TYPE) \ 389 V(FILLER_TYPE) \
401 \ 390 \
402 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \ 391 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \
403 V(DECLARED_ACCESSOR_INFO_TYPE) \ 392 V(DECLARED_ACCESSOR_INFO_TYPE) \
404 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ 393 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \
405 V(ACCESSOR_PAIR_TYPE) \ 394 V(ACCESSOR_PAIR_TYPE) \
406 V(ACCESS_CHECK_INFO_TYPE) \ 395 V(ACCESS_CHECK_INFO_TYPE) \
407 V(INTERCEPTOR_INFO_TYPE) \ 396 V(INTERCEPTOR_INFO_TYPE) \
408 V(CALL_HANDLER_INFO_TYPE) \ 397 V(CALL_HANDLER_INFO_TYPE) \
409 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 398 V(FUNCTION_TEMPLATE_INFO_TYPE) \
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 FREE_SPACE_TYPE, 713 FREE_SPACE_TYPE,
725 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 714 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
726 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 715 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
727 EXTERNAL_SHORT_ARRAY_TYPE, 716 EXTERNAL_SHORT_ARRAY_TYPE,
728 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 717 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
729 EXTERNAL_INT_ARRAY_TYPE, 718 EXTERNAL_INT_ARRAY_TYPE,
730 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 719 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
731 EXTERNAL_FLOAT_ARRAY_TYPE, 720 EXTERNAL_FLOAT_ARRAY_TYPE,
732 EXTERNAL_DOUBLE_ARRAY_TYPE, 721 EXTERNAL_DOUBLE_ARRAY_TYPE,
733 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 722 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
734
735 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
736 FIXED_UINT8_ARRAY_TYPE,
737 FIXED_INT16_ARRAY_TYPE,
738 FIXED_UINT16_ARRAY_TYPE,
739 FIXED_INT32_ARRAY_TYPE,
740 FIXED_UINT32_ARRAY_TYPE,
741 FIXED_FLOAT32_ARRAY_TYPE,
742 FIXED_FLOAT64_ARRAY_TYPE,
743 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE
744
745 FIXED_DOUBLE_ARRAY_TYPE, 723 FIXED_DOUBLE_ARRAY_TYPE,
746 FILLER_TYPE, // LAST_DATA_TYPE 724 FILLER_TYPE, // LAST_DATA_TYPE
747 725
748 // Structs. 726 // Structs.
749 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, 727 DECLARED_ACCESSOR_DESCRIPTOR_TYPE,
750 DECLARED_ACCESSOR_INFO_TYPE, 728 DECLARED_ACCESSOR_INFO_TYPE,
751 EXECUTABLE_ACCESSOR_INFO_TYPE, 729 EXECUTABLE_ACCESSOR_INFO_TYPE,
752 ACCESSOR_PAIR_TYPE, 730 ACCESSOR_PAIR_TYPE,
753 ACCESS_CHECK_INFO_TYPE, 731 ACCESS_CHECK_INFO_TYPE,
754 INTERCEPTOR_INFO_TYPE, 732 INTERCEPTOR_INFO_TYPE,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 FIRST_TYPE = 0x0, 790 FIRST_TYPE = 0x0,
813 LAST_TYPE = JS_FUNCTION_TYPE, 791 LAST_TYPE = JS_FUNCTION_TYPE,
814 FIRST_NAME_TYPE = FIRST_TYPE, 792 FIRST_NAME_TYPE = FIRST_TYPE,
815 LAST_NAME_TYPE = SYMBOL_TYPE, 793 LAST_NAME_TYPE = SYMBOL_TYPE,
816 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 794 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
817 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 795 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
818 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, 796 FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
819 // Boundaries for testing for an external array. 797 // Boundaries for testing for an external array.
820 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 798 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
821 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, 799 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
822 // Boundaries for testing for a fixed typed array.
823 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
824 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
825 // Boundary for promotion to old data space/old pointer space. 800 // Boundary for promotion to old data space/old pointer space.
826 LAST_DATA_TYPE = FILLER_TYPE, 801 LAST_DATA_TYPE = FILLER_TYPE,
827 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 802 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
828 // Note that there is no range for JSObject or JSProxy, since their subtypes 803 // Note that there is no range for JSObject or JSProxy, since their subtypes
829 // are not continuous in this enum! The enum ranges instead reflect the 804 // are not continuous in this enum! The enum ranges instead reflect the
830 // external class names, where proxies are treated as either ordinary objects, 805 // external class names, where proxies are treated as either ordinary objects,
831 // or functions. 806 // or functions.
832 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE, 807 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE,
833 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 808 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
834 // Boundaries for testing the types represented as JSObject 809 // Boundaries for testing the types represented as JSObject
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 V(ExternalArray) \ 982 V(ExternalArray) \
1008 V(ExternalByteArray) \ 983 V(ExternalByteArray) \
1009 V(ExternalUnsignedByteArray) \ 984 V(ExternalUnsignedByteArray) \
1010 V(ExternalShortArray) \ 985 V(ExternalShortArray) \
1011 V(ExternalUnsignedShortArray) \ 986 V(ExternalUnsignedShortArray) \
1012 V(ExternalIntArray) \ 987 V(ExternalIntArray) \
1013 V(ExternalUnsignedIntArray) \ 988 V(ExternalUnsignedIntArray) \
1014 V(ExternalFloatArray) \ 989 V(ExternalFloatArray) \
1015 V(ExternalDoubleArray) \ 990 V(ExternalDoubleArray) \
1016 V(ExternalPixelArray) \ 991 V(ExternalPixelArray) \
1017 V(FixedTypedArrayBase) \
1018 V(FixedUint8Array) \
1019 V(FixedInt8Array) \
1020 V(FixedUint16Array) \
1021 V(FixedInt16Array) \
1022 V(FixedUint32Array) \
1023 V(FixedInt32Array) \
1024 V(FixedFloat32Array) \
1025 V(FixedFloat64Array) \
1026 V(FixedUint8ClampedArray) \
1027 V(ByteArray) \ 992 V(ByteArray) \
1028 V(FreeSpace) \ 993 V(FreeSpace) \
1029 V(JSReceiver) \ 994 V(JSReceiver) \
1030 V(JSObject) \ 995 V(JSObject) \
1031 V(JSContextExtensionObject) \ 996 V(JSContextExtensionObject) \
1032 V(JSGeneratorObject) \ 997 V(JSGeneratorObject) \
1033 V(JSModule) \ 998 V(JSModule) \
1034 V(Map) \ 999 V(Map) \
1035 V(DescriptorArray) \ 1000 V(DescriptorArray) \
1036 V(TransitionArray) \ 1001 V(TransitionArray) \
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 // Returns true if an object has any of the fast elements kinds. 2102 // Returns true if an object has any of the fast elements kinds.
2138 inline bool HasFastElements(); 2103 inline bool HasFastElements();
2139 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS 2104 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
2140 // ElementsKind. 2105 // ElementsKind.
2141 inline bool HasFastDoubleElements(); 2106 inline bool HasFastDoubleElements();
2142 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS 2107 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
2143 // ElementsKind. 2108 // ElementsKind.
2144 inline bool HasFastHoleyElements(); 2109 inline bool HasFastHoleyElements();
2145 inline bool HasNonStrictArgumentsElements(); 2110 inline bool HasNonStrictArgumentsElements();
2146 inline bool HasDictionaryElements(); 2111 inline bool HasDictionaryElements();
2147
2148 inline bool HasExternalPixelElements(); 2112 inline bool HasExternalPixelElements();
2149 inline bool HasExternalArrayElements(); 2113 inline bool HasExternalArrayElements();
2150 inline bool HasExternalByteElements(); 2114 inline bool HasExternalByteElements();
2151 inline bool HasExternalUnsignedByteElements(); 2115 inline bool HasExternalUnsignedByteElements();
2152 inline bool HasExternalShortElements(); 2116 inline bool HasExternalShortElements();
2153 inline bool HasExternalUnsignedShortElements(); 2117 inline bool HasExternalUnsignedShortElements();
2154 inline bool HasExternalIntElements(); 2118 inline bool HasExternalIntElements();
2155 inline bool HasExternalUnsignedIntElements(); 2119 inline bool HasExternalUnsignedIntElements();
2156 inline bool HasExternalFloatElements(); 2120 inline bool HasExternalFloatElements();
2157 inline bool HasExternalDoubleElements(); 2121 inline bool HasExternalDoubleElements();
2158
2159 inline bool HasFixedTypedArrayElements();
2160
2161 bool HasFastArgumentsElements(); 2122 bool HasFastArgumentsElements();
2162 bool HasDictionaryArgumentsElements(); 2123 bool HasDictionaryArgumentsElements();
2163 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. 2124 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements.
2164 2125
2165 inline void set_map_and_elements( 2126 inline void set_map_and_elements(
2166 Map* map, 2127 Map* map,
2167 FixedArrayBase* value, 2128 FixedArrayBase* value,
2168 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 2129 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
2169 2130
2170 // Requires: HasFastElements(). 2131 // Requires: HasFastElements().
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after
4860 4821
4861 // Dispatched behavior. 4822 // Dispatched behavior.
4862 DECLARE_PRINTER(ExternalDoubleArray) 4823 DECLARE_PRINTER(ExternalDoubleArray)
4863 DECLARE_VERIFIER(ExternalDoubleArray) 4824 DECLARE_VERIFIER(ExternalDoubleArray)
4864 4825
4865 private: 4826 private:
4866 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray); 4827 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray);
4867 }; 4828 };
4868 4829
4869 4830
4870 class FixedTypedArrayBase: public FixedArrayBase {
4871 public:
4872 // Casting:
4873 static inline FixedTypedArrayBase* cast(Object* obj);
4874
4875 static const int kDataOffset = kHeaderSize;
4876
4877 inline int size();
4878
4879 private:
4880 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase);
4881 };
4882
4883
4884 template <class Traits>
4885 class FixedTypedArray: public FixedTypedArrayBase {
4886 public:
4887 typedef typename Traits::ElementType ElementType;
4888 static const InstanceType kInstanceType = Traits::kInstanceType;
4889
4890 // Casting:
4891 static inline FixedTypedArray<Traits>* cast(Object* obj);
4892
4893 static inline int SizeFor(int length) {
4894 return kDataOffset + length * sizeof(ElementType);
4895 }
4896
4897 inline ElementType get_scalar(int index);
4898 MUST_USE_RESULT inline MaybeObject* get(int index);
4899 inline void set(int index, ElementType value);
4900
4901 // This accessor applies the correct conversion from Smi, HeapNumber
4902 // and undefined.
4903 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4904
4905 static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array,
4906 uint32_t index,
4907 Handle<Object> value);
4908
4909 DECLARE_PRINTER(FixedTypedArray)
4910 DECLARE_VERIFIER(FixedTypedArray)
4911
4912 private:
4913 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
4914 };
4915
4916 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType) \
4917 class Type##ArrayTraits { \
4918 public: \
4919 typedef elementType ElementType; \
4920 static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE; \
4921 static const char* Designator() { return #type " array"; } \
4922 static inline MaybeObject* ToObject(Heap* heap, elementType scalar); \
4923 static elementType defaultValue() { return 0; } \
4924 }; \
4925 \
4926 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
4927
4928 FIXED_TYPED_ARRAY_TRAITS(Uint8, uint8, UINT8, uint8_t)
4929 FIXED_TYPED_ARRAY_TRAITS(Int8, int8, INT8, int8_t)
4930 FIXED_TYPED_ARRAY_TRAITS(Uint16, uint16, UINT16, uint16_t)
4931 FIXED_TYPED_ARRAY_TRAITS(Int16, int16, INT16, int16_t)
4932 FIXED_TYPED_ARRAY_TRAITS(Uint32, uint32, UINT32, uint32_t)
4933 FIXED_TYPED_ARRAY_TRAITS(Int32, int32, INT32, int32_t)
4934 FIXED_TYPED_ARRAY_TRAITS(Float32, float32, FLOAT32, float)
4935 FIXED_TYPED_ARRAY_TRAITS(Float64, float64, FLOAT64, double)
4936 FIXED_TYPED_ARRAY_TRAITS(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t)
4937
4938 #undef FIXED_TYPED_ARRAY_TRAITS
4939
4940 // DeoptimizationInputData is a fixed array used to hold the deoptimization 4831 // DeoptimizationInputData is a fixed array used to hold the deoptimization
4941 // data for code generated by the Hydrogen/Lithium compiler. It also 4832 // data for code generated by the Hydrogen/Lithium compiler. It also
4942 // contains information about functions that were inlined. If N different 4833 // contains information about functions that were inlined. If N different
4943 // functions were inlined then first N elements of the literal array will 4834 // functions were inlined then first N elements of the literal array will
4944 // contain these functions. 4835 // contain these functions.
4945 // 4836 //
4946 // It can be empty. 4837 // It can be empty.
4947 class DeoptimizationInputData: public FixedArray { 4838 class DeoptimizationInputData: public FixedArray {
4948 public: 4839 public:
4949 // Layout description. Indices in the array. 4840 // Layout description. Indices in the array.
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
5939 } 5830 }
5940 5831
5941 inline bool has_non_strict_arguments_elements() { 5832 inline bool has_non_strict_arguments_elements() {
5942 return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; 5833 return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
5943 } 5834 }
5944 5835
5945 inline bool has_external_array_elements() { 5836 inline bool has_external_array_elements() {
5946 return IsExternalArrayElementsKind(elements_kind()); 5837 return IsExternalArrayElementsKind(elements_kind());
5947 } 5838 }
5948 5839
5949 inline bool has_fixed_typed_array_elements() {
5950 return IsFixedTypedArrayElementsKind(elements_kind());
5951 }
5952
5953 inline bool has_dictionary_elements() { 5840 inline bool has_dictionary_elements() {
5954 return IsDictionaryElementsKind(elements_kind()); 5841 return IsDictionaryElementsKind(elements_kind());
5955 } 5842 }
5956 5843
5957 inline bool has_slow_elements_kind() { 5844 inline bool has_slow_elements_kind() {
5958 return elements_kind() == DICTIONARY_ELEMENTS 5845 return elements_kind() == DICTIONARY_ELEMENTS
5959 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; 5846 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
5960 } 5847 }
5961 5848
5962 static bool IsValidElementsTransition(ElementsKind from_kind, 5849 static bool IsValidElementsTransition(ElementsKind from_kind,
(...skipping 4808 matching lines...) Expand 10 before | Expand all | Expand 10 after
10771 } else { 10658 } else {
10772 value &= ~(1 << bit_position); 10659 value &= ~(1 << bit_position);
10773 } 10660 }
10774 return value; 10661 return value;
10775 } 10662 }
10776 }; 10663 };
10777 10664
10778 } } // namespace v8::internal 10665 } } // namespace v8::internal
10779 10666
10780 #endif // V8_OBJECTS_H_ 10667 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698