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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 8b6f1e2e621c39339c02891c090b12b83add0df8..7ad1c29854a86bfe24691d4cec300ac0ce11f534 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5880,6 +5880,7 @@ class Map: public HeapObject {
inline FixedArrayBase* GetInitialElements();
DECL_ACCESSORS(transitions, TransitionArray)
+ inline void init_transitions(Object* undefined);
static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
@@ -5954,7 +5955,16 @@ class Map: public HeapObject {
bool CanUseOptimizationsBasedOnPrototypeRegistry();
// [constructor]: points back to the function responsible for this map.
- DECL_ACCESSORS(constructor, Object)
+ // The field overlaps with the back pointer. All maps in a transition tree
+ // have the same constructor, so maps with back pointers can walk the
+ // back pointer chain until they find the map holding their constructor.
+ DECL_ACCESSORS(constructor_or_backpointer, Object)
+ inline Object* GetConstructor() const;
+ inline void SetConstructor(Object* constructor,
+ WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
+ inline Object* GetBackPointer();
+ inline void SetBackPointer(Object* value,
+ WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
// [instance descriptors]: describes the object.
DECL_ACCESSORS(instance_descriptors, DescriptorArray)
@@ -5981,15 +5991,6 @@ class Map: public HeapObject {
// [dependent code]: list of optimized codes that weakly embed this map.
DECL_ACCESSORS(dependent_code, DependentCode)
- // [back pointer]: points back to the parent map from which a transition
- // leads to this map. The field overlaps with prototype transitions and the
- // back pointer will be moved into the prototype transitions array if
- // required.
- inline Object* GetBackPointer();
- inline void SetBackPointer(Object* value,
- WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
- inline void init_back_pointer(Object* undefined);
-
// [prototype transitions]: cache of prototype transitions.
// Prototype transition is a transition that happens
// when we change object's prototype to a new one.
@@ -6282,15 +6283,11 @@ class Map: public HeapObject {
static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize;
static const int kPrototypeOffset = kBitField3Offset + kPointerSize;
- static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
- // Storage for the transition array is overloaded to directly contain a back
- // pointer if unused. When the map has transitions, the back pointer is
- // transferred to the transition array and accessed through an extra
- // indirection.
- static const int kTransitionsOrBackPointerOffset =
- kConstructorOffset + kPointerSize;
- static const int kDescriptorsOffset =
- kTransitionsOrBackPointerOffset + kPointerSize;
+ static const int kConstructorOrBackPointerOffset =
+ kPrototypeOffset + kPointerSize;
+ static const int kTransitionsOffset =
+ kConstructorOrBackPointerOffset + kPointerSize;
+ static const int kDescriptorsOffset = kTransitionsOffset + kPointerSize;
#if V8_DOUBLE_FIELDS_UNBOXING
static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize;
static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize;
« 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