From: hpayer@chromium.org Date: Mon, 15 Apr 2013 11:52:34 +0000 (+0000) Subject: Implement direct allocation in old data space infrastructure. X-Git-Tag: upstream/4.7.83~14585 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2345bdbeb3abcdf4ce557abec29c88a52748a69d;p=platform%2Fupstream%2Fv8.git Implement direct allocation in old data space infrastructure. BUG= Review URL: https://codereview.chromium.org/12697011 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14262 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/assembler.cc b/src/assembler.cc index 458930b..5bde8c5 100644 --- a/src/assembler.cc +++ b/src/assembler.cc @@ -1189,6 +1189,20 @@ ExternalReference ExternalReference::old_pointer_space_allocation_limit_address( } +ExternalReference ExternalReference::old_data_space_allocation_top_address( + Isolate* isolate) { + return ExternalReference( + isolate->heap()->OldDataSpaceAllocationTopAddress()); +} + + +ExternalReference ExternalReference::old_data_space_allocation_limit_address( + Isolate* isolate) { + return ExternalReference( + isolate->heap()->OldDataSpaceAllocationLimitAddress()); +} + + ExternalReference ExternalReference::handle_scope_level_address( Isolate* isolate) { return ExternalReference(HandleScope::current_level_address(isolate)); diff --git a/src/assembler.h b/src/assembler.h index e26b525..381ae0a 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -753,6 +753,10 @@ class ExternalReference BASE_EMBEDDED { Isolate* isolate); static ExternalReference old_pointer_space_allocation_limit_address( Isolate* isolate); + static ExternalReference old_data_space_allocation_top_address( + Isolate* isolate); + static ExternalReference old_data_space_allocation_limit_address( + Isolate* isolate); static ExternalReference double_fp_operation(Token::Value operation, Isolate* isolate); diff --git a/src/heap-inl.h b/src/heap-inl.h index a15b8ef..9df5135 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -345,6 +345,16 @@ bool Heap::InOldPointerSpace(Object* object) { } +bool Heap::InOldDataSpace(Address address) { + return old_data_space_->Contains(address); +} + + +bool Heap::InOldDataSpace(Object* object) { + return InOldDataSpace(reinterpret_cast
(object)); +} + + bool Heap::OldGenerationAllocationLimitReached() { if (!incremental_marking()->IsStopped()) return false; return OldGenerationSpaceAvailable() < 0; diff --git a/src/heap.h b/src/heap.h index 46c75fe..e07db81 100644 --- a/src/heap.h +++ b/src/heap.h @@ -602,6 +602,13 @@ class Heap { return old_pointer_space_->allocation_limit_address(); } + Address* OldDataSpaceAllocationTopAddress() { + return old_data_space_->allocation_top_address(); + } + Address* OldDataSpaceAllocationLimitAddress() { + return old_data_space_->allocation_limit_address(); + } + // Uncommit unused semi space. bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } @@ -1330,6 +1337,10 @@ class Heap { inline bool InOldPointerSpace(Address address); inline bool InOldPointerSpace(Object* object); + // Returns whether the object resides in old data space. + inline bool InOldDataSpace(Address address); + inline bool InOldDataSpace(Object* object); + // Checks whether an address/object in the heap (including auxiliary // area and unused area). bool Contains(Address addr); diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 7acec8b..ae118a1 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -4879,7 +4879,6 @@ class HAllocate: public HTemplateInstruction<2> { HAllocate(HValue* context, HValue* size, HType type, Flags flags) : type_(type), flags_(flags) { - ASSERT((flags & CAN_ALLOCATE_IN_OLD_DATA_SPACE) == 0); // unimplemented SetOperandAt(0, context); SetOperandAt(1, size); set_representation(Representation::Tagged()); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 9a6120a..9bfc110 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -1264,10 +1264,14 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context, total_size->ClearFlag(HValue::kCanOverflow); HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; - // TODO(hpayer): add support for old data space - if (FLAG_pretenure_literals && !IsFastDoubleElementsKind(kind)) { - flags = static_cast( - flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); + if (FLAG_pretenure_literals) { + if (IsFastDoubleElementsKind(kind)) { + flags = static_cast( + flags | HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE); + } else { + flags = static_cast( + flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); + } } if (IsFastDoubleElementsKind(kind)) { flags = static_cast( diff --git a/src/macro-assembler.h b/src/macro-assembler.h index 55dccfa..9fdf2ee 100644 --- a/src/macro-assembler.h +++ b/src/macro-assembler.h @@ -51,7 +51,9 @@ enum AllocationFlags { // Align the allocation to a multiple of kDoubleSize DOUBLE_ALIGNMENT = 1 << 3, // Directly allocate in old pointer space - PRETENURE_OLD_POINTER_SPACE = 1 << 4 + PRETENURE_OLD_POINTER_SPACE = 1 << 4, + // Directly allocate in old data space + PRETENURE_OLD_DATA_SPACE = 1 << 5 }; @@ -175,17 +177,26 @@ class AllocationUtils { public: static ExternalReference GetAllocationTopReference( Isolate* isolate, AllocationFlags flags) { - return ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) ? - ExternalReference::old_pointer_space_allocation_top_address(isolate) : - ExternalReference::new_space_allocation_top_address(isolate); + if ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) { + return ExternalReference::old_pointer_space_allocation_top_address( + isolate); + } else if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { + return ExternalReference::old_data_space_allocation_top_address(isolate); + } + return ExternalReference::new_space_allocation_top_address(isolate); } static ExternalReference GetAllocationLimitReference( Isolate* isolate, AllocationFlags flags) { - return ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) ? - ExternalReference::old_pointer_space_allocation_limit_address(isolate) : - ExternalReference::new_space_allocation_limit_address(isolate); + if ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) { + return ExternalReference::old_pointer_space_allocation_limit_address( + isolate); + } else if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { + return ExternalReference::old_data_space_allocation_limit_address( + isolate); + } + return ExternalReference::new_space_allocation_limit_address(isolate); } };