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

Unified Diff: src/heap/heap.cc

Issue 1632913003: [heap] Move to page lookups for SemiSpace, NewSpace, and Heap containment methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips ports Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 5a380a5affef1e1f95f2ddc0a593ce2b86825d13..1dfd2313419a1925314df8007b4496ff63ee304c 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1099,10 +1099,8 @@ void Heap::MoveElements(FixedArray* array, int dst_index, int src_index,
MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize);
if (!InNewSpace(array)) {
for (int i = 0; i < len; i++) {
- // TODO(hpayer): check store buffer for entries
- if (InNewSpace(dst_objects[i])) {
- RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i));
- }
+ RecordWrite(array, array->OffsetOfElementAt(dst_index + i),
+ dst_objects[i]);
}
}
incremental_marking()->RecordWrites(array);
@@ -3074,7 +3072,7 @@ bool Heap::CanMoveObjectStart(HeapObject* object) {
// (3) the page was already concurrently swept. This case is an optimization
// for concurrent sweeping. The WasSwept predicate for concurrently swept
// pages is set after sweeping all pages.
- return !InOldSpace(address) || page->SweepingDone();
+ return !InOldSpace(object) || page->SweepingDone();
}
@@ -4331,38 +4329,65 @@ void Heap::ReportHeapStatistics(const char* title) {
#endif // DEBUG
-bool Heap::Contains(HeapObject* value) { return Contains(value->address()); }
-
-
-bool Heap::Contains(Address addr) {
- if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false;
+bool Heap::Contains(HeapObject* value) {
+ if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(value->address())) {
+ return false;
+ }
return HasBeenSetUp() &&
- (new_space_.ToSpaceContains(addr) || old_space_->Contains(addr) ||
- code_space_->Contains(addr) || map_space_->Contains(addr) ||
- lo_space_->SlowContains(addr));
+ (new_space_.ToSpaceContains(value) || old_space_->Contains(value) ||
+ code_space_->Contains(value) || map_space_->Contains(value) ||
+ lo_space_->Contains(value));
}
+bool Heap::ContainsSlow(Address addr) {
+ if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) {
+ return false;
+ }
+ return HasBeenSetUp() &&
+ (new_space_.ToSpaceContainsSlow(addr) ||
+ old_space_->ContainsSlow(addr) || code_space_->ContainsSlow(addr) ||
+ map_space_->ContainsSlow(addr) || lo_space_->ContainsSlow(addr));
+}
bool Heap::InSpace(HeapObject* value, AllocationSpace space) {
- return InSpace(value->address(), space);
-}
+ if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(value->address())) {
+ return false;
+ }
+ if (!HasBeenSetUp()) return false;
+ switch (space) {
+ case NEW_SPACE:
+ return new_space_.ToSpaceContains(value);
+ case OLD_SPACE:
+ return old_space_->Contains(value);
+ case CODE_SPACE:
+ return code_space_->Contains(value);
+ case MAP_SPACE:
+ return map_space_->Contains(value);
+ case LO_SPACE:
+ return lo_space_->Contains(value);
+ }
+ UNREACHABLE();
+ return false;
+}
-bool Heap::InSpace(Address addr, AllocationSpace space) {
- if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false;
+bool Heap::InSpaceSlow(Address addr, AllocationSpace space) {
+ if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) {
+ return false;
+ }
if (!HasBeenSetUp()) return false;
switch (space) {
case NEW_SPACE:
- return new_space_.ToSpaceContains(addr);
+ return new_space_.ToSpaceContainsSlow(addr);
case OLD_SPACE:
- return old_space_->Contains(addr);
+ return old_space_->ContainsSlow(addr);
case CODE_SPACE:
- return code_space_->Contains(addr);
+ return code_space_->ContainsSlow(addr);
case MAP_SPACE:
- return map_space_->Contains(addr);
+ return map_space_->ContainsSlow(addr);
case LO_SPACE:
- return lo_space_->SlowContains(addr);
+ return lo_space_->ContainsSlow(addr);
}
UNREACHABLE();
return false;
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698