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

Side by Side Diff: src/objects.h

Issue 699613004: Revert "In-object double fields unboxing (for 64-bit only)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/layout-descriptor-inl.h ('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 // 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_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 851
852 852
853 class AccessorPair; 853 class AccessorPair;
854 class AllocationSite; 854 class AllocationSite;
855 class AllocationSiteCreationContext; 855 class AllocationSiteCreationContext;
856 class AllocationSiteUsageContext; 856 class AllocationSiteUsageContext;
857 class DictionaryElementsAccessor; 857 class DictionaryElementsAccessor;
858 class ElementsAccessor; 858 class ElementsAccessor;
859 class FixedArrayBase; 859 class FixedArrayBase;
860 class GlobalObject; 860 class GlobalObject;
861 class LayoutDescriptor; 861 class ObjectVisitor;
862 class LookupIterator; 862 class LookupIterator;
863 class ObjectVisitor;
864 class StringStream; 863 class StringStream;
865 class TypeFeedbackVector; 864 class TypeFeedbackVector;
866 class WeakCell; 865 class WeakCell;
867 // We cannot just say "class HeapType;" if it is created from a template... =8-? 866 // We cannot just say "class HeapType;" if it is created from a template... =8-?
868 template<class> class TypeImpl; 867 template<class> class TypeImpl;
869 struct HeapTypeConfig; 868 struct HeapTypeConfig;
870 typedef TypeImpl<HeapTypeConfig> HeapType; 869 typedef TypeImpl<HeapTypeConfig> HeapType;
871 870
872 871
873 // A template-ized version of the IsXXX functions. 872 // A template-ized version of the IsXXX functions.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 V(FixedFloat32Array) \ 927 V(FixedFloat32Array) \
929 V(FixedFloat64Array) \ 928 V(FixedFloat64Array) \
930 V(FixedUint8ClampedArray) \ 929 V(FixedUint8ClampedArray) \
931 V(ByteArray) \ 930 V(ByteArray) \
932 V(FreeSpace) \ 931 V(FreeSpace) \
933 V(JSReceiver) \ 932 V(JSReceiver) \
934 V(JSObject) \ 933 V(JSObject) \
935 V(JSContextExtensionObject) \ 934 V(JSContextExtensionObject) \
936 V(JSGeneratorObject) \ 935 V(JSGeneratorObject) \
937 V(JSModule) \ 936 V(JSModule) \
938 V(LayoutDescriptor) \
939 V(Map) \ 937 V(Map) \
940 V(DescriptorArray) \ 938 V(DescriptorArray) \
941 V(TransitionArray) \ 939 V(TransitionArray) \
942 V(TypeFeedbackVector) \ 940 V(TypeFeedbackVector) \
943 V(DeoptimizationInputData) \ 941 V(DeoptimizationInputData) \
944 V(DeoptimizationOutputData) \ 942 V(DeoptimizationOutputData) \
945 V(DependentCode) \ 943 V(DependentCode) \
946 V(FixedArray) \ 944 V(FixedArray) \
947 V(FixedDoubleArray) \ 945 V(FixedDoubleArray) \
948 V(ConstantPoolArray) \ 946 V(ConstantPoolArray) \
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 2056
2059 // Convert and update the elements backing store to be a 2057 // Convert and update the elements backing store to be a
2060 // SeededNumberDictionary dictionary. Returns the backing after conversion. 2058 // SeededNumberDictionary dictionary. Returns the backing after conversion.
2061 static Handle<SeededNumberDictionary> NormalizeElements( 2059 static Handle<SeededNumberDictionary> NormalizeElements(
2062 Handle<JSObject> object); 2060 Handle<JSObject> object);
2063 2061
2064 // Transform slow named properties to fast variants. 2062 // Transform slow named properties to fast variants.
2065 static void MigrateSlowToFast(Handle<JSObject> object, 2063 static void MigrateSlowToFast(Handle<JSObject> object,
2066 int unused_property_fields, const char* reason); 2064 int unused_property_fields, const char* reason);
2067 2065
2068 inline bool IsUnboxedDoubleField(FieldIndex index);
2069
2070 // Access fast-case object properties at index. 2066 // Access fast-case object properties at index.
2071 static Handle<Object> FastPropertyAt(Handle<JSObject> object, 2067 static Handle<Object> FastPropertyAt(Handle<JSObject> object,
2072 Representation representation, 2068 Representation representation,
2073 FieldIndex index); 2069 FieldIndex index);
2074 inline Object* RawFastPropertyAt(FieldIndex index); 2070 inline Object* RawFastPropertyAt(FieldIndex index);
2075 inline double RawFastDoublePropertyAt(FieldIndex index);
2076
2077 inline void FastPropertyAtPut(FieldIndex index, Object* value); 2071 inline void FastPropertyAtPut(FieldIndex index, Object* value);
2078 inline void RawFastPropertyAtPut(FieldIndex index, Object* value);
2079 inline void RawFastDoublePropertyAtPut(FieldIndex index, double value);
2080 void WriteToField(int descriptor, Object* value); 2072 void WriteToField(int descriptor, Object* value);
2081 2073
2082 // Access to in object properties. 2074 // Access to in object properties.
2083 inline int GetInObjectPropertyOffset(int index); 2075 inline int GetInObjectPropertyOffset(int index);
2084 inline Object* InObjectPropertyAt(int index); 2076 inline Object* InObjectPropertyAt(int index);
2085 inline Object* InObjectPropertyAtPut(int index, 2077 inline Object* InObjectPropertyAtPut(int index,
2086 Object* value, 2078 Object* value,
2087 WriteBarrierMode mode 2079 WriteBarrierMode mode
2088 = UPDATE_WRITE_BARRIER); 2080 = UPDATE_WRITE_BARRIER);
2089 2081
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
3133 } 3125 }
3134 3126
3135 static int ToValueIndex(int descriptor_number) { 3127 static int ToValueIndex(int descriptor_number) {
3136 return kFirstIndex + 3128 return kFirstIndex +
3137 (descriptor_number * kDescriptorSize) + 3129 (descriptor_number * kDescriptorSize) +
3138 kDescriptorValue; 3130 kDescriptorValue;
3139 } 3131 }
3140 3132
3141 // Transfer a complete descriptor from the src descriptor array to this 3133 // Transfer a complete descriptor from the src descriptor array to this
3142 // descriptor array. 3134 // descriptor array.
3143 void CopyFrom(int index, DescriptorArray* src, const WhitenessWitness&); 3135 void CopyFrom(int index,
3136 DescriptorArray* src,
3137 const WhitenessWitness&);
3144 3138
3145 inline void Set(int descriptor_number, 3139 inline void Set(int descriptor_number,
3146 Descriptor* desc, 3140 Descriptor* desc,
3147 const WhitenessWitness&); 3141 const WhitenessWitness&);
3148 3142
3149 // Swap first and second descriptor. 3143 // Swap first and second descriptor.
3150 inline void SwapSortedKeys(int first, int second); 3144 inline void SwapSortedKeys(int first, int second);
3151 3145
3152 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); 3146 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray);
3153 }; 3147 };
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
4813 elementType scalar); \ 4807 elementType scalar); \
4814 static inline elementType defaultValue(); \ 4808 static inline elementType defaultValue(); \
4815 }; \ 4809 }; \
4816 \ 4810 \
4817 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; 4811 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
4818 4812
4819 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) 4813 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS)
4820 4814
4821 #undef FIXED_TYPED_ARRAY_TRAITS 4815 #undef FIXED_TYPED_ARRAY_TRAITS
4822 4816
4823
4824 // DeoptimizationInputData is a fixed array used to hold the deoptimization 4817 // DeoptimizationInputData is a fixed array used to hold the deoptimization
4825 // data for code generated by the Hydrogen/Lithium compiler. It also 4818 // data for code generated by the Hydrogen/Lithium compiler. It also
4826 // contains information about functions that were inlined. If N different 4819 // contains information about functions that were inlined. If N different
4827 // functions were inlined then first N elements of the literal array will 4820 // functions were inlined then first N elements of the literal array will
4828 // contain these functions. 4821 // contain these functions.
4829 // 4822 //
4830 // It can be empty. 4823 // It can be empty.
4831 class DeoptimizationInputData: public FixedArray { 4824 class DeoptimizationInputData: public FixedArray {
4832 public: 4825 public:
4833 // Layout description. Indices in the array. 4826 // Layout description. Indices in the array.
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
5911 inline bool has_code_cache(); 5904 inline bool has_code_cache();
5912 5905
5913 // [prototype]: implicit prototype object. 5906 // [prototype]: implicit prototype object.
5914 DECL_ACCESSORS(prototype, Object) 5907 DECL_ACCESSORS(prototype, Object)
5915 5908
5916 // [constructor]: points back to the function responsible for this map. 5909 // [constructor]: points back to the function responsible for this map.
5917 DECL_ACCESSORS(constructor, Object) 5910 DECL_ACCESSORS(constructor, Object)
5918 5911
5919 // [instance descriptors]: describes the object. 5912 // [instance descriptors]: describes the object.
5920 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 5913 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
5921 5914 inline void InitializeDescriptors(DescriptorArray* descriptors);
5922 // [layout descriptor]: describes the object layout.
5923 DECL_ACCESSORS(layout_descriptor, LayoutDescriptor)
5924 // |layout descriptor| accessor which can be used from GC.
5925 inline LayoutDescriptor* layout_descriptor_gc_safe();
5926
5927 // |layout descriptor| accessor that returns a handle.
5928 inline Handle<LayoutDescriptor> GetLayoutDescriptor();
5929
5930 inline void UpdateDescriptors(DescriptorArray* descriptors,
5931 LayoutDescriptor* layout_descriptor);
5932 inline void InitializeDescriptors(DescriptorArray* descriptors,
5933 LayoutDescriptor* layout_descriptor);
5934 5915
5935 // [stub cache]: contains stubs compiled for this map. 5916 // [stub cache]: contains stubs compiled for this map.
5936 DECL_ACCESSORS(code_cache, Object) 5917 DECL_ACCESSORS(code_cache, Object)
5937 5918
5938 // [dependent code]: list of optimized codes that weakly embed this map. 5919 // [dependent code]: list of optimized codes that weakly embed this map.
5939 DECL_ACCESSORS(dependent_code, DependentCode) 5920 DECL_ACCESSORS(dependent_code, DependentCode)
5940 5921
5941 // [back pointer]: points back to the parent map from which a transition 5922 // [back pointer]: points back to the parent map from which a transition
5942 // leads to this map. The field overlaps with prototype transitions and the 5923 // leads to this map. The field overlaps with prototype transitions and the
5943 // back pointer will be moved into the prototype transitions array if 5924 // back pointer will be moved into the prototype transitions array if
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
6253 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; 6234 static const int kPrototypeOffset = kBitField3Offset + kPointerSize;
6254 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 6235 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
6255 // Storage for the transition array is overloaded to directly contain a back 6236 // Storage for the transition array is overloaded to directly contain a back
6256 // pointer if unused. When the map has transitions, the back pointer is 6237 // pointer if unused. When the map has transitions, the back pointer is
6257 // transferred to the transition array and accessed through an extra 6238 // transferred to the transition array and accessed through an extra
6258 // indirection. 6239 // indirection.
6259 static const int kTransitionsOrBackPointerOffset = 6240 static const int kTransitionsOrBackPointerOffset =
6260 kConstructorOffset + kPointerSize; 6241 kConstructorOffset + kPointerSize;
6261 static const int kDescriptorsOffset = 6242 static const int kDescriptorsOffset =
6262 kTransitionsOrBackPointerOffset + kPointerSize; 6243 kTransitionsOrBackPointerOffset + kPointerSize;
6263 #if V8_DOUBLE_FIELDS_UNBOXING
6264 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize;
6265 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize;
6266 #else
6267 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed.
6268 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; 6244 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
6269 #endif
6270 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; 6245 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize;
6271 static const int kSize = kDependentCodeOffset + kPointerSize; 6246 static const int kSize = kDependentCodeOffset + kPointerSize;
6272 6247
6273 // Layout of pointer fields. Heap iteration code relies on them 6248 // Layout of pointer fields. Heap iteration code relies on them
6274 // being continuously allocated. 6249 // being continuously allocated.
6275 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; 6250 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
6276 static const int kPointerFieldsEndOffset = kSize; 6251 static const int kPointerFieldsEndOffset = kSize;
6277 6252
6278 // Byte offsets within kInstanceSizesOffset. 6253 // Byte offsets within kInstanceSizesOffset.
6279 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; 6254 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
6337 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 6312 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
6338 kPointerFieldsEndOffset, 6313 kPointerFieldsEndOffset,
6339 kSize> BodyDescriptor; 6314 kSize> BodyDescriptor;
6340 6315
6341 // Compares this map to another to see if they describe equivalent objects. 6316 // Compares this map to another to see if they describe equivalent objects.
6342 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if 6317 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if
6343 // it had exactly zero inobject properties. 6318 // it had exactly zero inobject properties.
6344 // The "shared" flags of both this map and |other| are ignored. 6319 // The "shared" flags of both this map and |other| are ignored.
6345 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); 6320 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode);
6346 6321
6347 // Returns true if given field is unboxed double.
6348 inline bool IsUnboxedDoubleField(FieldIndex index);
6349
6350 #if TRACE_MAPS 6322 #if TRACE_MAPS
6351 static void TraceTransition(const char* what, Map* from, Map* to, Name* name); 6323 static void TraceTransition(const char* what, Map* from, Map* to, Name* name);
6352 static void TraceAllTransitions(Map* map); 6324 static void TraceAllTransitions(Map* map);
6353 #endif 6325 #endif
6354 6326
6355 static inline Handle<Map> CopyInstallDescriptorsForTesting(
6356 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors,
6357 Handle<LayoutDescriptor> layout_descriptor);
6358
6359 private: 6327 private:
6360 static void ConnectElementsTransition(Handle<Map> parent, Handle<Map> child); 6328 static void ConnectElementsTransition(Handle<Map> parent, Handle<Map> child);
6361 static void ConnectTransition(Handle<Map> parent, Handle<Map> child, 6329 static void ConnectTransition(Handle<Map> parent, Handle<Map> child,
6362 Handle<Name> name, SimpleTransitionFlag flag); 6330 Handle<Name> name, SimpleTransitionFlag flag);
6363 6331
6364 bool EquivalentToForTransition(Map* other); 6332 bool EquivalentToForTransition(Map* other);
6365 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); 6333 static Handle<Map> RawCopy(Handle<Map> map, int instance_size);
6366 static Handle<Map> ShareDescriptor(Handle<Map> map, 6334 static Handle<Map> ShareDescriptor(Handle<Map> map,
6367 Handle<DescriptorArray> descriptors, 6335 Handle<DescriptorArray> descriptors,
6368 Descriptor* descriptor); 6336 Descriptor* descriptor);
6369 static Handle<Map> CopyInstallDescriptors( 6337 static Handle<Map> CopyInstallDescriptors(
6370 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors, 6338 Handle<Map> map,
6371 Handle<LayoutDescriptor> layout_descriptor); 6339 int new_descriptor,
6340 Handle<DescriptorArray> descriptors);
6372 static Handle<Map> CopyAddDescriptor(Handle<Map> map, 6341 static Handle<Map> CopyAddDescriptor(Handle<Map> map,
6373 Descriptor* descriptor, 6342 Descriptor* descriptor,
6374 TransitionFlag flag); 6343 TransitionFlag flag);
6375 static Handle<Map> CopyReplaceDescriptors( 6344 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map,
6376 Handle<Map> map, Handle<DescriptorArray> descriptors, 6345 Handle<DescriptorArray> descriptors,
6377 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, 6346 TransitionFlag flag,
6378 MaybeHandle<Name> maybe_name, const char* reason, 6347 MaybeHandle<Name> maybe_name,
6379 SimpleTransitionFlag simple_flag); 6348 const char* reason,
6380 6349 SimpleTransitionFlag simple_flag);
6381 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, 6350 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map,
6382 Handle<DescriptorArray> descriptors, 6351 Handle<DescriptorArray> descriptors,
6383 Descriptor* descriptor, 6352 Descriptor* descriptor,
6384 int index, 6353 int index,
6385 TransitionFlag flag); 6354 TransitionFlag flag);
6386 6355
6387 static Handle<Map> CopyNormalized(Handle<Map> map, 6356 static Handle<Map> CopyNormalized(Handle<Map> map,
6388 PropertyNormalizationMode mode); 6357 PropertyNormalizationMode mode);
6389 6358
6390 // Fires when the layout of an object with a leaf map changes. 6359 // Fires when the layout of an object with a leaf map changes.
6391 // This includes adding transitions to the leaf map or changing 6360 // This includes adding transitions to the leaf map or changing
6392 // the descriptor array. 6361 // the descriptor array.
6393 inline void NotifyLeafMapLayoutChange(); 6362 inline void NotifyLeafMapLayoutChange();
6394 6363
6395 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, 6364 static Handle<Map> TransitionElementsToSlow(Handle<Map> object,
6396 ElementsKind to_kind); 6365 ElementsKind to_kind);
6397 6366
6398 // Zaps the contents of backing data structures. Note that the 6367 // Zaps the contents of backing data structures. Note that the
6399 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects 6368 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects
6400 // holding weak references when incremental marking is used, because it also 6369 // holding weak references when incremental marking is used, because it also
6401 // iterates over objects that are otherwise unreachable. 6370 // iterates over objects that are otherwise unreachable.
6402 // In general we only want to call these functions in release mode when 6371 // In general we only want to call these functions in release mode when
6403 // heap verification is turned on. 6372 // heap verification is turned on.
6404 void ZapPrototypeTransitions(); 6373 void ZapPrototypeTransitions();
6405 void ZapTransitions(); 6374 void ZapTransitions();
6406 6375
6407 void DeprecateTransitionTree(); 6376 void DeprecateTransitionTree();
6408 void DeprecateTarget(PropertyType type, Name* key, 6377 void DeprecateTarget(PropertyType type, Name* key,
6409 PropertyAttributes attributes, 6378 PropertyAttributes attributes,
6410 DescriptorArray* new_descriptors, 6379 DescriptorArray* new_descriptors);
6411 LayoutDescriptor* new_layout_descriptor);
6412 6380
6413 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); 6381 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors);
6414 6382
6415 void UpdateFieldType(int descriptor_number, Handle<Name> name, 6383 void UpdateFieldType(int descriptor_number, Handle<Name> name,
6416 Handle<HeapType> new_type); 6384 Handle<HeapType> new_type);
6417 6385
6418 void PrintGeneralization(FILE* file, 6386 void PrintGeneralization(FILE* file,
6419 const char* reason, 6387 const char* reason,
6420 int modify_index, 6388 int modify_index,
6421 int split, 6389 int split,
(...skipping 4585 matching lines...) Expand 10 before | Expand all | Expand 10 after
11007 } else { 10975 } else {
11008 value &= ~(1 << bit_position); 10976 value &= ~(1 << bit_position);
11009 } 10977 }
11010 return value; 10978 return value;
11011 } 10979 }
11012 }; 10980 };
11013 10981
11014 } } // namespace v8::internal 10982 } } // namespace v8::internal
11015 10983
11016 #endif // V8_OBJECTS_H_ 10984 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/layout-descriptor-inl.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698