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

Side by Side Diff: src/objects.h

Issue 950283002: Move Maps' back pointers from "transitions" to "constructor" field (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix stupidity on arm64 Created 5 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
« no previous file with comments | « src/isolate.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 // 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 5862 matching lines...) Expand 10 before | Expand all | Expand 10 after
5873 inline bool HasElementsTransition(); 5873 inline bool HasElementsTransition();
5874 inline Map* elements_transition_map(); 5874 inline Map* elements_transition_map();
5875 5875
5876 inline Map* GetTransition(int transition_index); 5876 inline Map* GetTransition(int transition_index);
5877 inline int SearchSpecialTransition(Symbol* name); 5877 inline int SearchSpecialTransition(Symbol* name);
5878 inline int SearchTransition(PropertyKind kind, Name* name, 5878 inline int SearchTransition(PropertyKind kind, Name* name,
5879 PropertyAttributes attributes); 5879 PropertyAttributes attributes);
5880 inline FixedArrayBase* GetInitialElements(); 5880 inline FixedArrayBase* GetInitialElements();
5881 5881
5882 DECL_ACCESSORS(transitions, TransitionArray) 5882 DECL_ACCESSORS(transitions, TransitionArray)
5883 inline void init_transitions(Object* undefined);
5883 5884
5884 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); 5885 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
5885 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); 5886 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
5886 5887
5887 // Try to follow an existing transition to a field with attributes NONE. The 5888 // Try to follow an existing transition to a field with attributes NONE. The
5888 // return value indicates whether the transition was successful. 5889 // return value indicates whether the transition was successful.
5889 static inline Handle<Map> FindTransitionToField(Handle<Map> map, 5890 static inline Handle<Map> FindTransitionToField(Handle<Map> map,
5890 Handle<Name> key); 5891 Handle<Name> key);
5891 5892
5892 Map* FindRootMap(); 5893 Map* FindRootMap();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5947 5948
5948 // [prototype]: implicit prototype object. 5949 // [prototype]: implicit prototype object.
5949 DECL_ACCESSORS(prototype, Object) 5950 DECL_ACCESSORS(prototype, Object)
5950 // TODO(jkummerow): make set_prototype private. 5951 // TODO(jkummerow): make set_prototype private.
5951 void SetPrototype(Handle<Object> prototype, 5952 void SetPrototype(Handle<Object> prototype,
5952 PrototypeOptimizationMode proto_mode = FAST_PROTOTYPE); 5953 PrototypeOptimizationMode proto_mode = FAST_PROTOTYPE);
5953 bool ShouldRegisterAsPrototypeUser(Handle<JSObject> prototype); 5954 bool ShouldRegisterAsPrototypeUser(Handle<JSObject> prototype);
5954 bool CanUseOptimizationsBasedOnPrototypeRegistry(); 5955 bool CanUseOptimizationsBasedOnPrototypeRegistry();
5955 5956
5956 // [constructor]: points back to the function responsible for this map. 5957 // [constructor]: points back to the function responsible for this map.
5957 DECL_ACCESSORS(constructor, Object) 5958 // The field overlaps with the back pointer. All maps in a transition tree
5959 // have the same constructor, so maps with back pointers can walk the
5960 // back pointer chain until they find the map holding their constructor.
5961 DECL_ACCESSORS(constructor_or_backpointer, Object)
5962 inline Object* GetConstructor() const;
5963 inline void SetConstructor(Object* constructor,
5964 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
5965 inline Object* GetBackPointer();
5966 inline void SetBackPointer(Object* value,
5967 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
5958 5968
5959 // [instance descriptors]: describes the object. 5969 // [instance descriptors]: describes the object.
5960 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 5970 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
5961 5971
5962 // [layout descriptor]: describes the object layout. 5972 // [layout descriptor]: describes the object layout.
5963 DECL_ACCESSORS(layout_descriptor, LayoutDescriptor) 5973 DECL_ACCESSORS(layout_descriptor, LayoutDescriptor)
5964 // |layout descriptor| accessor which can be used from GC. 5974 // |layout descriptor| accessor which can be used from GC.
5965 inline LayoutDescriptor* layout_descriptor_gc_safe(); 5975 inline LayoutDescriptor* layout_descriptor_gc_safe();
5966 inline bool HasFastPointerLayout() const; 5976 inline bool HasFastPointerLayout() const;
5967 5977
5968 // |layout descriptor| accessor that is safe to call even when 5978 // |layout descriptor| accessor that is safe to call even when
5969 // FLAG_unbox_double_fields is disabled (in this case Map does not contain 5979 // FLAG_unbox_double_fields is disabled (in this case Map does not contain
5970 // |layout_descriptor| field at all). 5980 // |layout_descriptor| field at all).
5971 inline LayoutDescriptor* GetLayoutDescriptor(); 5981 inline LayoutDescriptor* GetLayoutDescriptor();
5972 5982
5973 inline void UpdateDescriptors(DescriptorArray* descriptors, 5983 inline void UpdateDescriptors(DescriptorArray* descriptors,
5974 LayoutDescriptor* layout_descriptor); 5984 LayoutDescriptor* layout_descriptor);
5975 inline void InitializeDescriptors(DescriptorArray* descriptors, 5985 inline void InitializeDescriptors(DescriptorArray* descriptors,
5976 LayoutDescriptor* layout_descriptor); 5986 LayoutDescriptor* layout_descriptor);
5977 5987
5978 // [stub cache]: contains stubs compiled for this map. 5988 // [stub cache]: contains stubs compiled for this map.
5979 DECL_ACCESSORS(code_cache, Object) 5989 DECL_ACCESSORS(code_cache, Object)
5980 5990
5981 // [dependent code]: list of optimized codes that weakly embed this map. 5991 // [dependent code]: list of optimized codes that weakly embed this map.
5982 DECL_ACCESSORS(dependent_code, DependentCode) 5992 DECL_ACCESSORS(dependent_code, DependentCode)
5983 5993
5984 // [back pointer]: points back to the parent map from which a transition
5985 // leads to this map. The field overlaps with prototype transitions and the
5986 // back pointer will be moved into the prototype transitions array if
5987 // required.
5988 inline Object* GetBackPointer();
5989 inline void SetBackPointer(Object* value,
5990 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
5991 inline void init_back_pointer(Object* undefined);
5992
5993 // [prototype transitions]: cache of prototype transitions. 5994 // [prototype transitions]: cache of prototype transitions.
5994 // Prototype transition is a transition that happens 5995 // Prototype transition is a transition that happens
5995 // when we change object's prototype to a new one. 5996 // when we change object's prototype to a new one.
5996 // Cache format: 5997 // Cache format:
5997 // 0: finger - index of the first free cell in the cache 5998 // 0: finger - index of the first free cell in the cache
5998 // 1 + i: target map 5999 // 1 + i: target map
5999 inline FixedArray* GetPrototypeTransitions(); 6000 inline FixedArray* GetPrototypeTransitions();
6000 inline bool HasPrototypeTransitions(); 6001 inline bool HasPrototypeTransitions();
6001 6002
6002 static const int kProtoTransitionNumberOfEntriesOffset = 0; 6003 static const int kProtoTransitionNumberOfEntriesOffset = 0;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
6275 Handle<Object> prototype, 6276 Handle<Object> prototype,
6276 PrototypeOptimizationMode mode); 6277 PrototypeOptimizationMode mode);
6277 6278
6278 static const int kMaxPreAllocatedPropertyFields = 255; 6279 static const int kMaxPreAllocatedPropertyFields = 255;
6279 6280
6280 // Layout description. 6281 // Layout description.
6281 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; 6282 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
6282 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; 6283 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
6283 static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize; 6284 static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize;
6284 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; 6285 static const int kPrototypeOffset = kBitField3Offset + kPointerSize;
6285 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 6286 static const int kConstructorOrBackPointerOffset =
6286 // Storage for the transition array is overloaded to directly contain a back 6287 kPrototypeOffset + kPointerSize;
6287 // pointer if unused. When the map has transitions, the back pointer is 6288 static const int kTransitionsOffset =
6288 // transferred to the transition array and accessed through an extra 6289 kConstructorOrBackPointerOffset + kPointerSize;
6289 // indirection. 6290 static const int kDescriptorsOffset = kTransitionsOffset + kPointerSize;
6290 static const int kTransitionsOrBackPointerOffset =
6291 kConstructorOffset + kPointerSize;
6292 static const int kDescriptorsOffset =
6293 kTransitionsOrBackPointerOffset + kPointerSize;
6294 #if V8_DOUBLE_FIELDS_UNBOXING 6291 #if V8_DOUBLE_FIELDS_UNBOXING
6295 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize; 6292 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize;
6296 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize; 6293 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize;
6297 #else 6294 #else
6298 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed. 6295 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed.
6299 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; 6296 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
6300 #endif 6297 #endif
6301 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; 6298 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize;
6302 static const int kSize = kDependentCodeOffset + kPointerSize; 6299 static const int kSize = kDependentCodeOffset + kPointerSize;
6303 6300
(...skipping 4684 matching lines...) Expand 10 before | Expand all | Expand 10 after
10988 } else { 10985 } else {
10989 value &= ~(1 << bit_position); 10986 value &= ~(1 << bit_position);
10990 } 10987 }
10991 return value; 10988 return value;
10992 } 10989 }
10993 }; 10990 };
10994 10991
10995 } } // namespace v8::internal 10992 } } // namespace v8::internal
10996 10993
10997 #endif // V8_OBJECTS_H_ 10994 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698