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

Unified Diff: src/heap/heap-inl.h

Issue 1368833004: Revert of [heap] Move large object space selection into AllocateRaw. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index ca9812aaf8033f55aca767d3496840c2b54b5f67..6f7c060d70c9e53f41fd9802f21389920d2aec2b 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -123,11 +123,12 @@
// Compute map and object size.
Map* map = one_byte_internalized_string_map();
int size = SeqOneByteString::SizeFor(str.length());
+ AllocationSpace space = SelectSpace(size, TENURED);
// Allocate string.
HeapObject* result = nullptr;
{
- AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
+ AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
if (!allocation.To(&result)) return allocation;
}
@@ -154,11 +155,12 @@
// Compute map and object size.
Map* map = internalized_string_map();
int size = SeqTwoByteString::SizeFor(str.length());
+ AllocationSpace space = SelectSpace(size, TENURED);
// Allocate string.
HeapObject* result = nullptr;
{
- AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
+ AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
if (!allocation.To(&result)) return allocation;
}
@@ -204,42 +206,33 @@
isolate_->counters()->objs_since_last_young()->Increment();
#endif
- bool large_object = size_in_bytes > Page::kMaxRegularHeapObjectSize;
HeapObject* object = nullptr;
AllocationResult allocation;
if (NEW_SPACE == space) {
- if (!large_object) {
- allocation = new_space_.AllocateRaw(size_in_bytes, alignment);
- if (always_allocate() && allocation.IsRetry() &&
- retry_space != NEW_SPACE) {
- space = retry_space;
- } else {
- if (allocation.To(&object)) {
- OnAllocationEvent(object, size_in_bytes);
- }
- return allocation;
+ allocation = new_space_.AllocateRaw(size_in_bytes, alignment);
+ if (always_allocate() && allocation.IsRetry() && retry_space != NEW_SPACE) {
+ space = retry_space;
+ } else {
+ if (allocation.To(&object)) {
+ OnAllocationEvent(object, size_in_bytes);
}
- } else {
- space = LO_SPACE;
+ return allocation;
}
}
if (OLD_SPACE == space) {
- if (!large_object) {
- allocation = old_space_->AllocateRaw(size_in_bytes, alignment);
- } else {
- allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
- }
+ allocation = old_space_->AllocateRaw(size_in_bytes, alignment);
} else if (CODE_SPACE == space) {
- if (!large_object) {
+ if (size_in_bytes <= code_space()->AreaSize()) {
allocation = code_space_->AllocateRawUnaligned(size_in_bytes);
} else {
+ // Large code objects are allocated in large object space.
allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE);
}
} else if (LO_SPACE == space) {
- DCHECK(large_object);
allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
- } else if (MAP_SPACE == space) {
+ } else {
+ DCHECK(MAP_SPACE == space);
allocation = map_space_->AllocateRawUnaligned(size_in_bytes);
}
if (allocation.To(&object)) {
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698