Revision: 15840
Author: [email protected]
Date: Tue Jul 23 13:01:38 2013
Log: Simplified large object allocation strategy.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/19934006
http://code.google.com/p/v8/source/detail?r=15840
Modified:
/branches/bleeding_edge/src/arm/macro-assembler-arm.cc
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.cc
/branches/bleeding_edge/src/x64/macro-assembler-x64.cc
/branches/bleeding_edge/test/cctest/test-heap.cc
/branches/bleeding_edge/test/cctest/test-mark-compact.cc
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Mon Jul 22
02:55:14 2013
+++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Tue Jul 23
13:01:38 2013
@@ -1625,6 +1625,7 @@
Register scratch2,
Label* gc_required,
AllocationFlags flags) {
+ ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Jul 23 08:15:00 2013
+++ /branches/bleeding_edge/src/heap.cc Tue Jul 23 13:01:38 2013
@@ -5359,25 +5359,16 @@
if (length < 0 || length > SeqOneByteString::kMaxLength) {
return Failure::OutOfMemoryException(0xb);
}
-
int size = SeqOneByteString::SizeFor(length);
ASSERT(size <= SeqOneByteString::kMaxSize);
-
AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE :
NEW_SPACE;
AllocationSpace retry_space = OLD_DATA_SPACE;
- if (space == NEW_SPACE) {
- if (size > kMaxObjectSizeInNewSpace) {
- // Allocate in large object space, retry space will be ignored.
- space = LO_SPACE;
- } else if (size > Page::kMaxNonCodeHeapObjectSize) {
- // Allocate in new space, retry in large object space.
- retry_space = LO_SPACE;
- }
- } else if (space == OLD_DATA_SPACE &&
- size > Page::kMaxNonCodeHeapObjectSize) {
+ if (size > Page::kMaxNonCodeHeapObjectSize) {
+ // Allocate in large object space, retry space will be ignored.
space = LO_SPACE;
}
+
Object* result;
{ MaybeObject* maybe_result = AllocateRaw(size, space, retry_space);
if (!maybe_result->ToObject(&result)) return maybe_result;
@@ -5403,18 +5394,11 @@
AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE :
NEW_SPACE;
AllocationSpace retry_space = OLD_DATA_SPACE;
- if (space == NEW_SPACE) {
- if (size > kMaxObjectSizeInNewSpace) {
- // Allocate in large object space, retry space will be ignored.
- space = LO_SPACE;
- } else if (size > Page::kMaxNonCodeHeapObjectSize) {
- // Allocate in new space, retry in large object space.
- retry_space = LO_SPACE;
- }
- } else if (space == OLD_DATA_SPACE &&
- size > Page::kMaxNonCodeHeapObjectSize) {
+ if (size > Page::kMaxNonCodeHeapObjectSize) {
+ // Allocate in large object space, retry space will be ignored.
space = LO_SPACE;
}
+
Object* result;
{ MaybeObject* maybe_result = AllocateRaw(size, space, retry_space);
if (!maybe_result->ToObject(&result)) return maybe_result;
@@ -5488,7 +5472,7 @@
if (always_allocate()) return AllocateFixedArray(length, TENURED);
// Allocate the raw data for a fixed array.
int size = FixedArray::SizeFor(length);
- return size <= kMaxObjectSizeInNewSpace
+ return size <= Page::kMaxNonCodeHeapObjectSize
? new_space_.AllocateRaw(size)
: lo_space_->AllocateRaw(size, NOT_EXECUTABLE);
}
@@ -5559,21 +5543,15 @@
if (length < 0 || length > FixedArray::kMaxLength) {
return Failure::OutOfMemoryException(0xe);
}
-
+ int size = FixedArray::SizeFor(length);
AllocationSpace space =
(pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE;
- int size = FixedArray::SizeFor(length);
- if (space == NEW_SPACE && size > kMaxObjectSizeInNewSpace) {
- // Too big for new space.
- space = LO_SPACE;
- } else if (space == OLD_POINTER_SPACE &&
- size > Page::kMaxNonCodeHeapObjectSize) {
- // Too big for old pointer space.
+ AllocationSpace retry_space = OLD_POINTER_SPACE;
+
+ if (size > Page::kMaxNonCodeHeapObjectSize) {
+ // Allocate in large object space, retry space will be ignored.
space = LO_SPACE;
}
-
- AllocationSpace retry_space =
- (size <= Page::kMaxNonCodeHeapObjectSize) ? OLD_POINTER_SPACE :
LO_SPACE;
return AllocateRaw(size, space, retry_space);
}
@@ -5692,26 +5670,18 @@
if (length < 0 || length > FixedDoubleArray::kMaxLength) {
return Failure::OutOfMemoryException(0xf);
}
-
- AllocationSpace space =
- (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
int size = FixedDoubleArray::SizeFor(length);
+ AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE :
NEW_SPACE;
+ AllocationSpace retry_space = OLD_DATA_SPACE;
#ifndef V8_HOST_ARCH_64_BIT
size += kPointerSize;
#endif
- if (space == NEW_SPACE && size > kMaxObjectSizeInNewSpace) {
- // Too big for new space.
- space = LO_SPACE;
- } else if (space == OLD_DATA_SPACE &&
- size > Page::kMaxNonCodeHeapObjectSize) {
- // Too big for old data space.
+ if (size > Page::kMaxNonCodeHeapObjectSize) {
+ // Allocate in large object space, retry space will be ignored.
space = LO_SPACE;
}
-
- AllocationSpace retry_space =
- (size <= Page::kMaxNonCodeHeapObjectSize) ? OLD_DATA_SPACE :
LO_SPACE;
HeapObject* object;
{ MaybeObject* maybe_object = AllocateRaw(size, space, retry_space);
=======================================
--- /branches/bleeding_edge/src/heap.h Tue Jul 23 08:15:00 2013
+++ /branches/bleeding_edge/src/heap.h Tue Jul 23 13:01:38 2013
@@ -1677,8 +1677,6 @@
// mark or if we've already filled the bottom 1/16th of the to space,
// we try to promote this object.
inline bool ShouldBePromoted(Address old_address, int object_size);
-
- int MaxObjectSizeInNewSpace() { return kMaxObjectSizeInNewSpace; }
void ClearJSFunctionResultCaches();
@@ -1924,12 +1922,6 @@
int scan_on_scavenge_pages_;
-#if V8_TARGET_ARCH_X64
- static const int kMaxObjectSizeInNewSpace = 1024*KB;
-#else
- static const int kMaxObjectSizeInNewSpace = 512*KB;
-#endif
-
NewSpace new_space_;
OldSpace* old_pointer_space_;
OldSpace* old_data_space_;
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Mon Jul 22
02:55:14 2013
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Tue Jul 23
13:01:38 2013
@@ -1248,6 +1248,7 @@
Label* gc_required,
AllocationFlags flags) {
ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
+ ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Mon Jul 22
02:55:14 2013
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Tue Jul 23
13:01:38 2013
@@ -2882,6 +2882,7 @@
Register scratch2,
Label* gc_required,
AllocationFlags flags) {
+ ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Jul 22
02:55:14 2013
+++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Jul 23
13:01:38 2013
@@ -3838,6 +3838,7 @@
Label* gc_required,
AllocationFlags flags) {
ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
+ ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Fri Jul 19 06:30:49
2013
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Tue Jul 23 13:01:38
2013
@@ -984,7 +984,7 @@
// just enough room to allocate JSObject and thus fill the newspace.
int allocation_amount = Min(FixedArray::kMaxSize,
- HEAP->MaxObjectSizeInNewSpace());
+ Page::kMaxNonCodeHeapObjectSize);
int allocation_len = LenFromSize(allocation_amount);
NewSpace* new_space = HEAP->new_space();
Address* top_addr = new_space->allocation_top_address();
=======================================
--- /branches/bleeding_edge/test/cctest/test-mark-compact.cc Fri Jul 5
05:24:30 2013
+++ /branches/bleeding_edge/test/cctest/test-mark-compact.cc Tue Jul 23
13:01:38 2013
@@ -119,10 +119,8 @@
HEAP->CollectGarbage(OLD_POINTER_SPACE);
// Allocate a big Fixed array in the new space.
- int max_size =
- Min(Page::kMaxNonCodeHeapObjectSize,
HEAP->MaxObjectSizeInNewSpace());
-
- int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize);
+ int length = (Page::kMaxNonCodeHeapObjectSize -
+ FixedArray::kHeaderSize) / (2 * kPointerSize);
Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)->
ToObjectChecked();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.