Make runtime new-space allocations go through Heap::AllocateRaw.

R=ulan@chromium.org, ishell@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17603 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c824bfb4
...@@ -217,10 +217,6 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes, ...@@ -217,10 +217,6 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes,
ASSERT(AllowHandleAllocation::IsAllowed()); ASSERT(AllowHandleAllocation::IsAllowed());
ASSERT(AllowHeapAllocation::IsAllowed()); ASSERT(AllowHeapAllocation::IsAllowed());
ASSERT(gc_state_ == NOT_IN_GC); ASSERT(gc_state_ == NOT_IN_GC);
ASSERT(space != NEW_SPACE ||
retry_space == OLD_POINTER_SPACE ||
retry_space == OLD_DATA_SPACE ||
retry_space == LO_SPACE);
#ifdef DEBUG #ifdef DEBUG
if (FLAG_gc_interval >= 0 && if (FLAG_gc_interval >= 0 &&
!disallow_allocation_failure_ && !disallow_allocation_failure_ &&
...@@ -233,7 +229,7 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes, ...@@ -233,7 +229,7 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes,
MaybeObject* result; MaybeObject* result;
if (NEW_SPACE == space) { if (NEW_SPACE == space) {
result = new_space_.AllocateRaw(size_in_bytes); result = new_space_.AllocateRaw(size_in_bytes);
if (always_allocate() && result->IsFailure()) { if (always_allocate() && result->IsFailure() && retry_space != NEW_SPACE) {
space = retry_space; space = retry_space;
} else { } else {
return result; return result;
......
...@@ -4823,7 +4823,8 @@ MaybeObject* Heap::CopyJSObject(JSObject* source, AllocationSite* site) { ...@@ -4823,7 +4823,8 @@ MaybeObject* Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
{ int adjusted_object_size = site != NULL { int adjusted_object_size = site != NULL
? object_size + AllocationMemento::kSize ? object_size + AllocationMemento::kSize
: object_size; : object_size;
MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size); MaybeObject* maybe_clone =
AllocateRaw(adjusted_object_size, NEW_SPACE, NEW_SPACE);
if (!maybe_clone->ToObject(&clone)) return maybe_clone; if (!maybe_clone->ToObject(&clone)) return maybe_clone;
} }
SLOW_ASSERT(InNewSpace(clone)); SLOW_ASSERT(InNewSpace(clone));
......
...@@ -2475,6 +2475,7 @@ class AlwaysAllocateScope { ...@@ -2475,6 +2475,7 @@ class AlwaysAllocateScope {
DisallowAllocationFailure disallow_allocation_failure_; DisallowAllocationFailure disallow_allocation_failure_;
}; };
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
class NoWeakObjectVerificationScope { class NoWeakObjectVerificationScope {
public: public:
......
...@@ -9710,30 +9710,25 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { ...@@ -9710,30 +9710,25 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
} }
// Allocate a block of memory in the given space (filled with a filler).
// Used as a fall-back for generated code when the space is full.
static MaybeObject* Allocate(Isolate* isolate, static MaybeObject* Allocate(Isolate* isolate,
int size, int size,
AllocationSpace space) { AllocationSpace space) {
// Allocate a block of memory in the given space (filled with a filler). Heap* heap = isolate->heap();
// Use as fallback for allocation in generated code when the space
// is full.
SealHandleScope shs(isolate);
RUNTIME_ASSERT(IsAligned(size, kPointerSize)); RUNTIME_ASSERT(IsAligned(size, kPointerSize));
RUNTIME_ASSERT(size > 0); RUNTIME_ASSERT(size > 0);
Heap* heap = isolate->heap();
RUNTIME_ASSERT(size <= heap->MaxRegularSpaceAllocationSize()); RUNTIME_ASSERT(size <= heap->MaxRegularSpaceAllocationSize());
Object* allocation; HeapObject* allocation;
{ MaybeObject* maybe_allocation; { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space);
if (space == NEW_SPACE) { if (!maybe_allocation->To(&allocation)) return maybe_allocation;
maybe_allocation = heap->new_space()->AllocateRaw(size);
} else {
ASSERT(space == OLD_POINTER_SPACE || space == OLD_DATA_SPACE);
maybe_allocation = heap->paged_space(space)->AllocateRaw(size);
}
if (maybe_allocation->ToObject(&allocation)) {
heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size);
}
return maybe_allocation;
} }
#ifdef DEBUG
MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address());
ASSERT(chunk->owner()->identity() == space);
#endif
heap->CreateFillerObjectAt(allocation->address(), size);
return allocation;
} }
......
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