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

Side by Side Diff: src/objects.cc

Issue 3385002: [Draft] Stackless map transition tree traversal. (Closed)
Patch Set: Created 10 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
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 5105 matching lines...) Expand 10 before | Expand all | Expand 10 after
5116 ASSERT(target->prototype() == this || 5116 ASSERT(target->prototype() == this ||
5117 target->prototype() == real_prototype); 5117 target->prototype() == real_prototype);
5118 // Getter prototype() is read-only, set_prototype() has side effects. 5118 // Getter prototype() is read-only, set_prototype() has side effects.
5119 *RawField(target, Map::kPrototypeOffset) = real_prototype; 5119 *RawField(target, Map::kPrototypeOffset) = real_prototype;
5120 } 5120 }
5121 } 5121 }
5122 } 5122 }
5123 } 5123 }
5124 5124
5125 5125
5126 void Map::TraverseTransitionTree() {
5127 Map* current = this;
5128 while (current != Heap::meta_map()) {
5129 DescriptorArray* d = reinterpret_cast<DescriptorArray*>(
5130 *RawField(current, Map::kInstanceDescriptorsOffset));
5131 if (d == Heap::empty_descriptor_array()) {
5132 Map* prev = current->map();
5133 current->set_map(Heap::meta_map());
5134 current->Print();
5135 current = prev;
5136 continue;
5137 }
5138 FixedArray* contents = reinterpret_cast<FixedArray*>(
5139 d->get(DescriptorArray::kContentArrayIndex));
5140 Object** map_or_index_field = RawField(contents, HeapObject::kMapOffset);
5141 Object* map_or_index = *map_or_index_field;
5142 ASSERT(map_or_index->IsSmi() || map_or_index == Heap::fixed_array_map());
5143 bool map_done = true;
5144 for (int i = map_or_index->IsSmi() ? Smi::cast(map_or_index)->value() : 0;
5145 i < contents->length();
5146 i += 2) {
5147 PropertyDetails details(Smi::cast(contents->get(i + 1)));
5148 if (details.IsTransition()) {
5149 Map* next = Map::cast(contents->get(i));
5150 next->set_map(current);
5151 *map_or_index_field = Smi::FromInt(i + 2);
5152 current = next;
5153 map_done = false;
5154 break;
5155 }
5156 }
5157 if (!map_done) continue;
5158 *map_or_index_field = Heap::fixed_array_map();
5159 Map* prev = current->map();
5160 current->set_map(Heap::meta_map());
5161 current->Print();
5162 current = prev;
5163 }
5164 }
5165
5166
5126 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { 5167 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) {
5127 // Iterate over all fields in the body but take care in dealing with 5168 // Iterate over all fields in the body but take care in dealing with
5128 // the code entry. 5169 // the code entry.
5129 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); 5170 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset);
5130 v->VisitCodeEntry(this->address() + kCodeEntryOffset); 5171 v->VisitCodeEntry(this->address() + kCodeEntryOffset);
5131 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); 5172 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size);
5132 } 5173 }
5133 5174
5134 5175
5135 Object* JSFunction::SetInstancePrototype(Object* value) { 5176 Object* JSFunction::SetInstancePrototype(Object* value) {
(...skipping 3753 matching lines...) Expand 10 before | Expand all | Expand 10 after
8889 if (break_point_objects()->IsUndefined()) return 0; 8930 if (break_point_objects()->IsUndefined()) return 0;
8890 // Single beak point. 8931 // Single beak point.
8891 if (!break_point_objects()->IsFixedArray()) return 1; 8932 if (!break_point_objects()->IsFixedArray()) return 1;
8892 // Multiple break points. 8933 // Multiple break points.
8893 return FixedArray::cast(break_point_objects())->length(); 8934 return FixedArray::cast(break_point_objects())->length();
8894 } 8935 }
8895 #endif 8936 #endif
8896 8937
8897 8938
8898 } } // namespace v8::internal 8939 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698