Commit 983a8621 authored by hpayer@chromium.org's avatar hpayer@chromium.org

More cleanup regarding the maximum non-large object allocation size.

BUG=
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/20867003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16052 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e8fe083e
......@@ -2008,7 +2008,6 @@ class ScavengingVisitor : public StaticVisitorBase {
private:
enum ObjectContents { DATA_OBJECT, POINTER_OBJECT };
enum SizeRestriction { SMALL, UNKNOWN_SIZE };
static void RecordCopiedObject(Heap* heap, HeapObject* obj) {
bool should_record = false;
......@@ -2060,15 +2059,12 @@ class ScavengingVisitor : public StaticVisitorBase {
}
template<ObjectContents object_contents,
SizeRestriction size_restriction,
int alignment>
template<ObjectContents object_contents, int alignment>
static inline void EvacuateObject(Map* map,
HeapObject** slot,
HeapObject* object,
int object_size) {
SLOW_ASSERT((size_restriction != SMALL) ||
(object_size <= Page::kMaxNonCodeHeapObjectSize));
SLOW_ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
SLOW_ASSERT(object->Size() == object_size);
int allocation_size = object_size;
......@@ -2081,17 +2077,11 @@ class ScavengingVisitor : public StaticVisitorBase {
if (heap->ShouldBePromoted(object->address(), object_size)) {
MaybeObject* maybe_result;
if ((size_restriction != SMALL) &&
(allocation_size > Page::kMaxNonCodeHeapObjectSize)) {
maybe_result = heap->lo_space()->AllocateRaw(allocation_size,
NOT_EXECUTABLE);
if (object_contents == DATA_OBJECT) {
maybe_result = heap->old_data_space()->AllocateRaw(allocation_size);
} else {
if (object_contents == DATA_OBJECT) {
maybe_result = heap->old_data_space()->AllocateRaw(allocation_size);
} else {
maybe_result =
heap->old_pointer_space()->AllocateRaw(allocation_size);
}
maybe_result =
heap->old_pointer_space()->AllocateRaw(allocation_size);
}
Object* result = NULL; // Initialization to please compiler.
......@@ -2165,10 +2155,8 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject** slot,
HeapObject* object) {
int object_size = FixedArray::BodyDescriptor::SizeOf(map, object);
EvacuateObject<POINTER_OBJECT, UNKNOWN_SIZE, kObjectAlignment>(map,
slot,
object,
object_size);
EvacuateObject<POINTER_OBJECT, kObjectAlignment>(
map, slot, object, object_size);
}
......@@ -2177,11 +2165,8 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject* object) {
int length = reinterpret_cast<FixedDoubleArray*>(object)->length();
int object_size = FixedDoubleArray::SizeFor(length);
EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kDoubleAlignment>(
map,
slot,
object,
object_size);
EvacuateObject<DATA_OBJECT, kDoubleAlignment>(
map, slot, object, object_size);
}
......@@ -2189,7 +2174,7 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject** slot,
HeapObject* object) {
int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize();
EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>(
EvacuateObject<DATA_OBJECT, kObjectAlignment>(
map, slot, object, object_size);
}
......@@ -2199,7 +2184,7 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject* object) {
int object_size = SeqOneByteString::cast(object)->
SeqOneByteStringSize(map->instance_type());
EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>(
EvacuateObject<DATA_OBJECT, kObjectAlignment>(
map, slot, object, object_size);
}
......@@ -2209,7 +2194,7 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject* object) {
int object_size = SeqTwoByteString::cast(object)->
SeqTwoByteStringSize(map->instance_type());
EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>(
EvacuateObject<DATA_OBJECT, kObjectAlignment>(
map, slot, object, object_size);
}
......@@ -2253,7 +2238,7 @@ class ScavengingVisitor : public StaticVisitorBase {
}
int object_size = ConsString::kSize;
EvacuateObject<POINTER_OBJECT, SMALL, kObjectAlignment>(
EvacuateObject<POINTER_OBJECT, kObjectAlignment>(
map, slot, object, object_size);
}
......@@ -2264,7 +2249,7 @@ class ScavengingVisitor : public StaticVisitorBase {
static inline void VisitSpecialized(Map* map,
HeapObject** slot,
HeapObject* object) {
EvacuateObject<object_contents, SMALL, kObjectAlignment>(
EvacuateObject<object_contents, kObjectAlignment>(
map, slot, object, object_size);
}
......@@ -2272,7 +2257,7 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject** slot,
HeapObject* object) {
int object_size = map->instance_size();
EvacuateObject<object_contents, SMALL, kObjectAlignment>(
EvacuateObject<object_contents, kObjectAlignment>(
map, slot, object, object_size);
}
};
......
......@@ -141,7 +141,7 @@ class StaticVisitorBase : public AllStatic {
(base == kVisitJSObject));
ASSERT(IsAligned(object_size, kPointerSize));
ASSERT(kMinObjectSizeInWords * kPointerSize <= object_size);
ASSERT(object_size < Page::kMaxNonCodeHeapObjectSize);
ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
const VisitorId specialization = static_cast<VisitorId>(
base + (object_size >> kPointerSizeLog2) - kMinObjectSizeInWords);
......
......@@ -784,8 +784,9 @@ class Page : public MemoryChunk {
// Maximum object size that fits in a page. Objects larger than that size
// are allocated in large object space and are never moved in memory. This
// also applies to new space allocation, since objects are never migrated
// from new space to large object space.
static const int kMaxNonCodeHeapObjectSize = kNonCodeObjectAreaSize;
// from new space to large object space. Takes double alignment into account.
static const int kMaxNonCodeHeapObjectSize =
kNonCodeObjectAreaSize - kPointerSize;
// Page size mask.
static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1;
......
......@@ -960,7 +960,7 @@ TEST(Regression39128) {
Factory* factory = isolate->factory();
// Increase the chance of 'bump-the-pointer' allocation in old space.
HEAP->CollectAllGarbage(Heap::kNoGCFlags);
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
v8::HandleScope scope(CcTest::isolate());
......@@ -984,7 +984,7 @@ TEST(Regression39128) {
// just enough room to allocate JSObject and thus fill the newspace.
int allocation_amount = Min(FixedArray::kMaxSize,
Page::kMaxNonCodeHeapObjectSize);
Page::kMaxNonCodeHeapObjectSize + kPointerSize);
int allocation_len = LenFromSize(allocation_amount);
NewSpace* new_space = HEAP->new_space();
Address* top_addr = new_space->allocation_top_address();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment