[heap] Introduce a CodeSpace class.
Bug: chromium:840329 Change-Id: If45a98c7f8a97f2482ac1bed7f7dda7d6e62b6b9 Reviewed-on: https://chromium-review.googlesource.com/1046658 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Hannes Payer <hpayer@chromium.org> Cr-Commit-Position: refs/heads/master@{#53025}
This commit is contained in:
parent
3708887893
commit
ea3e9de657
@ -461,6 +461,7 @@ class AccessorInfo;
|
||||
class Arguments;
|
||||
class Assembler;
|
||||
class Code;
|
||||
class CodeSpace;
|
||||
class CodeStub;
|
||||
class Context;
|
||||
class Debug;
|
||||
|
@ -4643,11 +4643,10 @@ bool Heap::SetUp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
space_[OLD_SPACE] = old_space_ =
|
||||
new OldSpace(this, OLD_SPACE, NOT_EXECUTABLE);
|
||||
space_[OLD_SPACE] = old_space_ = new OldSpace(this);
|
||||
if (!old_space_->SetUp()) return false;
|
||||
|
||||
space_[CODE_SPACE] = code_space_ = new OldSpace(this, CODE_SPACE, EXECUTABLE);
|
||||
space_[CODE_SPACE] = code_space_ = new CodeSpace(this);
|
||||
if (!code_space_->SetUp()) return false;
|
||||
|
||||
space_[MAP_SPACE] = map_space_ = new MapSpace(this, MAP_SPACE);
|
||||
|
@ -1025,7 +1025,7 @@ class Heap {
|
||||
|
||||
NewSpace* new_space() { return new_space_; }
|
||||
OldSpace* old_space() { return old_space_; }
|
||||
OldSpace* code_space() { return code_space_; }
|
||||
CodeSpace* code_space() { return code_space_; }
|
||||
MapSpace* map_space() { return map_space_; }
|
||||
LargeObjectSpace* lo_space() { return lo_space_; }
|
||||
ReadOnlySpace* read_only_space() { return read_only_space_; }
|
||||
@ -2252,7 +2252,7 @@ class Heap {
|
||||
|
||||
NewSpace* new_space_;
|
||||
OldSpace* old_space_;
|
||||
OldSpace* code_space_;
|
||||
CodeSpace* code_space_;
|
||||
MapSpace* map_space_;
|
||||
LargeObjectSpace* lo_space_;
|
||||
ReadOnlySpace* read_only_space_;
|
||||
|
@ -2846,16 +2846,24 @@ class CompactionSpaceCollection : public Malloced {
|
||||
CompactionSpace code_space_;
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Old object space (includes the old space of objects and code space)
|
||||
// Old generation regular object space.
|
||||
|
||||
class OldSpace : public PagedSpace {
|
||||
public:
|
||||
// Creates an old space object. The constructor does not allocate pages
|
||||
// from OS.
|
||||
OldSpace(Heap* heap, AllocationSpace id, Executability executable)
|
||||
: PagedSpace(heap, id, executable) {}
|
||||
explicit OldSpace(Heap* heap) : PagedSpace(heap, OLD_SPACE, NOT_EXECUTABLE) {}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Old generation code object space.
|
||||
|
||||
class CodeSpace : public PagedSpace {
|
||||
public:
|
||||
// Creates an old space object. The constructor does not allocate pages
|
||||
// from OS.
|
||||
explicit CodeSpace(Heap* heap) : PagedSpace(heap, CODE_SPACE, EXECUTABLE) {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ MaybeHandle<Object> PartialDeserializer::Deserialize(
|
||||
DisallowHeapAllocation no_gc;
|
||||
// Keep track of the code space start and end pointers in case new
|
||||
// code objects were unserialized
|
||||
OldSpace* code_space = isolate->heap()->code_space();
|
||||
CodeSpace* code_space = isolate->heap()->code_space();
|
||||
Address start_address = code_space->top();
|
||||
Object* root;
|
||||
VisitRootPointer(Root::kPartialSnapshotCache, nullptr, &root);
|
||||
|
@ -208,7 +208,7 @@ TEST(MemoryAllocator) {
|
||||
|
||||
{
|
||||
int total_pages = 0;
|
||||
OldSpace faked_space(heap, OLD_SPACE, NOT_EXECUTABLE);
|
||||
OldSpace faked_space(heap);
|
||||
Page* first_page = memory_allocator->AllocatePage(
|
||||
faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
|
||||
NOT_EXECUTABLE);
|
||||
@ -277,7 +277,7 @@ TEST(OldSpace) {
|
||||
CHECK(memory_allocator->SetUp(heap->MaxReserved(), 0));
|
||||
TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
|
||||
|
||||
OldSpace* s = new OldSpace(heap, OLD_SPACE, NOT_EXECUTABLE);
|
||||
OldSpace* s = new OldSpace(heap);
|
||||
CHECK_NOT_NULL(s);
|
||||
|
||||
CHECK(s->SetUp());
|
||||
|
Loading…
Reference in New Issue
Block a user