Commit cad73fcb authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Reland decrease large object limit for regular heap objects.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#31290}
parent b802051d
......@@ -2663,8 +2663,9 @@ void MarkCompactCollector::MigrateObject(
Address dst_addr = dst->address();
Address src_addr = src->address();
DCHECK(heap()->AllowedToBeMigrated(src, dest));
DCHECK(dest != LO_SPACE && size <= Page::kMaxRegularHeapObjectSize);
DCHECK(dest != LO_SPACE);
if (dest == OLD_SPACE) {
DCHECK_OBJECT_SIZE(size);
DCHECK(evacuation_slots_buffer != nullptr);
DCHECK(IsAligned(size, kPointerSize));
switch (src->ContentType()) {
......@@ -2688,12 +2689,14 @@ void MarkCompactCollector::MigrateObject(
evacuation_slots_buffer);
}
} else if (dest == CODE_SPACE) {
DCHECK_CODEOBJECT_SIZE(size, heap()->code_space());
DCHECK(evacuation_slots_buffer != nullptr);
PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr));
heap()->MoveBlock(dst_addr, src_addr, size);
RecordMigratedCodeObjectSlot(dst_addr, evacuation_slots_buffer);
Code::cast(dst)->Relocate(dst_addr - src_addr);
} else {
DCHECK_OBJECT_SIZE(size);
DCHECK(evacuation_slots_buffer == nullptr);
DCHECK(dest == NEW_SPACE);
heap()->MoveBlock(dst_addr, src_addr, size);
......@@ -3077,8 +3080,6 @@ static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
bool MarkCompactCollector::TryPromoteObject(HeapObject* object,
int object_size) {
DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
OldSpace* old_space = heap()->old_space();
HeapObject* target = nullptr;
......
......@@ -216,7 +216,7 @@ class ScavengingVisitor : public StaticVisitorBase {
template <ObjectContents object_contents, AllocationAlignment alignment>
static inline void EvacuateObject(Map* map, HeapObject** slot,
HeapObject* object, int object_size) {
SLOW_DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
SLOW_DCHECK(object_size <= Page::kAllocatableMemory);
SLOW_DCHECK(object->Size() == object_size);
Heap* heap = map->GetHeap();
......
......@@ -133,7 +133,12 @@ HeapObject* HeapObjectIterator::FromCurrentPage() {
}
if (!obj->IsFiller()) {
DCHECK_OBJECT_SIZE(obj_size);
if (obj->IsCode()) {
DCHECK_EQ(space_, space_->heap()->code_space());
DCHECK_CODEOBJECT_SIZE(obj_size, space_);
} else {
DCHECK_OBJECT_SIZE(obj_size);
}
return obj;
}
}
......
......@@ -86,6 +86,9 @@ class Isolate;
#define DCHECK_OBJECT_SIZE(size) \
DCHECK((0 < size) && (size <= Page::kMaxRegularHeapObjectSize))
#define DCHECK_CODEOBJECT_SIZE(size, code_space) \
DCHECK((0 < size) && (size <= code_space->AreaSize()))
#define DCHECK_PAGE_OFFSET(offset) \
DCHECK((Page::kObjectStartOffset <= offset) && (offset <= Page::kPageSize))
......@@ -840,7 +843,9 @@ class Page : public MemoryChunk {
// memory. This also applies to new space allocation, since objects are never
// migrated from new space to large object space. Takes double alignment into
// account.
static const int kMaxRegularHeapObjectSize = kPageSize - kObjectStartOffset;
// TODO(hpayer): This limit should be way smaller but we currently have
// short living objects >256K.
static const int kMaxRegularHeapObjectSize = 600 * KB;
static const int kAllocatableMemory = kPageSize - kObjectStartOffset;
......
......@@ -10093,9 +10093,13 @@ class JSArray: public JSObject {
static const int kLengthOffset = JSObject::kHeaderSize;
static const int kSize = kLengthOffset + kPointerSize;
// Note that Page::kMaxRegularHeapObjectSize puts a limit on
// permissible values (see the DCHECK in heap.cc).
static const int kInitialMaxFastElementArray = 100000;
// 600 * KB is the Page::kMaxRegularHeapObjectSize defined in spaces.h which
// we do not want to include in objects.h
// Note that Page::kMaxRegularHeapObjectSize has to be in sync with
// kInitialMaxFastElementArray which is checked in a DCHECK in heap.cc.
static const int kInitialMaxFastElementArray =
(600 * KB - FixedArray::kHeaderSize - kSize - AllocationMemento::kSize) /
kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray);
......
......@@ -1223,7 +1223,7 @@ TEST(SerializeToplevelThreeBigStrings) {
CompileRun("a")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE));
result_str = CompileRun("b")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
......
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