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

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

Issue 23060018: Fix migration checks and extend them to the Scavenger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address nit. Created 7 years, 4 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/heap.cc ('k') | src/mark-compact.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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // Only the latter two contain non-map-word pointers to heap objects. 432 // Only the latter two contain non-map-word pointers to heap objects.
433 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag) 433 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag)
434 ? OLD_POINTER_SPACE 434 ? OLD_POINTER_SPACE
435 : OLD_DATA_SPACE; 435 : OLD_DATA_SPACE;
436 } else { 436 } else {
437 return (type <= LAST_DATA_TYPE) ? OLD_DATA_SPACE : OLD_POINTER_SPACE; 437 return (type <= LAST_DATA_TYPE) ? OLD_DATA_SPACE : OLD_POINTER_SPACE;
438 } 438 }
439 } 439 }
440 440
441 441
442 bool Heap::AllowedToBeMigrated(HeapObject* object, AllocationSpace dst) {
443 // Object migration is governed by the following rules:
444 //
445 // 1) Objects in new-space can be migrated to one of the old spaces
446 // that matches their target space or they stay in new-space.
447 // 2) Objects in old-space stay in the same space when migrating.
448 // 3) Fillers (two or more words) can migrate due to left-trimming of
449 // fixed arrays in new-space, old-data-space and old-pointer-space.
450 // 4) Fillers (one word) can never migrate, they are skipped by
451 // incremental marking explicitly to prevent invalid pattern.
452 //
453 // Since this function is used for debugging only, we do not place
454 // asserts here, but check everything explicitly.
455 if (object->map() == one_pointer_filler_map()) return false;
456 InstanceType type = object->map()->instance_type();
457 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address());
458 AllocationSpace src = chunk->owner()->identity();
459 switch (src) {
460 case NEW_SPACE:
461 return dst == src || dst == TargetSpaceId(type);
462 case OLD_POINTER_SPACE:
463 return dst == src && (dst == TargetSpaceId(type) || object->IsFiller());
464 case OLD_DATA_SPACE:
465 return dst == src && dst == TargetSpaceId(type);
466 case CODE_SPACE:
467 return dst == src && type == CODE_TYPE;
468 case MAP_SPACE:
469 case CELL_SPACE:
470 case PROPERTY_CELL_SPACE:
471 case LO_SPACE:
472 return false;
473 }
474 UNREACHABLE();
475 return false;
476 }
477
478
442 void Heap::CopyBlock(Address dst, Address src, int byte_size) { 479 void Heap::CopyBlock(Address dst, Address src, int byte_size) {
443 CopyWords(reinterpret_cast<Object**>(dst), 480 CopyWords(reinterpret_cast<Object**>(dst),
444 reinterpret_cast<Object**>(src), 481 reinterpret_cast<Object**>(src),
445 static_cast<size_t>(byte_size / kPointerSize)); 482 static_cast<size_t>(byte_size / kPointerSize));
446 } 483 }
447 484
448 485
449 void Heap::MoveBlock(Address dst, Address src, int byte_size) { 486 void Heap::MoveBlock(Address dst, Address src, int byte_size) {
450 ASSERT(IsAligned(byte_size, kPointerSize)); 487 ASSERT(IsAligned(byte_size, kPointerSize));
451 488
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 DisallowAllocationFailure::~DisallowAllocationFailure() { 883 DisallowAllocationFailure::~DisallowAllocationFailure() {
847 #ifdef DEBUG 884 #ifdef DEBUG
848 HEAP->disallow_allocation_failure_ = old_state_; 885 HEAP->disallow_allocation_failure_ = old_state_;
849 #endif 886 #endif
850 } 887 }
851 888
852 889
853 } } // namespace v8::internal 890 } } // namespace v8::internal
854 891
855 #endif // V8_HEAP_INL_H_ 892 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698