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

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

Issue 10909007: Sharing of descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 years, 3 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void TransitionArray::set_elements_transition(Map* transition_map, 76 void TransitionArray::set_elements_transition(Map* transition_map,
77 WriteBarrierMode mode) { 77 WriteBarrierMode mode) {
78 Heap* heap = GetHeap(); 78 Heap* heap = GetHeap();
79 WRITE_FIELD(this, kElementsTransitionOffset, transition_map); 79 WRITE_FIELD(this, kElementsTransitionOffset, transition_map);
80 CONDITIONAL_WRITE_BARRIER( 80 CONDITIONAL_WRITE_BARRIER(
81 heap, this, kElementsTransitionOffset, transition_map, mode); 81 heap, this, kElementsTransitionOffset, transition_map, mode);
82 } 82 }
83 83
84 84
85 DescriptorArray* TransitionArray::descriptors() { 85 DescriptorArray* TransitionArray::descriptors() {
86 return DescriptorArray::cast(get(kDescriptorsIndex)); 86 return DescriptorArray::cast(descriptors_pointer()->value());
87 } 87 }
88 88
89 89
90 void TransitionArray::set_descriptors(DescriptorArray* descriptors, 90 void TransitionArray::set_descriptors(DescriptorArray* descriptors) {
91 WriteBarrierMode mode) { 91 ASSERT(!this->descriptors()->IsDescriptorArray() ||
92 Heap* heap = GetHeap(); 92 descriptors->number_of_descriptors() == 0 ||
93 WRITE_FIELD(this, kDescriptorsOffset, descriptors); 93 descriptors->HasEnumCache() ||
94 CONDITIONAL_WRITE_BARRIER( 94 !this->descriptors()->HasEnumCache());
95 heap, this, kDescriptorsOffset, descriptors, mode); 95 descriptors_pointer()->set_value(descriptors);
96 } 96 }
97 97
98 98
99 Object** TransitionArray::GetDescriptorsSlot() { 99 JSGlobalPropertyCell* TransitionArray::descriptors_pointer() {
100 return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), 100 return JSGlobalPropertyCell::cast(get(kDescriptorsPointerIndex));
101 kDescriptorsOffset);
102 } 101 }
103 102
104 103
105 Object* TransitionArray::back_pointer_storage() { 104 Object* TransitionArray::back_pointer_storage() {
106 return get(kBackPointerStorageIndex); 105 return get(kBackPointerStorageIndex);
107 } 106 }
108 107
109 108
110 void TransitionArray::set_back_pointer_storage(Object* back_pointer, 109 void TransitionArray::set_back_pointer_storage(Object* back_pointer,
111 WriteBarrierMode mode) { 110 WriteBarrierMode mode) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 184
186 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) { 185 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) {
187 Map* map = GetTarget(transition_number); 186 Map* map = GetTarget(transition_number);
188 DescriptorArray* descriptors = map->instance_descriptors(); 187 DescriptorArray* descriptors = map->instance_descriptors();
189 int descriptor = map->LastAdded(); 188 int descriptor = map->LastAdded();
190 return descriptors->GetDetails(descriptor); 189 return descriptors->GetDetails(descriptor);
191 } 190 }
192 191
193 192
194 int TransitionArray::Search(String* name) { 193 int TransitionArray::Search(String* name) {
195 return internal::Search(this, name); 194 return internal::Search<ALL_ENTRIES>(this, name);
196 } 195 }
197 196
198 197
199 void TransitionArray::Set(int transition_number, 198 void TransitionArray::Set(int transition_number,
200 String* key, 199 String* key,
201 Map* target, 200 Map* target,
202 const WhitenessWitness&) { 201 const WhitenessWitness&) {
203 NoIncrementalWriteBarrierSet(this, 202 NoIncrementalWriteBarrierSet(this,
204 ToKeyIndex(transition_number), 203 ToKeyIndex(transition_number),
205 key); 204 key);
206 NoIncrementalWriteBarrierSet(this, 205 NoIncrementalWriteBarrierSet(this,
207 ToTargetIndex(transition_number), 206 ToTargetIndex(transition_number),
208 target); 207 target);
209 } 208 }
210 209
211 210
212 #undef FIELD_ADDR 211 #undef FIELD_ADDR
213 #undef WRITE_FIELD 212 #undef WRITE_FIELD
214 #undef CONDITIONAL_WRITE_BARRIER 213 #undef CONDITIONAL_WRITE_BARRIER
215 214
216 215
217 } } // namespace v8::internal 216 } } // namespace v8::internal
218 217
219 #endif // V8_TRANSITIONS_INL_H_ 218 #endif // V8_TRANSITIONS_INL_H_
OLDNEW
« src/objects-inl.h ('K') | « src/transitions.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698