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

Side by Side Diff: src/transitions-inl.h

Issue 661133002: TransitionArray now uses <is_data_property, name, attributes> tuple as a key, which allows to have … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 2 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/transitions.cc ('k') | test/cctest/cctest.gyp » ('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_TRANSITIONS_INL_H_ 5 #ifndef V8_TRANSITIONS_INL_H_
6 #define V8_TRANSITIONS_INL_H_ 6 #define V8_TRANSITIONS_INL_H_
7 7
8 #include "src/transitions.h" 8 #include "src/transitions.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 29
30 TransitionArray* TransitionArray::cast(Object* object) { 30 TransitionArray* TransitionArray::cast(Object* object) {
31 DCHECK(object->IsTransitionArray()); 31 DCHECK(object->IsTransitionArray());
32 return reinterpret_cast<TransitionArray*>(object); 32 return reinterpret_cast<TransitionArray*>(object);
33 } 33 }
34 34
35 35
36 bool TransitionArray::HasElementsTransition() { 36 bool TransitionArray::HasElementsTransition() {
37 return Search(GetHeap()->elements_transition_symbol()) != kNotFound; 37 return SearchSpecial(GetHeap()->elements_transition_symbol()) != kNotFound;
38 } 38 }
39 39
40 40
41 Object* TransitionArray::back_pointer_storage() { 41 Object* TransitionArray::back_pointer_storage() {
42 return get(kBackPointerStorageIndex); 42 return get(kBackPointerStorageIndex);
43 } 43 }
44 44
45 45
46 void TransitionArray::set_back_pointer_storage(Object* back_pointer, 46 void TransitionArray::set_back_pointer_storage(Object* back_pointer,
47 WriteBarrierMode mode) { 47 WriteBarrierMode mode) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return map->GetLastDescriptorDetails(); 133 return map->GetLastDescriptorDetails();
134 } 134 }
135 135
136 136
137 Object* TransitionArray::GetTargetValue(int transition_number) { 137 Object* TransitionArray::GetTargetValue(int transition_number) {
138 Map* map = GetTarget(transition_number); 138 Map* map = GetTarget(transition_number);
139 return map->instance_descriptors()->GetValue(map->LastAdded()); 139 return map->instance_descriptors()->GetValue(map->LastAdded());
140 } 140 }
141 141
142 142
143 int TransitionArray::Search(Name* name) { 143 int TransitionArray::SearchFirst(Name* name) {
144 if (IsSimpleTransition()) { 144 if (IsSimpleTransition()) {
145 Name* key = GetKey(kSimpleTransitionIndex); 145 Name* key = GetKey(kSimpleTransitionIndex);
146 if (key->Equals(name)) return kSimpleTransitionIndex; 146 if (key->Equals(name)) return kSimpleTransitionIndex;
147 return kNotFound; 147 return kNotFound;
148 } 148 }
149 return internal::Search<ALL_ENTRIES>(this, name); 149 return internal::Search<ALL_ENTRIES>(this, name);
150 } 150 }
151 151
152 152
153 bool TransitionArray::IsSpecialTransition(Name* name) {
Toon Verwaest 2014/10/24 06:43:34 Please get rid of this method; instead make it dep
Igor Sheludko 2014/11/04 10:05:01 Done. Now I'm using SimpleTransitionFlag as a to d
154 if (!name->IsSymbol()) return false;
155 Heap* heap = name->GetHeap();
156 return name == heap->frozen_symbol() ||
157 name == heap->elements_transition_symbol() ||
158 name == heap->observed_symbol();
159 }
160
161
162 PropertyDetails TransitionArray::GetTargetDetails(Name* name, Map* target) {
163 DCHECK(!IsSpecialTransition(name));
164 int descriptor = target->LastAdded();
165 DescriptorArray* descriptors = target->instance_descriptors();
166 if (!descriptors->GetKey(descriptor)->Equals(name)) {
167 descriptor = descriptors->SearchWithCache(name, target);
168 DCHECK_NE(kNotFound, descriptor);
169 }
170 return descriptors->GetDetails(descriptor);
171 }
172
173
153 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number, 174 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number,
154 Name* key, 175 Name* key,
155 Map* target) { 176 Map* target) {
156 FixedArray::NoIncrementalWriteBarrierSet( 177 FixedArray::NoIncrementalWriteBarrierSet(
157 this, ToKeyIndex(transition_number), key); 178 this, ToKeyIndex(transition_number), key);
158 FixedArray::NoIncrementalWriteBarrierSet( 179 FixedArray::NoIncrementalWriteBarrierSet(
159 this, ToTargetIndex(transition_number), target); 180 this, ToTargetIndex(transition_number), target);
160 } 181 }
161 182
162 183
163 #undef FIELD_ADDR 184 #undef FIELD_ADDR
164 #undef WRITE_FIELD 185 #undef WRITE_FIELD
165 #undef CONDITIONAL_WRITE_BARRIER 186 #undef CONDITIONAL_WRITE_BARRIER
166 187
167 188
168 } } // namespace v8::internal 189 } } // namespace v8::internal
169 190
170 #endif // V8_TRANSITIONS_INL_H_ 191 #endif // V8_TRANSITIONS_INL_H_
OLDNEW
« no previous file with comments | « src/transitions.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698