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

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: Addressed comments 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
« no previous file with comments | « src/transitions.cc ('k') | src/x64/full-codegen-x64.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 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
104 void TransitionArray::set_descriptors_pointer(JSGlobalPropertyCell* pointer) {
105 set(kDescriptorsPointerIndex, pointer);
106 }
107
108
105 Object* TransitionArray::back_pointer_storage() { 109 Object* TransitionArray::back_pointer_storage() {
106 return get(kBackPointerStorageIndex); 110 return get(kBackPointerStorageIndex);
107 } 111 }
108 112
109 113
110 void TransitionArray::set_back_pointer_storage(Object* back_pointer, 114 void TransitionArray::set_back_pointer_storage(Object* back_pointer,
111 WriteBarrierMode mode) { 115 WriteBarrierMode mode) {
112 Heap* heap = GetHeap(); 116 Heap* heap = GetHeap();
113 WRITE_FIELD(this, kBackPointerStorageOffset, back_pointer); 117 WRITE_FIELD(this, kBackPointerStorageOffset, back_pointer);
114 CONDITIONAL_WRITE_BARRIER( 118 CONDITIONAL_WRITE_BARRIER(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 189
186 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) { 190 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) {
187 Map* map = GetTarget(transition_number); 191 Map* map = GetTarget(transition_number);
188 DescriptorArray* descriptors = map->instance_descriptors(); 192 DescriptorArray* descriptors = map->instance_descriptors();
189 int descriptor = map->LastAdded(); 193 int descriptor = map->LastAdded();
190 return descriptors->GetDetails(descriptor); 194 return descriptors->GetDetails(descriptor);
191 } 195 }
192 196
193 197
194 int TransitionArray::Search(String* name) { 198 int TransitionArray::Search(String* name) {
195 return internal::Search(this, name); 199 return internal::Search<ALL_ENTRIES>(this, name);
196 } 200 }
197 201
198 202
199 void TransitionArray::Set(int transition_number, 203 void TransitionArray::Set(int transition_number,
200 String* key, 204 String* key,
201 Map* target, 205 Map* target,
202 const WhitenessWitness&) { 206 const WhitenessWitness&) {
203 NoIncrementalWriteBarrierSet(this, 207 NoIncrementalWriteBarrierSet(this,
204 ToKeyIndex(transition_number), 208 ToKeyIndex(transition_number),
205 key); 209 key);
206 NoIncrementalWriteBarrierSet(this, 210 NoIncrementalWriteBarrierSet(this,
207 ToTargetIndex(transition_number), 211 ToTargetIndex(transition_number),
208 target); 212 target);
209 } 213 }
210 214
211 215
212 #undef FIELD_ADDR 216 #undef FIELD_ADDR
213 #undef WRITE_FIELD 217 #undef WRITE_FIELD
214 #undef CONDITIONAL_WRITE_BARRIER 218 #undef CONDITIONAL_WRITE_BARRIER
215 219
216 220
217 } } // namespace v8::internal 221 } } // namespace v8::internal
218 222
219 #endif // V8_TRANSITIONS_INL_H_ 223 #endif // V8_TRANSITIONS_INL_H_
OLDNEW
« no previous file with comments | « src/transitions.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698