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

Side by Side Diff: src/objects.h

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