// Compute map and object size.
Map* map = one_byte_internalized_string_map();
int size = SeqOneByteString::SizeFor(str.length());
+ AllocationSpace space = SelectSpace(size, TENURED);
// Allocate string.
HeapObject* result = nullptr;
{
- AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
+ AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
if (!allocation.To(&result)) return allocation;
}
// Compute map and object size.
Map* map = internalized_string_map();
int size = SeqTwoByteString::SizeFor(str.length());
+ AllocationSpace space = SelectSpace(size, TENURED);
// Allocate string.
HeapObject* result = nullptr;
{
- AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
+ AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
if (!allocation.To(&result)) return allocation;
}
isolate_->counters()->objs_since_last_young()->Increment();
#endif
- bool large_object = size_in_bytes > Page::kMaxRegularHeapObjectSize;
HeapObject* object = nullptr;
AllocationResult allocation;
if (NEW_SPACE == space) {
- if (!large_object) {
- allocation = new_space_.AllocateRaw(size_in_bytes, alignment);
- if (always_allocate() && allocation.IsRetry() &&
- retry_space != NEW_SPACE) {
- space = retry_space;
- } else {
- if (allocation.To(&object)) {
- OnAllocationEvent(object, size_in_bytes);
- }
- return allocation;
- }
+ allocation = new_space_.AllocateRaw(size_in_bytes, alignment);
+ if (always_allocate() && allocation.IsRetry() && retry_space != NEW_SPACE) {
+ space = retry_space;
} else {
- space = LO_SPACE;
+ if (allocation.To(&object)) {
+ OnAllocationEvent(object, size_in_bytes);
+ }
+ return allocation;
}
}
if (OLD_SPACE == space) {
- if (!large_object) {
- allocation = old_space_->AllocateRaw(size_in_bytes, alignment);
- } else {
- allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
- }
+ allocation = old_space_->AllocateRaw(size_in_bytes, alignment);
} else if (CODE_SPACE == space) {
- if (!large_object) {
+ if (size_in_bytes <= code_space()->AreaSize()) {
allocation = code_space_->AllocateRawUnaligned(size_in_bytes);
} else {
+ // Large code objects are allocated in large object space.
allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE);
}
} else if (LO_SPACE == space) {
- DCHECK(large_object);
allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
- } else if (MAP_SPACE == space) {
+ } else {
+ DCHECK(MAP_SPACE == space);
allocation = map_space_->AllocateRawUnaligned(size_in_bytes);
}
if (allocation.To(&object)) {
int size = HeapNumber::kSize;
STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxRegularHeapObjectSize);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* result = nullptr;
{
int size = Type::kSize; \
STATIC_ASSERT(Type::kSize <= Page::kMaxRegularHeapObjectSize); \
\
- AllocationSpace space = SelectSpace(pretenure); \
+ AllocationSpace space = SelectSpace(size, pretenure); \
\
HeapObject* result = nullptr; \
{ \
v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
}
int size = ByteArray::SizeFor(length);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* result = nullptr;
{
AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
int length, ExternalArrayType array_type, void* external_pointer,
PretenureFlag pretenure) {
int size = FixedTypedArrayBase::kHeaderSize;
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* result = nullptr;
{
AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
ForFixedTypedArray(array_type, &element_size, &elements_kind);
int size = OBJECT_POINTER_ALIGN(length * element_size +
FixedTypedArrayBase::kDataOffset);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* object = nullptr;
AllocationResult allocation = AllocateRaw(
FixedArray* properties = empty_fixed_array();
// Allocate the JSObject.
- AllocationSpace space = SelectSpace(pretenure);
+ int size = map->instance_size();
+ AllocationSpace space = SelectSpace(size, pretenure);
JSObject* js_obj = nullptr;
AllocationResult allocation = Allocate(map, space, allocation_site);
if (!allocation.To(&js_obj)) return allocation;
map = internalized_string_map();
size = SeqTwoByteString::SizeFor(chars);
}
+ AllocationSpace space = SelectSpace(size, TENURED);
// Allocate string.
HeapObject* result = nullptr;
{
- AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
+ AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
if (!allocation.To(&result)) return allocation;
}
DCHECK_GE(String::kMaxLength, length);
int size = SeqOneByteString::SizeFor(length);
DCHECK(size <= SeqOneByteString::kMaxSize);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* result = nullptr;
{
DCHECK_GE(String::kMaxLength, length);
int size = SeqTwoByteString::SizeFor(length);
DCHECK(size <= SeqTwoByteString::kMaxSize);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* result = nullptr;
{
v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
}
int size = FixedArray::SizeFor(length);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
return AllocateRaw(size, space, OLD_SPACE);
}
kDoubleAligned);
}
int size = FixedDoubleArray::SizeFor(length);
- AllocationSpace space = SelectSpace(pretenure);
+ AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* object = nullptr;
{
return exception();
}
int size = map->instance_size();
+ AllocationSpace space = SelectSpace(size, TENURED);
Struct* result = nullptr;
{
- AllocationResult allocation = Allocate(map, OLD_SPACE);
+ AllocationResult allocation = Allocate(map, space);
if (!allocation.To(&result)) return allocation;
}
result->InitializeBody(size);