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

Side by Side Diff: src/objects.h

Issue 711313002: Reland "In-object double fields unboxing (for 64-bit only)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The fix 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 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
4769 elementType scalar); \ 4775 elementType scalar); \
4770 static inline elementType defaultValue(); \ 4776 static inline elementType defaultValue(); \
4771 }; \ 4777 }; \
4772 \ 4778 \
4773 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; 4779 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
4774 4780
4775 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) 4781 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS)
4776 4782
4777 #undef FIXED_TYPED_ARRAY_TRAITS 4783 #undef FIXED_TYPED_ARRAY_TRAITS
4778 4784
4785
4779 // DeoptimizationInputData is a fixed array used to hold the deoptimization 4786 // DeoptimizationInputData is a fixed array used to hold the deoptimization
4780 // data for code generated by the Hydrogen/Lithium compiler. It also 4787 // data for code generated by the Hydrogen/Lithium compiler. It also
4781 // contains information about functions that were inlined. If N different 4788 // contains information about functions that were inlined. If N different
4782 // functions were inlined then first N elements of the literal array will 4789 // functions were inlined then first N elements of the literal array will
4783 // contain these functions. 4790 // contain these functions.
4784 // 4791 //
4785 // It can be empty. 4792 // It can be empty.
4786 class DeoptimizationInputData: public FixedArray { 4793 class DeoptimizationInputData: public FixedArray {
4787 public: 4794 public:
4788 // Layout description. Indices in the array. 4795 // Layout description. Indices in the array.
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
5866 inline bool has_code_cache(); 5873 inline bool has_code_cache();
5867 5874
5868 // [prototype]: implicit prototype object. 5875 // [prototype]: implicit prototype object.
5869 DECL_ACCESSORS(prototype, Object) 5876 DECL_ACCESSORS(prototype, Object)
5870 5877
5871 // [constructor]: points back to the function responsible for this map. 5878 // [constructor]: points back to the function responsible for this map.
5872 DECL_ACCESSORS(constructor, Object) 5879 DECL_ACCESSORS(constructor, Object)
5873 5880
5874 // [instance descriptors]: describes the object. 5881 // [instance descriptors]: describes the object.
5875 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 5882 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
5876 inline void InitializeDescriptors(DescriptorArray* descriptors); 5883
5884 // [layout descriptor]: describes the object layout.
5885 DECL_ACCESSORS(layout_descriptor, LayoutDescriptor)
5886 // |layout descriptor| accessor which can be used from GC.
5887 inline LayoutDescriptor* layout_descriptor_gc_safe();
5888
5889 // |layout descriptor| accessor that is safe to call even when
5890 // FLAG_unbox_double_fields is disabled (in this case Map does not contain
5891 // |layout_descriptor| field at all).
5892 inline LayoutDescriptor* GetLayoutDescriptor();
5893
5894 inline void UpdateDescriptors(DescriptorArray* descriptors,
5895 LayoutDescriptor* layout_descriptor);
5896 inline void InitializeDescriptors(DescriptorArray* descriptors,
5897 LayoutDescriptor* layout_descriptor);
5877 5898
5878 // [stub cache]: contains stubs compiled for this map. 5899 // [stub cache]: contains stubs compiled for this map.
5879 DECL_ACCESSORS(code_cache, Object) 5900 DECL_ACCESSORS(code_cache, Object)
5880 5901
5881 // [dependent code]: list of optimized codes that weakly embed this map. 5902 // [dependent code]: list of optimized codes that weakly embed this map.
5882 DECL_ACCESSORS(dependent_code, DependentCode) 5903 DECL_ACCESSORS(dependent_code, DependentCode)
5883 5904
5884 // [back pointer]: points back to the parent map from which a transition 5905 // [back pointer]: points back to the parent map from which a transition
5885 // leads to this map. The field overlaps with prototype transitions and the 5906 // leads to this map. The field overlaps with prototype transitions and the
5886 // back pointer will be moved into the prototype transitions array if 5907 // back pointer will be moved into the prototype transitions array if
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
6196 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; 6217 static const int kPrototypeOffset = kBitField3Offset + kPointerSize;
6197 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 6218 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
6198 // Storage for the transition array is overloaded to directly contain a back 6219 // Storage for the transition array is overloaded to directly contain a back
6199 // pointer if unused. When the map has transitions, the back pointer is 6220 // pointer if unused. When the map has transitions, the back pointer is
6200 // transferred to the transition array and accessed through an extra 6221 // transferred to the transition array and accessed through an extra
6201 // indirection. 6222 // indirection.
6202 static const int kTransitionsOrBackPointerOffset = 6223 static const int kTransitionsOrBackPointerOffset =
6203 kConstructorOffset + kPointerSize; 6224 kConstructorOffset + kPointerSize;
6204 static const int kDescriptorsOffset = 6225 static const int kDescriptorsOffset =
6205 kTransitionsOrBackPointerOffset + kPointerSize; 6226 kTransitionsOrBackPointerOffset + kPointerSize;
6227 #if V8_DOUBLE_FIELDS_UNBOXING
6228 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize;
6229 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize;
6230 #else
6231 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed.
6206 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; 6232 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
6233 #endif
6207 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; 6234 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize;
6208 static const int kSize = kDependentCodeOffset + kPointerSize; 6235 static const int kSize = kDependentCodeOffset + kPointerSize;
6209 6236
6210 // Layout of pointer fields. Heap iteration code relies on them 6237 // Layout of pointer fields. Heap iteration code relies on them
6211 // being continuously allocated. 6238 // being continuously allocated.
6212 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; 6239 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
6213 static const int kPointerFieldsEndOffset = kSize; 6240 static const int kPointerFieldsEndOffset = kSize;
6214 6241
6215 // Byte offsets within kInstanceSizesOffset. 6242 // Byte offsets within kInstanceSizesOffset.
6216 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; 6243 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
6274 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 6301 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
6275 kPointerFieldsEndOffset, 6302 kPointerFieldsEndOffset,
6276 kSize> BodyDescriptor; 6303 kSize> BodyDescriptor;
6277 6304
6278 // Compares this map to another to see if they describe equivalent objects. 6305 // Compares this map to another to see if they describe equivalent objects.
6279 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if 6306 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if
6280 // it had exactly zero inobject properties. 6307 // it had exactly zero inobject properties.
6281 // The "shared" flags of both this map and |other| are ignored. 6308 // The "shared" flags of both this map and |other| are ignored.
6282 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); 6309 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode);
6283 6310
6311 // Returns true if given field is unboxed double.
6312 inline bool IsUnboxedDoubleField(FieldIndex index);
6313
6284 #if TRACE_MAPS 6314 #if TRACE_MAPS
6285 static void TraceTransition(const char* what, Map* from, Map* to, Name* name); 6315 static void TraceTransition(const char* what, Map* from, Map* to, Name* name);
6286 static void TraceAllTransitions(Map* map); 6316 static void TraceAllTransitions(Map* map);
6287 #endif 6317 #endif
6288 6318
6319 static inline Handle<Map> CopyInstallDescriptorsForTesting(
6320 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors,
6321 Handle<LayoutDescriptor> layout_descriptor);
6322
6289 private: 6323 private:
6290 static void ConnectElementsTransition(Handle<Map> parent, Handle<Map> child); 6324 static void ConnectElementsTransition(Handle<Map> parent, Handle<Map> child);
6291 static void ConnectTransition(Handle<Map> parent, Handle<Map> child, 6325 static void ConnectTransition(Handle<Map> parent, Handle<Map> child,
6292 Handle<Name> name, SimpleTransitionFlag flag); 6326 Handle<Name> name, SimpleTransitionFlag flag);
6293 6327
6294 bool EquivalentToForTransition(Map* other); 6328 bool EquivalentToForTransition(Map* other);
6295 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); 6329 static Handle<Map> RawCopy(Handle<Map> map, int instance_size);
6296 static Handle<Map> ShareDescriptor(Handle<Map> map, 6330 static Handle<Map> ShareDescriptor(Handle<Map> map,
6297 Handle<DescriptorArray> descriptors, 6331 Handle<DescriptorArray> descriptors,
6298 Descriptor* descriptor); 6332 Descriptor* descriptor);
6299 static Handle<Map> CopyInstallDescriptors( 6333 static Handle<Map> CopyInstallDescriptors(
6300 Handle<Map> map, 6334 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors,
6301 int new_descriptor, 6335 Handle<LayoutDescriptor> layout_descriptor);
6302 Handle<DescriptorArray> descriptors);
6303 static Handle<Map> CopyAddDescriptor(Handle<Map> map, 6336 static Handle<Map> CopyAddDescriptor(Handle<Map> map,
6304 Descriptor* descriptor, 6337 Descriptor* descriptor,
6305 TransitionFlag flag); 6338 TransitionFlag flag);
6306 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map, 6339 static Handle<Map> CopyReplaceDescriptors(
6307 Handle<DescriptorArray> descriptors, 6340 Handle<Map> map, Handle<DescriptorArray> descriptors,
6308 TransitionFlag flag, 6341 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag,
6309 MaybeHandle<Name> maybe_name, 6342 MaybeHandle<Name> maybe_name, const char* reason,
6310 const char* reason, 6343 SimpleTransitionFlag simple_flag);
6311 SimpleTransitionFlag simple_flag); 6344
6312 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, 6345 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map,
6313 Handle<DescriptorArray> descriptors, 6346 Handle<DescriptorArray> descriptors,
6314 Descriptor* descriptor, 6347 Descriptor* descriptor,
6315 int index, 6348 int index,
6316 TransitionFlag flag); 6349 TransitionFlag flag);
6317 6350
6318 static Handle<Map> CopyNormalized(Handle<Map> map, 6351 static Handle<Map> CopyNormalized(Handle<Map> map,
6319 PropertyNormalizationMode mode); 6352 PropertyNormalizationMode mode);
6320 6353
6321 // Fires when the layout of an object with a leaf map changes. 6354 // Fires when the layout of an object with a leaf map changes.
6322 // This includes adding transitions to the leaf map or changing 6355 // This includes adding transitions to the leaf map or changing
6323 // the descriptor array. 6356 // the descriptor array.
6324 inline void NotifyLeafMapLayoutChange(); 6357 inline void NotifyLeafMapLayoutChange();
6325 6358
6326 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, 6359 static Handle<Map> TransitionElementsToSlow(Handle<Map> object,
6327 ElementsKind to_kind); 6360 ElementsKind to_kind);
6328 6361
6329 // Zaps the contents of backing data structures. Note that the 6362 // Zaps the contents of backing data structures. Note that the
6330 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects 6363 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects
6331 // holding weak references when incremental marking is used, because it also 6364 // holding weak references when incremental marking is used, because it also
6332 // iterates over objects that are otherwise unreachable. 6365 // iterates over objects that are otherwise unreachable.
6333 // In general we only want to call these functions in release mode when 6366 // In general we only want to call these functions in release mode when
6334 // heap verification is turned on. 6367 // heap verification is turned on.
6335 void ZapPrototypeTransitions(); 6368 void ZapPrototypeTransitions();
6336 void ZapTransitions(); 6369 void ZapTransitions();
6337 6370
6338 void DeprecateTransitionTree(); 6371 void DeprecateTransitionTree();
6339 void DeprecateTarget(PropertyType type, Name* key, 6372 void DeprecateTarget(PropertyType type, Name* key,
6340 PropertyAttributes attributes, 6373 PropertyAttributes attributes,
6341 DescriptorArray* new_descriptors); 6374 DescriptorArray* new_descriptors,
6375 LayoutDescriptor* new_layout_descriptor);
6342 6376
6343 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); 6377 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors);
6344 6378
6345 void UpdateFieldType(int descriptor_number, Handle<Name> name, 6379 void UpdateFieldType(int descriptor_number, Handle<Name> name,
6346 Handle<HeapType> new_type); 6380 Handle<HeapType> new_type);
6347 6381
6348 void PrintGeneralization(FILE* file, 6382 void PrintGeneralization(FILE* file,
6349 const char* reason, 6383 const char* reason,
6350 int modify_index, 6384 int modify_index,
6351 int split, 6385 int split,
(...skipping 4585 matching lines...) Expand 10 before | Expand all | Expand 10 after
10937 } else { 10971 } else {
10938 value &= ~(1 << bit_position); 10972 value &= ~(1 << bit_position);
10939 } 10973 }
10940 return value; 10974 return value;
10941 } 10975 }
10942 }; 10976 };
10943 10977
10944 } } // namespace v8::internal 10978 } } // namespace v8::internal
10945 10979
10946 #endif // V8_OBJECTS_H_ 10980 #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