Remove specialized raw Cell and Map allocators.

R=hpayer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17380 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c2596a25
...@@ -296,40 +296,6 @@ void Heap::FinalizeExternalString(String* string) { ...@@ -296,40 +296,6 @@ void Heap::FinalizeExternalString(String* string) {
} }
MaybeObject* Heap::AllocateRawMap() {
#ifdef DEBUG
isolate_->counters()->objs_since_last_full()->Increment();
isolate_->counters()->objs_since_last_young()->Increment();
#endif
MaybeObject* result = map_space_->AllocateRaw(Map::kSize);
if (result->IsFailure()) old_gen_exhausted_ = true;
return result;
}
MaybeObject* Heap::AllocateRawCell() {
#ifdef DEBUG
isolate_->counters()->objs_since_last_full()->Increment();
isolate_->counters()->objs_since_last_young()->Increment();
#endif
MaybeObject* result = cell_space_->AllocateRaw(Cell::kSize);
if (result->IsFailure()) old_gen_exhausted_ = true;
return result;
}
MaybeObject* Heap::AllocateRawPropertyCell() {
#ifdef DEBUG
isolate_->counters()->objs_since_last_full()->Increment();
isolate_->counters()->objs_since_last_young()->Increment();
#endif
MaybeObject* result =
property_cell_space_->AllocateRaw(PropertyCell::kSize);
if (result->IsFailure()) old_gen_exhausted_ = true;
return result;
}
bool Heap::InNewSpace(Object* object) { bool Heap::InNewSpace(Object* object) {
bool result = new_space_.Contains(object); bool result = new_space_.Contains(object);
ASSERT(!result || // Either not in new space ASSERT(!result || // Either not in new space
......
...@@ -2436,7 +2436,7 @@ void Heap::ScavengeObjectSlow(HeapObject** p, HeapObject* object) { ...@@ -2436,7 +2436,7 @@ void Heap::ScavengeObjectSlow(HeapObject** p, HeapObject* object) {
MaybeObject* Heap::AllocatePartialMap(InstanceType instance_type, MaybeObject* Heap::AllocatePartialMap(InstanceType instance_type,
int instance_size) { int instance_size) {
Object* result; Object* result;
MaybeObject* maybe_result = AllocateRawMap(); MaybeObject* maybe_result = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE);
if (!maybe_result->ToObject(&result)) return maybe_result; if (!maybe_result->ToObject(&result)) return maybe_result;
// Map::cast cannot be used due to uninitialized map field. // Map::cast cannot be used due to uninitialized map field.
...@@ -2461,7 +2461,7 @@ MaybeObject* Heap::AllocateMap(InstanceType instance_type, ...@@ -2461,7 +2461,7 @@ MaybeObject* Heap::AllocateMap(InstanceType instance_type,
int instance_size, int instance_size,
ElementsKind elements_kind) { ElementsKind elements_kind) {
Object* result; Object* result;
MaybeObject* maybe_result = AllocateRawMap(); MaybeObject* maybe_result = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE);
if (!maybe_result->To(&result)) return maybe_result; if (!maybe_result->To(&result)) return maybe_result;
Map* map = reinterpret_cast<Map*>(result); Map* map = reinterpret_cast<Map*>(result);
...@@ -2953,8 +2953,11 @@ MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { ...@@ -2953,8 +2953,11 @@ MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
MaybeObject* Heap::AllocateCell(Object* value) { MaybeObject* Heap::AllocateCell(Object* value) {
int size = Cell::kSize;
STATIC_ASSERT(Cell::kSize <= Page::kNonCodeObjectAreaSize);
Object* result; Object* result;
{ MaybeObject* maybe_result = AllocateRawCell(); { MaybeObject* maybe_result = AllocateRaw(size, CELL_SPACE, CELL_SPACE);
if (!maybe_result->ToObject(&result)) return maybe_result; if (!maybe_result->ToObject(&result)) return maybe_result;
} }
HeapObject::cast(result)->set_map_no_write_barrier(cell_map()); HeapObject::cast(result)->set_map_no_write_barrier(cell_map());
...@@ -2964,8 +2967,12 @@ MaybeObject* Heap::AllocateCell(Object* value) { ...@@ -2964,8 +2967,12 @@ MaybeObject* Heap::AllocateCell(Object* value) {
MaybeObject* Heap::AllocatePropertyCell() { MaybeObject* Heap::AllocatePropertyCell() {
int size = PropertyCell::kSize;
STATIC_ASSERT(PropertyCell::kSize <= Page::kNonCodeObjectAreaSize);
Object* result; Object* result;
MaybeObject* maybe_result = AllocateRawPropertyCell(); MaybeObject* maybe_result =
AllocateRaw(size, PROPERTY_CELL_SPACE, PROPERTY_CELL_SPACE);
if (!maybe_result->ToObject(&result)) return maybe_result; if (!maybe_result->ToObject(&result)) return maybe_result;
HeapObject::cast(result)->set_map_no_write_barrier( HeapObject::cast(result)->set_map_no_write_barrier(
......
...@@ -2091,18 +2091,6 @@ class Heap { ...@@ -2091,18 +2091,6 @@ class Heap {
return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE;
} }
// Allocate an uninitialized object in map space. The behavior is identical
// to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't
// have to test the allocation space argument and (b) can reduce code size
// (since both AllocateRaw and AllocateRawMap are inlined).
MUST_USE_RESULT inline MaybeObject* AllocateRawMap();
// Allocate an uninitialized object in the simple cell space.
MUST_USE_RESULT inline MaybeObject* AllocateRawCell();
// Allocate an uninitialized object in the global property cell space.
MUST_USE_RESULT inline MaybeObject* AllocateRawPropertyCell();
// Allocate an uninitialized fixed array. // Allocate an uninitialized fixed array.
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(
int length, PretenureFlag pretenure); int length, PretenureFlag pretenure);
......
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