Commit 2345bdbe authored by hpayer@chromium.org's avatar hpayer@chromium.org

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
parent 8ddca544
......@@ -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));
......
......@@ -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);
......
......@@ -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<Address>(object));
}
bool Heap::OldGenerationAllocationLimitReached() {
if (!incremental_marking()->IsStopped()) return false;
return OldGenerationSpaceAvailable() < 0;
......
......@@ -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);
......
......@@ -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());
......
......@@ -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<HAllocate::Flags>(
flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
if (FLAG_pretenure_literals) {
if (IsFastDoubleElementsKind(kind)) {
flags = static_cast<HAllocate::Flags>(
flags | HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE);
} else {
flags = static_cast<HAllocate::Flags>(
flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
}
}
if (IsFastDoubleElementsKind(kind)) {
flags = static_cast<HAllocate::Flags>(
......
......@@ -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);
}
};
......
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