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,
......
This diff is collapsed.
This diff is collapsed.
......@@ -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