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

Side by Side Diff: src/transitions.h

Issue 10816005: Swapped transition array and descriptor array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments, and updated additional code comments. Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 23 matching lines...) Expand all
34 #include "objects.h" 34 #include "objects.h"
35 #include "v8checks.h" 35 #include "v8checks.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 40
41 // TransitionArrays are fixed arrays used to hold map transitions for property, 41 // TransitionArrays are fixed arrays used to hold map transitions for property,
42 // constant, and element changes. 42 // constant, and element changes.
43 // The format of the these objects is: 43 // The format of the these objects is:
44 // [0] Elements transition 44 // [0] Descriptor array
45 // [1] First transition 45 // [1] Undefined or back pointer map
46 // [2] Smi(0) or elements transition map
47 // [3] Smi(0) or fixed array of prototype transitions
48 // [4] First transition
46 // [length() - kTransitionSize] Last transition 49 // [length() - kTransitionSize] Last transition
47 class TransitionArray: public FixedArray { 50 class TransitionArray: public FixedArray {
48 public: 51 public:
49 // Accessors for fetching instance transition at transition number. 52 // Accessors for fetching instance transition at transition number.
50 inline String* GetKey(int transition_number); 53 inline String* GetKey(int transition_number);
51 inline void SetKey(int transition_number, String* value); 54 inline void SetKey(int transition_number, String* value);
52 inline Object** GetKeySlot(int transition_number); 55 inline Object** GetKeySlot(int transition_number);
53 56
54 inline Map* GetTarget(int transition_number); 57 inline Map* GetTarget(int transition_number);
55 inline void SetTarget(int transition_number, Map* target); 58 inline void SetTarget(int transition_number, Map* target);
56 59
57 inline PropertyDetails GetTargetDetails(int transition_number); 60 inline PropertyDetails GetTargetDetails(int transition_number);
58 61
59 inline Map* elements_transition(); 62 inline Map* elements_transition();
60 inline void set_elements_transition( 63 inline void set_elements_transition(
61 Map* target, 64 Map* target,
62 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 65 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
63 inline bool HasElementsTransition(); 66 inline bool HasElementsTransition();
64 inline void ClearElementsTransition(); 67 inline void ClearElementsTransition();
65 68
69 inline DescriptorArray* descriptors();
70 inline void set_descriptors(DescriptorArray* descriptors,
71 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
72 inline Object** GetDescriptorsSlot();
73
74 inline Object* back_pointer_storage();
75 inline void set_back_pointer_storage(
76 Object* back_pointer,
77 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
78
66 inline FixedArray* GetPrototypeTransitions(); 79 inline FixedArray* GetPrototypeTransitions();
67 inline void SetPrototypeTransitions( 80 inline void SetPrototypeTransitions(
68 FixedArray* prototype_transitions, 81 FixedArray* prototype_transitions,
69 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 82 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
70 inline Object** GetPrototypeTransitionsSlot(); 83 inline Object** GetPrototypeTransitionsSlot();
71 inline bool HasPrototypeTransitions(); 84 inline bool HasPrototypeTransitions();
72 inline HeapObject* UncheckedPrototypeTransitions(); 85 inline HeapObject* UncheckedPrototypeTransitions();
73 86
74 // Returns the number of transitions in the array. 87 // Returns the number of transitions in the array.
75 int number_of_transitions() { 88 int number_of_transitions() {
(...skipping 23 matching lines...) Expand all
99 112
100 // Allocates a TransitionArray. 113 // Allocates a TransitionArray.
101 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions); 114 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions);
102 115
103 // Casting. 116 // Casting.
104 static inline TransitionArray* cast(Object* obj); 117 static inline TransitionArray* cast(Object* obj);
105 118
106 // Constant for denoting key was not found. 119 // Constant for denoting key was not found.
107 static const int kNotFound = -1; 120 static const int kNotFound = -1;
108 121
109 static const int kElementsTransitionIndex = 0; 122 static const int kDescriptorsIndex = 0;
110 static const int kPrototypeTransitionsIndex = 1; 123 static const int kBackPointerStorageIndex = 1;
111 static const int kFirstIndex = 2; 124 static const int kElementsTransitionIndex = 2;
125 static const int kPrototypeTransitionsIndex = 3;
126 static const int kFirstIndex = 4;
112 127
113 // Layout transition array header. 128 // Layout transition array header.
114 static const int kElementsTransitionOffset = FixedArray::kHeaderSize; 129 static const int kDescriptorsOffset = FixedArray::kHeaderSize;
130 static const int kBackPointerStorageOffset = kDescriptorsOffset +
131 kPointerSize;
132 static const int kElementsTransitionOffset = kBackPointerStorageOffset +
133 kPointerSize;
115 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset + 134 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset +
116 kPointerSize; 135 kPointerSize;
117 static const int kFirstOffset = kPrototypeTransitionsOffset + kPointerSize;
118 136
119 // Layout of map transition. 137 // Layout of map transition.
120 static const int kTransitionKey = 0; 138 static const int kTransitionKey = 0;
121 static const int kTransitionTarget = 1; 139 static const int kTransitionTarget = 1;
122 static const int kTransitionSize = 2; 140 static const int kTransitionSize = 2;
123 141
124 #ifdef OBJECT_PRINT 142 #ifdef OBJECT_PRINT
125 // Print all the transitions. 143 // Print all the transitions.
126 inline void PrintTransitions() { 144 inline void PrintTransitions() {
127 PrintTransitions(stdout); 145 PrintTransitions(stdout);
(...skipping 30 matching lines...) Expand all
158 Map* target, 176 Map* target,
159 const WhitenessWitness&); 177 const WhitenessWitness&);
160 178
161 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 179 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
162 }; 180 };
163 181
164 182
165 } } // namespace v8::internal 183 } } // namespace v8::internal
166 184
167 #endif // V8_TRANSITIONS_H_ 185 #endif // V8_TRANSITIONS_H_
OLDNEW
« src/bootstrapper.cc ('K') | « src/runtime.cc ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698