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

Side by Side Diff: src/transitions.h

Issue 10784014: Removed transitions from the accessor pair descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 5 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
« no previous file with comments | « src/runtime.cc ('k') | src/transitions.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 // 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // [0] Elements transition 44 // [0] Elements transition
45 // [1] First transition 45 // [1] First transition
46 // [length() - kTransitionSize] Last transition 46 // [length() - kTransitionSize] Last transition
47 class TransitionArray: public FixedArray { 47 class TransitionArray: public FixedArray {
48 public: 48 public:
49 // Accessors for fetching instance transition at transition number. 49 // Accessors for fetching instance transition at transition number.
50 inline String* GetKey(int transition_number); 50 inline String* GetKey(int transition_number);
51 inline void SetKey(int transition_number, String* value); 51 inline void SetKey(int transition_number, String* value);
52 inline Object** GetKeySlot(int transition_number); 52 inline Object** GetKeySlot(int transition_number);
53 53
54 inline Object* GetValue(int transition_number); 54 inline Map* GetTarget(int transition_number);
55 inline void SetValue(int transition_number, Object* value); 55 inline void SetTarget(int transition_number, Map* target);
56 inline Object** GetValueSlot(int transition_number); 56 inline Object** GetTargetSlot(int transition_number);
57 57
58 inline Map* GetTargetMap(int transition_number);
59 inline PropertyDetails GetTargetDetails(int transition_number); 58 inline PropertyDetails GetTargetDetails(int transition_number);
60 59
61 inline Map* elements_transition(); 60 inline Map* elements_transition();
62 inline void set_elements_transition( 61 inline void set_elements_transition(
63 Map* value, 62 Map* target,
64 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 63 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
65 inline Object** GetElementsTransitionSlot(); 64 inline Object** GetElementsTransitionSlot();
66 inline bool HasElementsTransition(); 65 inline bool HasElementsTransition();
67 inline void ClearElementsTransition(); 66 inline void ClearElementsTransition();
68 67
69 inline FixedArray* GetPrototypeTransitions(); 68 inline FixedArray* GetPrototypeTransitions();
70 inline void SetPrototypeTransitions( 69 inline void SetPrototypeTransitions(
71 FixedArray* prototype_transitions, 70 FixedArray* prototype_transitions,
72 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 71 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
73 inline Object** GetPrototypeTransitionsSlot(); 72 inline Object** GetPrototypeTransitionsSlot();
74 inline bool HasPrototypeTransitions(); 73 inline bool HasPrototypeTransitions();
75 inline HeapObject* UncheckedPrototypeTransitions(); 74 inline HeapObject* UncheckedPrototypeTransitions();
76 75
77 // Returns the number of transitions in the array. 76 // Returns the number of transitions in the array.
78 int number_of_transitions() { 77 int number_of_transitions() {
79 ASSERT(length() >= kFirstIndex); 78 ASSERT(length() >= kFirstIndex);
80 int len = length(); 79 int len = length();
81 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; 80 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize;
82 } 81 }
83 82
84 inline int number_of_entries() { return number_of_transitions(); } 83 inline int number_of_entries() { return number_of_transitions(); }
85 84
86 // Allocate a new transition array with a single entry. 85 // Allocate a new transition array with a single entry.
87 static MUST_USE_RESULT MaybeObject* NewWith(String* name, Object* map); 86 static MUST_USE_RESULT MaybeObject* NewWith(String* name, Map* target);
88 87
89 // Copy the transition array, inserting a new transition. 88 // Copy the transition array, inserting a new transition.
90 // TODO(verwaest): This should not cause an existing transition to be 89 // TODO(verwaest): This should not cause an existing transition to be
91 // overwritten. 90 // overwritten.
92 MUST_USE_RESULT MaybeObject* CopyInsert(String* name, Object* map); 91 MUST_USE_RESULT MaybeObject* CopyInsert(String* name, Map* target);
93 92
94 // Copy a single transition from the origin array. 93 // Copy a single transition from the origin array.
95 inline void CopyFrom(TransitionArray* origin, 94 inline void CopyFrom(TransitionArray* origin,
96 int origin_transition, 95 int origin_transition,
97 int target_transition, 96 int target_transition,
98 const WhitenessWitness& witness); 97 const WhitenessWitness& witness);
99 98
100 // Search a transition for a given property name. 99 // Search a transition for a given property name.
101 inline int Search(String* name); 100 inline int Search(String* name);
102 101
(...skipping 11 matching lines...) Expand all
114 static const int kFirstIndex = 2; 113 static const int kFirstIndex = 2;
115 114
116 // Layout transition array header. 115 // Layout transition array header.
117 static const int kElementsTransitionOffset = FixedArray::kHeaderSize; 116 static const int kElementsTransitionOffset = FixedArray::kHeaderSize;
118 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset + 117 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset +
119 kPointerSize; 118 kPointerSize;
120 static const int kFirstOffset = kPrototypeTransitionsOffset + kPointerSize; 119 static const int kFirstOffset = kPrototypeTransitionsOffset + kPointerSize;
121 120
122 // Layout of map transition. 121 // Layout of map transition.
123 static const int kTransitionKey = 0; 122 static const int kTransitionKey = 0;
124 static const int kTransitionValue = 1; 123 static const int kTransitionTarget = 1;
125 static const int kTransitionSize = 2; 124 static const int kTransitionSize = 2;
126 125
127 #ifdef OBJECT_PRINT 126 #ifdef OBJECT_PRINT
128 // Print all the transitions. 127 // Print all the transitions.
129 inline void PrintTransitions() { 128 inline void PrintTransitions() {
130 PrintTransitions(stdout); 129 PrintTransitions(stdout);
131 } 130 }
132 void PrintTransitions(FILE* out); 131 void PrintTransitions(FILE* out);
133 #endif 132 #endif
134 133
135 #ifdef DEBUG 134 #ifdef DEBUG
136 bool IsSortedNoDuplicates(); 135 bool IsSortedNoDuplicates();
137 bool IsConsistentWithBackPointers(Map* current_map); 136 bool IsConsistentWithBackPointers(Map* current_map);
138 bool IsEqualTo(TransitionArray* other); 137 bool IsEqualTo(TransitionArray* other);
139 #endif 138 #endif
140 139
141 // The maximum number of transitions we want in a transition array (should 140 // The maximum number of transitions we want in a transition array (should
142 // fit in a page). 141 // fit in a page).
143 static const int kMaxNumberOfTransitions = 1024 + 512; 142 static const int kMaxNumberOfTransitions = 1024 + 512;
144 143
145 private: 144 private:
146 // Conversion from transition number to array indices. 145 // Conversion from transition number to array indices.
147 static int ToKeyIndex(int transition_number) { 146 static int ToKeyIndex(int transition_number) {
148 return kFirstIndex + 147 return kFirstIndex +
149 (transition_number * kTransitionSize) + 148 (transition_number * kTransitionSize) +
150 kTransitionKey; 149 kTransitionKey;
151 } 150 }
152 151
153 static int ToValueIndex(int transition_number) { 152 static int ToTargetIndex(int transition_number) {
154 return kFirstIndex + 153 return kFirstIndex +
155 (transition_number * kTransitionSize) + 154 (transition_number * kTransitionSize) +
156 kTransitionValue; 155 kTransitionTarget;
157 } 156 }
158 157
159 inline void Set(int transition_number, 158 inline void Set(int transition_number,
160 String* key, 159 String* key,
161 Object* value, 160 Map* target,
162 const WhitenessWitness&); 161 const WhitenessWitness&);
163 162
164 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 163 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
165 }; 164 };
166 165
167 166
168 } } // namespace v8::internal 167 } } // namespace v8::internal
169 168
170 #endif // V8_TRANSITIONS_H_ 169 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698