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

Side by Side Diff: src/objects-visiting-inl.h

Issue 11028027: Revert trunk to bleeding_edge at r12484 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 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/objects-visiting.h ('k') | src/parser.h » ('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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 table_.Register(kVisitSeqTwoByteString, &DataObjectVisitor::Visit); 128 table_.Register(kVisitSeqTwoByteString, &DataObjectVisitor::Visit);
129 129
130 table_.Register(kVisitJSWeakMap, &StaticVisitor::VisitJSWeakMap); 130 table_.Register(kVisitJSWeakMap, &StaticVisitor::VisitJSWeakMap);
131 131
132 table_.Register(kVisitOddball, 132 table_.Register(kVisitOddball,
133 &FixedBodyVisitor<StaticVisitor, 133 &FixedBodyVisitor<StaticVisitor,
134 Oddball::BodyDescriptor, 134 Oddball::BodyDescriptor,
135 void>::Visit); 135 void>::Visit);
136 136
137 table_.Register(kVisitMap, &VisitMap); 137 table_.Register(kVisitMap,
138 &FixedBodyVisitor<StaticVisitor,
139 Map::BodyDescriptor,
140 void>::Visit);
138 141
139 table_.Register(kVisitCode, &VisitCode); 142 table_.Register(kVisitCode, &StaticVisitor::VisitCode);
140 143
141 // Registration for kVisitSharedFunctionInfo is done by StaticVisitor. 144 // Registration for kVisitSharedFunctionInfo is done by StaticVisitor.
142 145
143 // Registration for kVisitJSFunction is done by StaticVisitor. 146 // Registration for kVisitJSFunction is done by StaticVisitor.
144 147
145 // Registration for kVisitJSRegExp is done by StaticVisitor. 148 // Registration for kVisitJSRegExp is done by StaticVisitor.
146 149
147 table_.Register(kVisitPropertyCell, 150 table_.Register(kVisitPropertyCell,
148 &FixedBodyVisitor<StaticVisitor, 151 &FixedBodyVisitor<StaticVisitor,
149 JSGlobalPropertyCell::BodyDescriptor, 152 JSGlobalPropertyCell::BodyDescriptor,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 idx < Context::NATIVE_CONTEXT_SLOTS; 240 idx < Context::NATIVE_CONTEXT_SLOTS;
238 ++idx) { 241 ++idx) {
239 Object** slot = 242 Object** slot =
240 HeapObject::RawField(object, FixedArray::OffsetOfElementAt(idx)); 243 HeapObject::RawField(object, FixedArray::OffsetOfElementAt(idx));
241 collector->RecordSlot(slot, slot, *slot); 244 collector->RecordSlot(slot, slot, *slot);
242 } 245 }
243 } 246 }
244 247
245 248
246 template<typename StaticVisitor> 249 template<typename StaticVisitor>
247 void StaticMarkingVisitor<StaticVisitor>::VisitMap(
248 Map* map, HeapObject* object) {
249 Heap* heap = map->GetHeap();
250 Map* map_object = Map::cast(object);
251
252 // Clears the cache of ICs related to this map.
253 if (FLAG_cleanup_code_caches_at_gc) {
254 map_object->ClearCodeCache(heap);
255 }
256
257 // When map collection is enabled we have to mark through map's
258 // transitions and back pointers in a special way to make these links
259 // weak. Only maps for subclasses of JSReceiver can have transitions.
260 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
261 if (FLAG_collect_maps &&
262 map_object->instance_type() >= FIRST_JS_RECEIVER_TYPE) {
263 MarkMapContents(heap, map_object);
264 } else {
265 Object** start_slot =
266 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset);
267 Object** end_slot =
268 HeapObject::RawField(object, Map::kPointerFieldsEndOffset);
269 StaticVisitor::VisitPointers(heap, start_slot, start_slot, end_slot);
270 }
271 }
272
273
274 template<typename StaticVisitor>
275 void StaticMarkingVisitor<StaticVisitor>::VisitCode( 250 void StaticMarkingVisitor<StaticVisitor>::VisitCode(
276 Map* map, HeapObject* object) { 251 Map* map, HeapObject* object) {
277 Heap* heap = map->GetHeap(); 252 Heap* heap = map->GetHeap();
278 Code* code = Code::cast(object); 253 Code* code = Code::cast(object);
279 if (FLAG_cleanup_code_caches_at_gc) { 254 if (FLAG_cleanup_code_caches_at_gc) {
280 code->ClearTypeFeedbackCells(heap); 255 code->ClearTypeFeedbackCells(heap);
281 } 256 }
282 code->CodeIterateBody<StaticVisitor>(heap); 257 code->CodeIterateBody<StaticVisitor>(heap);
283 } 258 }
284 259
285 260
286 template<typename StaticVisitor> 261 template<typename StaticVisitor>
287 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp( 262 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(
288 Map* map, HeapObject* object) { 263 Map* map, HeapObject* object) {
289 int last_property_offset = 264 int last_property_offset =
290 JSRegExp::kSize + kPointerSize * map->inobject_properties(); 265 JSRegExp::kSize + kPointerSize * map->inobject_properties();
291 Object** start_slot = 266 StaticVisitor::VisitPointers(map->GetHeap(),
292 HeapObject::RawField(object, JSRegExp::kPropertiesOffset); 267 HeapObject::RawField(object, JSRegExp::kPropertiesOffset),
293 Object** end_slot = 268 HeapObject::RawField(object, last_property_offset));
294 HeapObject::RawField(object, last_property_offset);
295 StaticVisitor::VisitPointers(
296 map->GetHeap(), start_slot, start_slot, end_slot);
297 } 269 }
298 270
299 271
300 template<typename StaticVisitor>
301 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(
302 Heap* heap, Map* map) {
303 // Make sure that the back pointer stored either in the map itself or
304 // inside its transitions array is marked. Skip recording the back
305 // pointer slot since map space is not compacted.
306 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer()));
307
308 // Treat pointers in the transitions array as weak and also mark that
309 // array to prevent visiting it later. Skip recording the transition
310 // array slot, since it will be implicitly recorded when the pointer
311 // fields of this map are visited.
312 TransitionArray* transitions = map->unchecked_transition_array();
313 if (transitions->IsTransitionArray()) {
314 MarkTransitionArray(heap, transitions);
315 } else {
316 // Already marked by marking map->GetBackPointer() above.
317 ASSERT(transitions->IsMap() || transitions->IsUndefined());
318 }
319
320 // Mark the pointer fields of the Map. Since the transitions array has
321 // been marked already, it is fine that one of these fields contains a
322 // pointer to it.
323 Object** start_slot =
324 HeapObject::RawField(map, Map::kPointerFieldsBeginOffset);
325 Object** end_slot =
326 HeapObject::RawField(map, Map::kPointerFieldsEndOffset);
327 StaticVisitor::VisitPointers(heap, start_slot, start_slot, end_slot);
328 }
329
330
331 template<typename StaticVisitor>
332 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray(
333 Heap* heap, TransitionArray* transitions) {
334 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return;
335
336 // Skip recording the descriptors_pointer slot since the cell space
337 // is not compacted and descriptors are referenced through a cell.
338 StaticVisitor::MarkObject(heap, transitions->descriptors_pointer());
339
340 // Simple transitions do not have keys nor prototype transitions.
341 if (transitions->IsSimpleTransition()) return;
342
343 if (transitions->HasPrototypeTransitions()) {
344 // Mark prototype transitions array but do not push it onto marking
345 // stack, this will make references from it weak. We will clean dead
346 // prototype transitions in ClearNonLiveTransitions.
347 Object** slot = transitions->GetPrototypeTransitionsSlot();
348 HeapObject* obj = HeapObject::cast(*slot);
349 heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
350 StaticVisitor::MarkObjectWithoutPush(heap, obj);
351 }
352
353 for (int i = 0; i < transitions->number_of_transitions(); ++i) {
354 StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i));
355 }
356 }
357
358
359 void Code::CodeIterateBody(ObjectVisitor* v) { 272 void Code::CodeIterateBody(ObjectVisitor* v) {
360 int mode_mask = RelocInfo::kCodeTargetMask | 273 int mode_mask = RelocInfo::kCodeTargetMask |
361 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 274 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
362 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | 275 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) |
363 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | 276 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
364 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | 277 RelocInfo::ModeMask(RelocInfo::JS_RETURN) |
365 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | 278 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
366 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); 279 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
367 280
368 // There are two places where we iterate code bodies: here and the 281 // There are two places where we iterate code bodies: here and the
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 RelocIterator it(this, mode_mask); 320 RelocIterator it(this, mode_mask);
408 for (; !it.done(); it.next()) { 321 for (; !it.done(); it.next()) {
409 it.rinfo()->template Visit<StaticVisitor>(heap); 322 it.rinfo()->template Visit<StaticVisitor>(heap);
410 } 323 }
411 } 324 }
412 325
413 326
414 } } // namespace v8::internal 327 } } // namespace v8::internal
415 328
416 #endif // V8_OBJECTS_VISITING_INL_H_ 329 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/objects-visiting.h ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698