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

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

Issue 3301008: [Isolates] Add heap pointer to all maps and use map->heap() more. (Closed)
Patch Set: even more 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 ASSERT(IsAligned(byte_size, kPointerSize)); 260 ASSERT(IsAligned(byte_size, kPointerSize));
261 261
262 Page* page = Page::FromAddress(dst); 262 Page* page = Page::FromAddress(dst);
263 uint32_t marks = page->GetRegionMarks(); 263 uint32_t marks = page->GetRegionMarks();
264 264
265 for (int remaining = byte_size / kPointerSize; 265 for (int remaining = byte_size / kPointerSize;
266 remaining > 0; 266 remaining > 0;
267 remaining--) { 267 remaining--) {
268 Memory::Object_at(dst) = Memory::Object_at(src); 268 Memory::Object_at(dst) = Memory::Object_at(src);
269 269
270 if (Heap::InNewSpace(Memory::Object_at(dst))) { 270 if (InNewSpace(Memory::Object_at(dst))) {
271 marks |= page->GetRegionMaskForAddress(dst); 271 marks |= page->GetRegionMaskForAddress(dst);
272 } 272 }
273 273
274 dst += kPointerSize; 274 dst += kPointerSize;
275 src += kPointerSize; 275 src += kPointerSize;
276 } 276 }
277 277
278 page->SetRegionMarks(marks); 278 page->SetRegionMarks(marks);
279 } 279 }
280 280
(...skipping 25 matching lines...) Expand all
306 Address src, 306 Address src,
307 int byte_size) { 307 int byte_size) {
308 ASSERT(IsAligned(byte_size, kPointerSize)); 308 ASSERT(IsAligned(byte_size, kPointerSize));
309 ASSERT((dst >= (src + byte_size)) || 309 ASSERT((dst >= (src + byte_size)) ||
310 ((OffsetFrom(src) - OffsetFrom(dst)) >= kPointerSize)); 310 ((OffsetFrom(src) - OffsetFrom(dst)) >= kPointerSize));
311 311
312 CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_size); 312 CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_size);
313 } 313 }
314 314
315 315
316 void Heap::ScavengePointer(HeapObject** p) {
317 ScavengeObject(p, *p);
318 }
319
320
316 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { 321 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
317 ASSERT(InFromSpace(object)); 322 ASSERT(HEAP->InFromSpace(object));
318 323
319 // We use the first word (where the map pointer usually is) of a heap 324 // We use the first word (where the map pointer usually is) of a heap
320 // object to record the forwarding pointer. A forwarding pointer can 325 // object to record the forwarding pointer. A forwarding pointer can
321 // point to an old space, the code space, or the to space of the new 326 // point to an old space, the code space, or the to space of the new
322 // generation. 327 // generation.
323 MapWord first_word = object->map_word(); 328 MapWord first_word = object->map_word();
324 329
325 // If the first word is a forwarding address, the object has already been 330 // If the first word is a forwarding address, the object has already been
326 // copied. 331 // copied.
327 if (first_word.IsForwardingAddress()) { 332 if (first_word.IsForwardingAddress()) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 #ifdef DEBUG 573 #ifdef DEBUG
569 UpdateLiveObjectCount(obj); 574 UpdateLiveObjectCount(obj);
570 #endif 575 #endif
571 obj->SetMark(); 576 obj->SetMark();
572 } 577 }
573 578
574 579
575 } } // namespace v8::internal 580 } } // namespace v8::internal
576 581
577 #endif // V8_HEAP_INL_H_ 582 #endif // V8_HEAP_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698