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

Unified Diff: src/heap/spaces.cc

Issue 1252053003: improve allocation accounting for incremental mark (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index dfaac73ffd10a4c7722a4ebd70d33bb8aa7d063a..07be9fa076372d8ce0d0d6a16b425d5f1e40d572 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1400,6 +1400,10 @@ void NewSpace::ResetAllocationInfo() {
while (it.has_next()) {
Bitmap::Clear(it.next());
}
+ if (top_on_previous_step_) {
Hannes Payer (out of office) 2015/07/23 10:58:54 Resetting here make the step still imprecise. We a
ofrobots 2015/07/23 16:31:34 Acknowledged.
+ // Start a new step.
+ top_on_previous_step_ = allocation_info_.top();
+ }
}
@@ -1478,18 +1482,19 @@ AllocationResult NewSpace::SlowAllocateRaw(int size_in_bytes,
// the new limit accordingly.
Address new_top = old_top + aligned_size_in_bytes;
int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_);
+
heap()->incremental_marking()->Step(bytes_allocated,
IncrementalMarking::GC_VIA_STACK_GUARD);
UpdateInlineAllocationLimit(aligned_size_in_bytes);
+
+ AllocationResult result =
+ (alignment == kWordAligned)
+ ? AllocateRawUnaligned(size_in_bytes)
+ : AllocateRawAligned(size_in_bytes, alignment);
top_on_previous_step_ = new_top;
- if (alignment == kWordAligned) return AllocateRawUnaligned(size_in_bytes);
- return AllocateRawAligned(size_in_bytes, alignment);
+ return result;
} else if (AddFreshPage()) {
// Switched to new page. Try allocating again.
- int bytes_allocated = static_cast<int>(old_top - top_on_previous_step_);
Hannes Payer (out of office) 2015/07/23 10:58:54 This code accounted for bytes_allocated before we
ofrobots 2015/07/23 16:31:34 Okay, I understand why this case is here in the fi
- heap()->incremental_marking()->Step(bytes_allocated,
- IncrementalMarking::GC_VIA_STACK_GUARD);
- top_on_previous_step_ = to_space_.page_low();
if (alignment == kWordAligned) return AllocateRawUnaligned(size_in_bytes);
return AllocateRawAligned(size_in_bytes, alignment);
} else {
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698