Commit a0809161 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[heap/factory] remove unnecessary allocation flags

Bug: v8:9714
Change-Id: I70c28c3bc2aae6234e55e8a3b176da2035520a67
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1800567
Commit-Queue: Victor Gomes <victorgomes@google.com>
Auto-Submit: Victor Gomes <victorgomes@google.com>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63717}
parent d9abfa15
......@@ -43,25 +43,23 @@ Handle<String> Factory::NewSubString(Handle<String> str, int begin, int end) {
return NewProperSubString(str, begin, end);
}
Handle<Object> Factory::NewNumberFromSize(size_t value,
AllocationType allocation) {
Handle<Object> Factory::NewNumberFromSize(size_t value) {
// We can't use Smi::IsValid() here because that operates on a signed
// intptr_t, and casting from size_t could create a bogus sign bit.
if (value <= static_cast<size_t>(Smi::kMaxValue)) {
return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
isolate());
}
return NewNumber(static_cast<double>(value), allocation);
return NewNumber(static_cast<double>(value));
}
Handle<Object> Factory::NewNumberFromInt64(int64_t value,
AllocationType allocation) {
Handle<Object> Factory::NewNumberFromInt64(int64_t value) {
if (value <= std::numeric_limits<int32_t>::max() &&
value >= std::numeric_limits<int32_t>::min() &&
Smi::IsValid(static_cast<int32_t>(value))) {
return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)), isolate());
}
return NewNumber(static_cast<double>(value), allocation);
return NewNumber(static_cast<double>(value));
}
Handle<HeapNumber> Factory::NewHeapNumber(double value,
......@@ -78,9 +76,8 @@ Handle<HeapNumber> Factory::NewHeapNumberFromBits(uint64_t bits,
return heap_number;
}
Handle<HeapNumber> Factory::NewHeapNumberWithHoleNaN(
AllocationType allocation) {
return NewHeapNumberFromBits(kHoleNanInt64, allocation);
Handle<HeapNumber> Factory::NewHeapNumberWithHoleNaN() {
return NewHeapNumberFromBits(kHoleNanInt64);
}
Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements,
......
......@@ -358,24 +358,23 @@ Handle<TemplateObjectDescription> Factory::NewTemplateObjectDescription(
Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number,
const char* type_of, byte kind,
AllocationType allocation) {
Handle<Oddball> oddball(Oddball::cast(New(map, allocation)), isolate());
const char* type_of, byte kind) {
Handle<Oddball> oddball(Oddball::cast(New(map, AllocationType::kReadOnly)),
isolate());
Oddball::Initialize(isolate(), oddball, to_string, to_number, type_of, kind);
return oddball;
}
Handle<Oddball> Factory::NewSelfReferenceMarker(AllocationType allocation) {
Handle<Oddball> Factory::NewSelfReferenceMarker() {
return NewOddball(self_reference_marker_map(), "self_reference_marker",
handle(Smi::FromInt(-1), isolate()), "undefined",
Oddball::kSelfReferenceMarker, allocation);
Oddball::kSelfReferenceMarker);
}
Handle<PropertyArray> Factory::NewPropertyArray(int length,
AllocationType allocation) {
Handle<PropertyArray> Factory::NewPropertyArray(int length) {
DCHECK_LE(0, length);
if (length == 0) return empty_property_array();
HeapObject result = AllocateRawFixedArray(length, allocation);
HeapObject result = AllocateRawFixedArray(length, AllocationType::kYoung);
result.set_map_after_allocation(*property_array_map(), SKIP_WRITE_BARRIER);
Handle<PropertyArray> array(PropertyArray::cast(result), isolate());
array->initialize_length(length);
......@@ -419,7 +418,7 @@ Handle<T> Factory::NewWeakFixedArrayWithMap(RootIndex map_root_index,
DCHECK_LT(0, length);
HeapObject result =
AllocateRawArray(WeakFixedArray::SizeFor(length), allocation);
AllocateRawArray(WeakFixedArray::SizeFor(length), AllocationType::kOld);
Map map = Map::cast(isolate()->root(map_root_index));
result.set_map_after_allocation(map, SKIP_WRITE_BARRIER);
......@@ -485,8 +484,7 @@ Handle<FixedArray> Factory::NewFixedArrayWithHoles(int length,
*the_hole_value(), allocation);
}
Handle<FixedArray> Factory::NewUninitializedFixedArray(
int length, AllocationType allocation) {
Handle<FixedArray> Factory::NewUninitializedFixedArray(int length) {
DCHECK_LE(0, length);
if (length == 0) return empty_fixed_array();
......@@ -494,30 +492,30 @@ Handle<FixedArray> Factory::NewUninitializedFixedArray(
// array. After getting canary/performance coverage, either remove the
// function or revert to returning uninitilized array.
return NewFixedArrayWithFiller(RootIndex::kFixedArrayMap, length,
*undefined_value(), allocation);
*undefined_value(), AllocationType::kYoung);
}
Handle<ClosureFeedbackCellArray> Factory::NewClosureFeedbackCellArray(
int length, AllocationType allocation) {
int length) {
if (length == 0) return empty_closure_feedback_cell_array();
Handle<ClosureFeedbackCellArray> feedback_cell_array =
NewFixedArrayWithMap<ClosureFeedbackCellArray>(
RootIndex::kClosureFeedbackCellArrayMap, length, allocation);
RootIndex::kClosureFeedbackCellArrayMap, length,
AllocationType::kYoung);
return feedback_cell_array;
}
Handle<FeedbackVector> Factory::NewFeedbackVector(
Handle<SharedFunctionInfo> shared,
Handle<ClosureFeedbackCellArray> closure_feedback_cell_array,
AllocationType allocation) {
Handle<ClosureFeedbackCellArray> closure_feedback_cell_array) {
int length = shared->feedback_metadata().slot_count();
DCHECK_LE(0, length);
int size = FeedbackVector::SizeFor(length);
HeapObject result =
AllocateRawWithImmortalMap(size, allocation, *feedback_vector_map());
HeapObject result = AllocateRawWithImmortalMap(size, AllocationType::kOld,
*feedback_vector_map());
Handle<FeedbackVector> vector(FeedbackVector::cast(result), isolate());
vector->set_shared_function_info(*shared);
vector->set_optimized_code_weak_or_smi(MaybeObject::FromSmi(Smi::FromEnum(
......@@ -534,13 +532,12 @@ Handle<FeedbackVector> Factory::NewFeedbackVector(
return vector;
}
Handle<EmbedderDataArray> Factory::NewEmbedderDataArray(
int length, AllocationType allocation) {
Handle<EmbedderDataArray> Factory::NewEmbedderDataArray(int length) {
DCHECK_LE(0, length);
int size = EmbedderDataArray::SizeFor(length);
HeapObject result =
AllocateRawWithImmortalMap(size, allocation, *embedder_data_array_map());
HeapObject result = AllocateRawWithImmortalMap(size, AllocationType::kYoung,
*embedder_data_array_map());
Handle<EmbedderDataArray> array(EmbedderDataArray::cast(result), isolate());
array->set_length(length);
......@@ -604,10 +601,10 @@ Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int length,
return array;
}
Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles(
int length, AllocationType allocation) {
Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles(int length) {
DCHECK_LE(0, length);
Handle<FixedArrayBase> array = NewFixedDoubleArray(length, allocation);
Handle<FixedArrayBase> array =
NewFixedDoubleArray(length, AllocationType::kYoung);
if (length > 0) {
Handle<FixedDoubleArray>::cast(array)->FillWithHoles(0, length);
}
......@@ -633,11 +630,10 @@ Handle<FeedbackMetadata> Factory::NewFeedbackMetadata(
return data;
}
Handle<FrameArray> Factory::NewFrameArray(int number_of_frames,
AllocationType allocation) {
Handle<FrameArray> Factory::NewFrameArray(int number_of_frames) {
DCHECK_LE(0, number_of_frames);
Handle<FixedArray> result = NewFixedArrayWithHoles(
FrameArray::LengthFor(number_of_frames), allocation);
Handle<FixedArray> result =
NewFixedArrayWithHoles(FrameArray::LengthFor(number_of_frames));
result->set(FrameArray::kFrameCountIndex, Smi::kZero);
return Handle<FrameArray>::cast(result);
}
......@@ -1648,20 +1644,16 @@ Handle<AccessorInfo> Factory::NewAccessorInfo() {
return info;
}
Handle<Script> Factory::NewScript(Handle<String> source,
AllocationType allocation) {
return NewScriptWithId(source, isolate()->heap()->NextScriptId(), allocation);
Handle<Script> Factory::NewScript(Handle<String> source) {
return NewScriptWithId(source, isolate()->heap()->NextScriptId());
}
Handle<Script> Factory::NewScriptWithId(Handle<String> source, int script_id,
AllocationType allocation) {
DCHECK(allocation == AllocationType::kOld ||
allocation == AllocationType::kReadOnly);
Handle<Script> Factory::NewScriptWithId(Handle<String> source, int script_id) {
// Create and initialize script object.
Heap* heap = isolate()->heap();
ReadOnlyRoots roots(heap);
Handle<Script> script =
Handle<Script>::cast(NewStruct(SCRIPT_TYPE, allocation));
Handle<Script>::cast(NewStruct(SCRIPT_TYPE, AllocationType::kOld));
script->set_source(*source);
script->set_name(roots.undefined_value());
script->set_id(script_id);
......@@ -1748,12 +1740,12 @@ Handle<PromiseResolveThenableJobTask> Factory::NewPromiseResolveThenableJobTask(
return microtask;
}
Handle<Foreign> Factory::NewForeign(Address addr, AllocationType allocation) {
Handle<Foreign> Factory::NewForeign(Address addr) {
// Statically ensure that it is safe to allocate foreigns in paged spaces.
STATIC_ASSERT(Foreign::kSize <= kMaxRegularHeapObjectSize);
Map map = *foreign_map();
HeapObject result =
AllocateRawWithImmortalMap(map.instance_size(), allocation, map);
HeapObject result = AllocateRawWithImmortalMap(map.instance_size(),
AllocationType::kYoung, map);
Handle<Foreign> foreign(Foreign::cast(result), isolate());
foreign->set_foreign_address(addr);
return foreign;
......@@ -2120,9 +2112,9 @@ Handle<FixedArray> Factory::CopyFixedArrayAndGrow(Handle<FixedArray> array,
}
Handle<WeakFixedArray> Factory::CopyWeakFixedArrayAndGrow(
Handle<WeakFixedArray> src, int grow_by, AllocationType allocation) {
Handle<WeakFixedArray> src, int grow_by) {
DCHECK(!src->IsTransitionArray()); // Compacted by GC, this code doesn't work
return CopyArrayAndGrow(src, grow_by, allocation);
return CopyArrayAndGrow(src, grow_by, AllocationType::kOld);
}
Handle<WeakArrayList> Factory::CopyWeakArrayListAndGrow(
......@@ -2149,8 +2141,8 @@ Handle<WeakArrayList> Factory::CopyWeakArrayListAndGrow(
}
Handle<PropertyArray> Factory::CopyPropertyArrayAndGrow(
Handle<PropertyArray> array, int grow_by, AllocationType allocation) {
return CopyArrayAndGrow(array, grow_by, allocation);
Handle<PropertyArray> array, int grow_by) {
return CopyArrayAndGrow(array, grow_by, AllocationType::kYoung);
}
Handle<FixedArray> Factory::CopyFixedArrayUpTo(Handle<FixedArray> array,
......@@ -2746,9 +2738,8 @@ Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor,
return NewJSObjectFromMap(map, allocation);
}
Handle<JSObject> Factory::NewJSObjectWithNullProto(AllocationType allocation) {
Handle<JSObject> result =
NewJSObject(isolate()->object_function(), allocation);
Handle<JSObject> Factory::NewJSObjectWithNullProto() {
Handle<JSObject> result = NewJSObject(isolate()->object_function());
Handle<Map> new_map = Map::Copy(
isolate(), Handle<Map>(result->map(), isolate()), "ObjectWithNullProto");
Map::SetPrototype(isolate(), new_map, null_value());
......@@ -2897,13 +2888,14 @@ Handle<JSObject> Factory::NewSlowJSObjectFromMap(
Handle<JSObject> Factory::NewSlowJSObjectWithPropertiesAndElements(
Handle<HeapObject> prototype, Handle<NameDictionary> properties,
Handle<FixedArrayBase> elements, AllocationType allocation) {
Handle<FixedArrayBase> elements) {
Handle<Map> object_map = isolate()->slow_object_with_object_prototype_map();
if (object_map->prototype() != *prototype) {
object_map = Map::TransitionToPrototype(isolate(), object_map, prototype);
}
DCHECK(object_map->is_dictionary_map());
Handle<JSObject> object = NewJSObjectFromMap(object_map, allocation);
Handle<JSObject> object =
NewJSObjectFromMap(object_map, AllocationType::kYoung);
object->set_raw_properties_or_hash(*properties);
if (*elements != ReadOnlyRoots(isolate()).empty_fixed_array()) {
DCHECK(elements->IsNumberDictionary());
......@@ -3125,13 +3117,12 @@ MaybeHandle<JSArrayBuffer> Factory::NewJSArrayBufferAndBackingStore(
return array_buffer;
}
Handle<JSArrayBuffer> Factory::NewJSSharedArrayBuffer(
AllocationType allocation) {
Handle<JSArrayBuffer> Factory::NewJSSharedArrayBuffer() {
Handle<Map> map(
isolate()->native_context()->shared_array_buffer_fun().initial_map(),
isolate());
auto result =
Handle<JSArrayBuffer>::cast(NewJSObjectFromMap(map, allocation));
auto result = Handle<JSArrayBuffer>::cast(
NewJSObjectFromMap(map, AllocationType::kYoung));
ZeroEmbedderFields(result);
result->SetupEmpty(SharedFlag::kShared);
return result;
......@@ -3212,13 +3203,12 @@ void ForFixedTypedArray(ExternalArrayType array_type, size_t* element_size,
Handle<JSArrayBufferView> Factory::NewJSArrayBufferView(
Handle<Map> map, Handle<FixedArrayBase> elements,
Handle<JSArrayBuffer> buffer, size_t byte_offset, size_t byte_length,
AllocationType allocation) {
Handle<JSArrayBuffer> buffer, size_t byte_offset, size_t byte_length) {
CHECK_LE(byte_length, buffer->byte_length());
CHECK_LE(byte_offset, buffer->byte_length());
CHECK_LE(byte_offset + byte_length, buffer->byte_length());
Handle<JSArrayBufferView> array_buffer_view =
Handle<JSArrayBufferView>::cast(NewJSObjectFromMap(map, allocation));
Handle<JSArrayBufferView> array_buffer_view = Handle<JSArrayBufferView>::cast(
NewJSObjectFromMap(map, AllocationType::kYoung));
array_buffer_view->set_elements(*elements);
array_buffer_view->set_buffer(*buffer);
array_buffer_view->set_byte_offset(byte_offset);
......@@ -3231,8 +3221,8 @@ Handle<JSArrayBufferView> Factory::NewJSArrayBufferView(
Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
Handle<JSArrayBuffer> buffer,
size_t byte_offset, size_t length,
AllocationType allocation) {
size_t byte_offset,
size_t length) {
size_t element_size;
ElementsKind elements_kind;
ForFixedTypedArray(type, &element_size, &elements_kind);
......@@ -3257,9 +3247,9 @@ Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
default:
UNREACHABLE();
}
Handle<JSTypedArray> typed_array = Handle<JSTypedArray>::cast(
NewJSArrayBufferView(map, empty_byte_array(), buffer, byte_offset,
byte_length, allocation));
Handle<JSTypedArray> typed_array =
Handle<JSTypedArray>::cast(NewJSArrayBufferView(
map, empty_byte_array(), buffer, byte_offset, byte_length));
typed_array->set_length(length);
typed_array->set_external_pointer(
reinterpret_cast<byte*>(buffer->backing_store()) + byte_offset);
......@@ -3269,12 +3259,11 @@ Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer,
size_t byte_offset,
size_t byte_length,
AllocationType allocation) {
size_t byte_length) {
Handle<Map> map(isolate()->native_context()->data_view_fun().initial_map(),
isolate());
Handle<JSDataView> obj = Handle<JSDataView>::cast(NewJSArrayBufferView(
map, empty_fixed_array(), buffer, byte_offset, byte_length, allocation));
map, empty_fixed_array(), buffer, byte_offset, byte_length));
obj->set_data_pointer(static_cast<uint8_t*>(buffer->backing_store()) +
byte_offset);
return obj;
......@@ -4177,17 +4166,17 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) {
return map;
}
Handle<JSPromise> Factory::NewJSPromiseWithoutHook(AllocationType allocation) {
Handle<JSPromise> promise = Handle<JSPromise>::cast(
NewJSObject(isolate()->promise_function(), allocation));
Handle<JSPromise> Factory::NewJSPromiseWithoutHook() {
Handle<JSPromise> promise =
Handle<JSPromise>::cast(NewJSObject(isolate()->promise_function()));
promise->set_reactions_or_result(Smi::kZero);
promise->set_flags(0);
ZeroEmbedderFields(promise);
return promise;
}
Handle<JSPromise> Factory::NewJSPromise(AllocationType allocation) {
Handle<JSPromise> promise = NewJSPromiseWithoutHook(allocation);
Handle<JSPromise> Factory::NewJSPromise() {
Handle<JSPromise> promise = NewJSPromiseWithoutHook();
isolate()->RunPromiseHook(PromiseHookType::kInit, promise, undefined_value());
return promise;
}
......
......@@ -108,14 +108,12 @@ enum FunctionMode {
// Interface for handle based allocation.
class V8_EXPORT_PRIVATE Factory {
public:
Handle<Oddball> NewOddball(
Handle<Map> map, const char* to_string, Handle<Object> to_number,
const char* type_of, byte kind,
AllocationType allocation = AllocationType::kReadOnly);
Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number, const char* type_of,
byte kind);
// Marks self references within code generation.
Handle<Oddball> NewSelfReferenceMarker(
AllocationType allocation = AllocationType::kOld);
Handle<Oddball> NewSelfReferenceMarker();
// Allocates a fixed array-like object with given map and initialized with
// undefined values.
......@@ -141,8 +139,7 @@ class V8_EXPORT_PRIVATE Factory {
int length, AllocationType allocation = AllocationType::kYoung);
// Allocates a property array initialized with undefined values.
Handle<PropertyArray> NewPropertyArray(
int length, AllocationType allocation = AllocationType::kYoung);
Handle<PropertyArray> NewPropertyArray(int length);
// Tries allocating a fixed array initialized with undefined values.
// In case of an allocation failure (OOM) an empty handle is returned.
// The caller has to manually signal an
......@@ -157,24 +154,20 @@ class V8_EXPORT_PRIVATE Factory {
int length, AllocationType allocation = AllocationType::kYoung);
// Allocates an uninitialized fixed array. It must be filled by the caller.
Handle<FixedArray> NewUninitializedFixedArray(
int length, AllocationType allocation = AllocationType::kYoung);
Handle<FixedArray> NewUninitializedFixedArray(int length);
// Allocates a closure feedback cell array whose feedback cells are
// initialized with undefined values.
Handle<ClosureFeedbackCellArray> NewClosureFeedbackCellArray(
int num_slots, AllocationType allocation = AllocationType::kYoung);
Handle<ClosureFeedbackCellArray> NewClosureFeedbackCellArray(int num_slots);
// Allocates a feedback vector whose slots are initialized with undefined
// values.
Handle<FeedbackVector> NewFeedbackVector(
Handle<SharedFunctionInfo> shared,
Handle<ClosureFeedbackCellArray> closure_feedback_cell_array,
AllocationType allocation = AllocationType::kYoung);
Handle<ClosureFeedbackCellArray> closure_feedback_cell_array);
// Allocates a clean embedder data array with given capacity.
Handle<EmbedderDataArray> NewEmbedderDataArray(
int length, AllocationType allocation = AllocationType::kYoung);
Handle<EmbedderDataArray> NewEmbedderDataArray(int length);
// Allocates a fixed array for name-value pairs of boilerplate properties and
// calculates the number of properties we need to store in the backing store.
......@@ -188,16 +181,14 @@ class V8_EXPORT_PRIVATE Factory {
int length, AllocationType allocation = AllocationType::kYoung);
// Allocate a new fixed double array with hole values.
Handle<FixedArrayBase> NewFixedDoubleArrayWithHoles(
int size, AllocationType allocation = AllocationType::kYoung);
Handle<FixedArrayBase> NewFixedDoubleArrayWithHoles(int size);
// Allocates a FeedbackMedata object and zeroes the data section.
Handle<FeedbackMetadata> NewFeedbackMetadata(
int slot_count, int feedback_cell_count,
AllocationType allocation = AllocationType::kOld);
Handle<FrameArray> NewFrameArray(
int number_of_frames, AllocationType allocation = AllocationType::kYoung);
Handle<FrameArray> NewFrameArray(int number_of_frames);
Handle<OrderedHashSet> NewOrderedHashSet();
Handle<OrderedHashMap> NewOrderedHashMap();
......@@ -452,11 +443,8 @@ class V8_EXPORT_PRIVATE Factory {
Handle<AccessorInfo> NewAccessorInfo();
Handle<Script> NewScript(Handle<String> source,
AllocationType allocation = AllocationType::kOld);
Handle<Script> NewScriptWithId(
Handle<String> source, int script_id,
AllocationType allocation = AllocationType::kOld);
Handle<Script> NewScript(Handle<String> source);
Handle<Script> NewScriptWithId(Handle<String> source, int script_id);
Handle<Script> CloneScript(Handle<Script> script);
Handle<BreakPointInfo> NewBreakPointInfo(int source_position);
......@@ -480,8 +468,7 @@ class V8_EXPORT_PRIVATE Factory {
Handle<JSReceiver> thenable, Handle<Context> context);
// Foreign objects are pretenured when allocated by the bootstrapper.
Handle<Foreign> NewForeign(
Address addr, AllocationType allocation = AllocationType::kYoung);
Handle<Foreign> NewForeign(Address addr);
Handle<ByteArray> NewByteArray(
int length, AllocationType allocation = AllocationType::kYoung);
......@@ -542,17 +529,15 @@ class V8_EXPORT_PRIVATE Factory {
Handle<FixedArray> array, int grow_by,
AllocationType allocation = AllocationType::kYoung);
Handle<WeakFixedArray> CopyWeakFixedArrayAndGrow(
Handle<WeakFixedArray> array, int grow_by,
AllocationType allocation = AllocationType::kYoung);
Handle<WeakFixedArray> CopyWeakFixedArrayAndGrow(Handle<WeakFixedArray> array,
int grow_by);
Handle<WeakArrayList> CopyWeakArrayListAndGrow(
Handle<WeakArrayList> array, int grow_by,
AllocationType allocation = AllocationType::kYoung);
Handle<PropertyArray> CopyPropertyArrayAndGrow(
Handle<PropertyArray> array, int grow_by,
AllocationType allocation = AllocationType::kYoung);
Handle<PropertyArray> CopyPropertyArrayAndGrow(Handle<PropertyArray> array,
int grow_by);
Handle<FixedArray> CopyFixedArrayUpTo(
Handle<FixedArray> array, int new_len,
......@@ -575,10 +560,8 @@ class V8_EXPORT_PRIVATE Factory {
int32_t value, AllocationType allocation = AllocationType::kYoung);
Handle<Object> NewNumberFromUint(
uint32_t value, AllocationType allocation = AllocationType::kYoung);
inline Handle<Object> NewNumberFromSize(
size_t value, AllocationType allocation = AllocationType::kYoung);
inline Handle<Object> NewNumberFromInt64(
int64_t value, AllocationType allocation = AllocationType::kYoung);
inline Handle<Object> NewNumberFromSize(size_t value);
inline Handle<Object> NewNumberFromInt64(int64_t value);
inline Handle<HeapNumber> NewHeapNumber(
double value, AllocationType allocation = AllocationType::kYoung);
inline Handle<HeapNumber> NewHeapNumberFromBits(
......@@ -592,8 +575,7 @@ class V8_EXPORT_PRIVATE Factory {
// space.
Handle<HeapNumber> NewHeapNumberForCodeAssembler(double value);
inline Handle<HeapNumber> NewHeapNumberWithHoleNaN(
AllocationType allocation = AllocationType::kYoung);
inline Handle<HeapNumber> NewHeapNumberWithHoleNaN();
// Allocates a new BigInt with {length} digits. Only to be used by
// MutableBigInt::New*.
......@@ -610,8 +592,7 @@ class V8_EXPORT_PRIVATE Factory {
Handle<JSFunction> constructor,
AllocationType allocation = AllocationType::kYoung);
// JSObject without a prototype.
Handle<JSObject> NewJSObjectWithNullProto(
AllocationType allocation = AllocationType::kYoung);
Handle<JSObject> NewJSObjectWithNullProto();
// Global objects are pretenured and initialized based on a constructor.
Handle<JSGlobalObject> NewJSGlobalObject(Handle<JSFunction> constructor);
......@@ -645,8 +626,7 @@ class V8_EXPORT_PRIVATE Factory {
// object will have dictionary elements.
Handle<JSObject> NewSlowJSObjectWithPropertiesAndElements(
Handle<HeapObject> prototype, Handle<NameDictionary> properties,
Handle<FixedArrayBase> elements,
AllocationType allocation = AllocationType::kYoung);
Handle<FixedArrayBase> elements);
// JS arrays are pretenured when allocated by the parser.
......@@ -699,21 +679,19 @@ class V8_EXPORT_PRIVATE Factory {
size_t byte_length, InitializedFlag initialized,
AllocationType allocation = AllocationType::kYoung);
Handle<JSArrayBuffer> NewJSSharedArrayBuffer(
AllocationType allocation = AllocationType::kYoung);
Handle<JSArrayBuffer> NewJSSharedArrayBuffer();
static void TypeAndSizeForElementsKind(ElementsKind kind,
ExternalArrayType* array_type,
size_t* element_size);
// Creates a new JSTypedArray with the specified buffer.
Handle<JSTypedArray> NewJSTypedArray(
ExternalArrayType type, Handle<JSArrayBuffer> buffer, size_t byte_offset,
size_t length, AllocationType allocation = AllocationType::kYoung);
Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type,
Handle<JSArrayBuffer> buffer,
size_t byte_offset, size_t length);
Handle<JSDataView> NewJSDataView(
Handle<JSArrayBuffer> buffer, size_t byte_offset, size_t byte_length,
AllocationType allocation = AllocationType::kYoung);
Handle<JSDataView> NewJSDataView(Handle<JSArrayBuffer> buffer,
size_t byte_offset, size_t byte_length);
Handle<JSIteratorResult> NewJSIteratorResult(Handle<Object> value, bool done);
Handle<JSAsyncFromSyncIterator> NewJSAsyncFromSyncIterator(
......@@ -930,10 +908,8 @@ class V8_EXPORT_PRIVATE Factory {
// Converts the given ToPrimitive hint to it's string representation.
Handle<String> ToPrimitiveHintString(ToPrimitiveHint hint);
Handle<JSPromise> NewJSPromiseWithoutHook(
AllocationType allocation = AllocationType::kYoung);
Handle<JSPromise> NewJSPromise(
AllocationType allocation = AllocationType::kYoung);
Handle<JSPromise> NewJSPromiseWithoutHook();
Handle<JSPromise> NewJSPromise();
Handle<CallHandlerInfo> NewCallHandlerInfo(bool has_no_side_effect = false);
......@@ -1042,8 +1018,7 @@ class V8_EXPORT_PRIVATE Factory {
Handle<JSArrayBufferView> NewJSArrayBufferView(
Handle<Map> map, Handle<FixedArrayBase> elements,
Handle<JSArrayBuffer> buffer, size_t byte_offset, size_t byte_length,
AllocationType allocation);
Handle<JSArrayBuffer> buffer, size_t byte_offset, size_t byte_length);
// Allocate memory for an uninitialized array (e.g., a FixedArray or similar).
HeapObject AllocateRawArray(int size, AllocationType allocation);
......
......@@ -704,8 +704,7 @@ void Heap::CreateInitialObjects() {
Oddball::kStaleRegister));
// Initialize the self-reference marker.
set_self_reference_marker(
*factory->NewSelfReferenceMarker(AllocationType::kReadOnly));
set_self_reference_marker(*factory->NewSelfReferenceMarker());
set_interpreter_entry_trampoline_for_profiling(roots.undefined_value());
......
......@@ -991,8 +991,7 @@ Handle<DependentCode> DependentCode::EnsureSpace(
int capacity = kCodesStartIndex + DependentCode::Grow(entries->count());
int grow_by = capacity - entries->length();
return Handle<DependentCode>::cast(
isolate->factory()->CopyWeakFixedArrayAndGrow(entries, grow_by,
AllocationType::kOld));
isolate->factory()->CopyWeakFixedArrayAndGrow(entries, grow_by));
}
bool DependentCode::Compact() {
......
......@@ -233,8 +233,8 @@ Handle<FeedbackVector> FeedbackVector::New(
const int slot_count = shared->feedback_metadata().slot_count();
Handle<FeedbackVector> vector = factory->NewFeedbackVector(
shared, closure_feedback_cell_array, AllocationType::kOld);
Handle<FeedbackVector> vector =
factory->NewFeedbackVector(shared, closure_feedback_cell_array);
DCHECK_EQ(vector->length(), slot_count);
......
......@@ -120,7 +120,7 @@ class FixedArray : public FixedArrayBase {
// Return a grown copy if the index is bigger than the array's length.
V8_EXPORT_PRIVATE static Handle<FixedArray> SetAndGrow(
Isolate* isolate, Handle<FixedArray> array, int index,
Handle<Object> value, AllocationType allocation = AllocationType::kYoung);
Handle<Object> value);
// Setter that uses write barrier.
inline void set(int index, Object value);
......
......@@ -3816,8 +3816,7 @@ bool DescriptorArray::IsEqualUpTo(DescriptorArray desc, int nof_descriptors) {
Handle<FixedArray> FixedArray::SetAndGrow(Isolate* isolate,
Handle<FixedArray> array, int index,
Handle<Object> value,
AllocationType allocation) {
Handle<Object> value) {
if (index < array->length()) {
array->set(index, *value);
return array;
......@@ -3827,7 +3826,7 @@ Handle<FixedArray> FixedArray::SetAndGrow(Isolate* isolate,
capacity = JSObject::NewElementsCapacity(capacity);
} while (capacity <= index);
Handle<FixedArray> new_array =
isolate->factory()->NewUninitializedFixedArray(capacity, allocation);
isolate->factory()->NewUninitializedFixedArray(capacity);
array->CopyTo(0, *new_array, 0, array->length());
new_array->FillWithHoles(array->length(), new_array->length());
new_array->set(index, *value);
......@@ -6913,7 +6912,7 @@ void AddToFeedbackCellsMap(Handle<CompilationCacheTable> cache, int cache_entry,
if (entry < 0) {
// Copy old optimized code map and append one new entry.
new_literals_map = isolate->factory()->CopyWeakFixedArrayAndGrow(
old_literals_map, kLiteralEntryLength, AllocationType::kOld);
old_literals_map, kLiteralEntryLength);
entry = old_literals_map->length();
}
}
......
......@@ -296,8 +296,7 @@ Handle<WeakFixedArray> TransitionArray::GrowPrototypeTransitionArray(
new_capacity = Min(kMaxCachedPrototypeTransitions, new_capacity);
DCHECK_GT(new_capacity, capacity);
int grow_by = new_capacity - capacity;
array = isolate->factory()->CopyWeakFixedArrayAndGrow(array, grow_by,
AllocationType::kOld);
array = isolate->factory()->CopyWeakFixedArrayAndGrow(array, grow_by);
if (capacity < 0) {
// There was no prototype transitions array before, so the size
// couldn't be copied. Initialize it explicitly.
......
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