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

Side by Side Diff: src/objects.h

Issue 208503007: Revert "This implements allocating small typed arrays in heap." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/hydrogen.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 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 inline bool HasExternalUint8Elements(); 2210 inline bool HasExternalUint8Elements();
2211 inline bool HasExternalInt16Elements(); 2211 inline bool HasExternalInt16Elements();
2212 inline bool HasExternalUint16Elements(); 2212 inline bool HasExternalUint16Elements();
2213 inline bool HasExternalInt32Elements(); 2213 inline bool HasExternalInt32Elements();
2214 inline bool HasExternalUint32Elements(); 2214 inline bool HasExternalUint32Elements();
2215 inline bool HasExternalFloat32Elements(); 2215 inline bool HasExternalFloat32Elements();
2216 inline bool HasExternalFloat64Elements(); 2216 inline bool HasExternalFloat64Elements();
2217 2217
2218 inline bool HasFixedTypedArrayElements(); 2218 inline bool HasFixedTypedArrayElements();
2219 2219
2220 inline bool HasFixedUint8ClampedElements();
2221 inline bool HasFixedArrayElements();
2222 inline bool HasFixedInt8Elements();
2223 inline bool HasFixedUint8Elements();
2224 inline bool HasFixedInt16Elements();
2225 inline bool HasFixedUint16Elements();
2226 inline bool HasFixedInt32Elements();
2227 inline bool HasFixedUint32Elements();
2228 inline bool HasFixedFloat32Elements();
2229 inline bool HasFixedFloat64Elements();
2230
2231 bool HasFastArgumentsElements(); 2220 bool HasFastArgumentsElements();
2232 bool HasDictionaryArgumentsElements(); 2221 bool HasDictionaryArgumentsElements();
2233 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. 2222 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements.
2234 2223
2235 inline void set_map_and_elements( 2224 inline void set_map_and_elements(
2236 Map* map, 2225 Map* map,
2237 FixedArrayBase* value, 2226 FixedArrayBase* value,
2238 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 2227 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
2239 2228
2240 // Requires: HasFastElements(). 2229 // Requires: HasFastElements().
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
4966 4955
4967 class FixedTypedArrayBase: public FixedArrayBase { 4956 class FixedTypedArrayBase: public FixedArrayBase {
4968 public: 4957 public:
4969 // Casting: 4958 // Casting:
4970 static inline FixedTypedArrayBase* cast(Object* obj); 4959 static inline FixedTypedArrayBase* cast(Object* obj);
4971 4960
4972 static const int kDataOffset = kHeaderSize; 4961 static const int kDataOffset = kHeaderSize;
4973 4962
4974 inline int size(); 4963 inline int size();
4975 4964
4976 // Use with care: returns raw pointer into heap.
4977 inline void* DataPtr();
4978
4979 inline int DataSize();
4980
4981 private: 4965 private:
4982 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase); 4966 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase);
4983 }; 4967 };
4984 4968
4985 4969
4986 template <class Traits> 4970 template <class Traits>
4987 class FixedTypedArray: public FixedTypedArrayBase { 4971 class FixedTypedArray: public FixedTypedArrayBase {
4988 public: 4972 public:
4989 typedef typename Traits::ElementType ElementType; 4973 typedef typename Traits::ElementType ElementType;
4990 static const InstanceType kInstanceType = Traits::kInstanceType; 4974 static const InstanceType kInstanceType = Traits::kInstanceType;
4991 4975
4992 // Casting: 4976 // Casting:
4993 static inline FixedTypedArray<Traits>* cast(Object* obj); 4977 static inline FixedTypedArray<Traits>* cast(Object* obj);
4994 4978
4995 static inline int ElementOffset(int index) { 4979 static inline int ElementOffset(int index) {
4996 return kDataOffset + index * sizeof(ElementType); 4980 return kDataOffset + index * sizeof(ElementType);
4997 } 4981 }
4998 4982
4999 static inline int SizeFor(int length) { 4983 static inline int SizeFor(int length) {
5000 return ElementOffset(length); 4984 return ElementOffset(length);
5001 } 4985 }
5002 4986
5003 inline ElementType get_scalar(int index); 4987 inline ElementType get_scalar(int index);
5004 MUST_USE_RESULT inline MaybeObject* get(int index); 4988 MUST_USE_RESULT inline MaybeObject* get(int index);
5005 inline void set(int index, ElementType value); 4989 inline void set(int index, ElementType value);
5006 4990
5007 static inline ElementType from_int(int value);
5008 static inline ElementType from_double(double value);
5009
5010 // This accessor applies the correct conversion from Smi, HeapNumber 4991 // This accessor applies the correct conversion from Smi, HeapNumber
5011 // and undefined. 4992 // and undefined.
5012 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4993 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5013 4994
5014 static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array, 4995 static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array,
5015 uint32_t index, 4996 uint32_t index,
5016 Handle<Object> value); 4997 Handle<Object> value);
5017 4998
5018 DECLARE_PRINTER(FixedTypedArray) 4999 DECLARE_PRINTER(FixedTypedArray)
5019 DECLARE_VERIFIER(FixedTypedArray) 5000 DECLARE_VERIFIER(FixedTypedArray)
5020 5001
5021 private: 5002 private:
5022 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); 5003 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
5023 }; 5004 };
5024 5005
5025 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ 5006 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \
5026 class Type##ArrayTraits { \ 5007 class Type##ArrayTraits { \
5027 public: \ 5008 public: \
5028 typedef elementType ElementType; \ 5009 typedef elementType ElementType; \
5029 static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE; \ 5010 static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE; \
5030 static const char* Designator() { return #type " array"; } \ 5011 static const char* Designator() { return #type " array"; } \
5031 static inline MaybeObject* ToObject(Heap* heap, elementType scalar); \ 5012 static inline MaybeObject* ToObject(Heap* heap, elementType scalar); \
5032 static inline elementType defaultValue(); \ 5013 static elementType defaultValue() { return 0; } \
5033 }; \ 5014 }; \
5034 \ 5015 \
5035 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; 5016 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
5036 5017
5037 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) 5018 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS)
5038 5019
5039 #undef FIXED_TYPED_ARRAY_TRAITS 5020 #undef FIXED_TYPED_ARRAY_TRAITS
5040 5021
5041 // DeoptimizationInputData is a fixed array used to hold the deoptimization 5022 // DeoptimizationInputData is a fixed array used to hold the deoptimization
5042 // data for code generated by the Hydrogen/Lithium compiler. It also 5023 // data for code generated by the Hydrogen/Lithium compiler. It also
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
6242 Descriptor* descriptor); 6223 Descriptor* descriptor);
6243 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, 6224 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor,
6244 TransitionFlag flag); 6225 TransitionFlag flag);
6245 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, 6226 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor,
6246 TransitionFlag flag); 6227 TransitionFlag flag);
6247 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( 6228 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor(
6248 DescriptorArray* descriptors, 6229 DescriptorArray* descriptors,
6249 Descriptor* descriptor, 6230 Descriptor* descriptor,
6250 int index, 6231 int index,
6251 TransitionFlag flag); 6232 TransitionFlag flag);
6252 6233 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind);
6253 MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind); 6234 MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind);
6254 6235
6255 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind);
6256
6257 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, 6236 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind,
6258 TransitionFlag flag); 6237 TransitionFlag flag);
6259 6238
6260 static Handle<Map> CopyForObserved(Handle<Map> map); 6239 static Handle<Map> CopyForObserved(Handle<Map> map);
6261 6240
6262 static Handle<Map> CopyNormalized(Handle<Map> map, 6241 static Handle<Map> CopyNormalized(Handle<Map> map,
6263 PropertyNormalizationMode mode, 6242 PropertyNormalizationMode mode,
6264 NormalizedMapSharingMode sharing); 6243 NormalizedMapSharingMode sharing);
6265 6244
6266 inline void AppendDescriptor(Descriptor* desc, 6245 inline void AppendDescriptor(Descriptor* desc,
(...skipping 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after
9935 9914
9936 // Neutering. Only neuters this typed array. 9915 // Neutering. Only neuters this typed array.
9937 void Neuter(); 9916 void Neuter();
9938 9917
9939 // Casting. 9918 // Casting.
9940 static inline JSTypedArray* cast(Object* obj); 9919 static inline JSTypedArray* cast(Object* obj);
9941 9920
9942 ExternalArrayType type(); 9921 ExternalArrayType type();
9943 size_t element_size(); 9922 size_t element_size();
9944 9923
9945 Handle<JSArrayBuffer> GetBuffer();
9946
9947 // Dispatched behavior. 9924 // Dispatched behavior.
9948 DECLARE_PRINTER(JSTypedArray) 9925 DECLARE_PRINTER(JSTypedArray)
9949 DECLARE_VERIFIER(JSTypedArray) 9926 DECLARE_VERIFIER(JSTypedArray)
9950 9927
9951 static const int kLengthOffset = kViewSize + kPointerSize; 9928 static const int kLengthOffset = kViewSize + kPointerSize;
9952 static const int kSize = kLengthOffset + kPointerSize; 9929 static const int kSize = kLengthOffset + kPointerSize;
9953 9930
9954 static const int kSizeWithInternalFields = 9931 static const int kSizeWithInternalFields =
9955 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 9932 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize;
9956 9933
9957 private: 9934 private:
9958 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
9959 Handle<JSTypedArray> typed_array);
9960
9961 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 9935 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
9962 }; 9936 };
9963 9937
9964 9938
9965 class JSDataView: public JSArrayBufferView { 9939 class JSDataView: public JSArrayBufferView {
9966 public: 9940 public:
9967 // Only neuters this DataView 9941 // Only neuters this DataView
9968 void Neuter(); 9942 void Neuter();
9969 9943
9970 // Casting. 9944 // Casting.
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
10817 } else { 10791 } else {
10818 value &= ~(1 << bit_position); 10792 value &= ~(1 << bit_position);
10819 } 10793 }
10820 return value; 10794 return value;
10821 } 10795 }
10822 }; 10796 };
10823 10797
10824 } } // namespace v8::internal 10798 } } // namespace v8::internal
10825 10799
10826 #endif // V8_OBJECTS_H_ 10800 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698