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) { ...@@ -43,25 +43,23 @@ Handle<String> Factory::NewSubString(Handle<String> str, int begin, int end) {
return NewProperSubString(str, begin, end); return NewProperSubString(str, begin, end);
} }
Handle<Object> Factory::NewNumberFromSize(size_t value, Handle<Object> Factory::NewNumberFromSize(size_t value) {
AllocationType allocation) {
// We can't use Smi::IsValid() here because that operates on a signed // 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. // intptr_t, and casting from size_t could create a bogus sign bit.
if (value <= static_cast<size_t>(Smi::kMaxValue)) { if (value <= static_cast<size_t>(Smi::kMaxValue)) {
return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
isolate()); isolate());
} }
return NewNumber(static_cast<double>(value), allocation); return NewNumber(static_cast<double>(value));
} }
Handle<Object> Factory::NewNumberFromInt64(int64_t value, Handle<Object> Factory::NewNumberFromInt64(int64_t value) {
AllocationType allocation) {
if (value <= std::numeric_limits<int32_t>::max() && if (value <= std::numeric_limits<int32_t>::max() &&
value >= std::numeric_limits<int32_t>::min() && value >= std::numeric_limits<int32_t>::min() &&
Smi::IsValid(static_cast<int32_t>(value))) { Smi::IsValid(static_cast<int32_t>(value))) {
return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)), isolate()); 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, Handle<HeapNumber> Factory::NewHeapNumber(double value,
...@@ -78,9 +76,8 @@ Handle<HeapNumber> Factory::NewHeapNumberFromBits(uint64_t bits, ...@@ -78,9 +76,8 @@ Handle<HeapNumber> Factory::NewHeapNumberFromBits(uint64_t bits,
return heap_number; return heap_number;
} }
Handle<HeapNumber> Factory::NewHeapNumberWithHoleNaN( Handle<HeapNumber> Factory::NewHeapNumberWithHoleNaN() {
AllocationType allocation) { return NewHeapNumberFromBits(kHoleNanInt64);
return NewHeapNumberFromBits(kHoleNanInt64, allocation);
} }
Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements,
......
This diff is collapsed.
This diff is collapsed.
...@@ -704,8 +704,7 @@ void Heap::CreateInitialObjects() { ...@@ -704,8 +704,7 @@ void Heap::CreateInitialObjects() {
Oddball::kStaleRegister)); Oddball::kStaleRegister));
// Initialize the self-reference marker. // Initialize the self-reference marker.
set_self_reference_marker( set_self_reference_marker(*factory->NewSelfReferenceMarker());
*factory->NewSelfReferenceMarker(AllocationType::kReadOnly));
set_interpreter_entry_trampoline_for_profiling(roots.undefined_value()); set_interpreter_entry_trampoline_for_profiling(roots.undefined_value());
......
...@@ -991,8 +991,7 @@ Handle<DependentCode> DependentCode::EnsureSpace( ...@@ -991,8 +991,7 @@ Handle<DependentCode> DependentCode::EnsureSpace(
int capacity = kCodesStartIndex + DependentCode::Grow(entries->count()); int capacity = kCodesStartIndex + DependentCode::Grow(entries->count());
int grow_by = capacity - entries->length(); int grow_by = capacity - entries->length();
return Handle<DependentCode>::cast( return Handle<DependentCode>::cast(
isolate->factory()->CopyWeakFixedArrayAndGrow(entries, grow_by, isolate->factory()->CopyWeakFixedArrayAndGrow(entries, grow_by));
AllocationType::kOld));
} }
bool DependentCode::Compact() { bool DependentCode::Compact() {
......
...@@ -233,8 +233,8 @@ Handle<FeedbackVector> FeedbackVector::New( ...@@ -233,8 +233,8 @@ Handle<FeedbackVector> FeedbackVector::New(
const int slot_count = shared->feedback_metadata().slot_count(); const int slot_count = shared->feedback_metadata().slot_count();
Handle<FeedbackVector> vector = factory->NewFeedbackVector( Handle<FeedbackVector> vector =
shared, closure_feedback_cell_array, AllocationType::kOld); factory->NewFeedbackVector(shared, closure_feedback_cell_array);
DCHECK_EQ(vector->length(), slot_count); DCHECK_EQ(vector->length(), slot_count);
......
...@@ -120,7 +120,7 @@ class FixedArray : public FixedArrayBase { ...@@ -120,7 +120,7 @@ class FixedArray : public FixedArrayBase {
// Return a grown copy if the index is bigger than the array's length. // Return a grown copy if the index is bigger than the array's length.
V8_EXPORT_PRIVATE static Handle<FixedArray> SetAndGrow( V8_EXPORT_PRIVATE static Handle<FixedArray> SetAndGrow(
Isolate* isolate, Handle<FixedArray> array, int index, Isolate* isolate, Handle<FixedArray> array, int index,
Handle<Object> value, AllocationType allocation = AllocationType::kYoung); Handle<Object> value);
// Setter that uses write barrier. // Setter that uses write barrier.
inline void set(int index, Object value); inline void set(int index, Object value);
......
...@@ -3816,8 +3816,7 @@ bool DescriptorArray::IsEqualUpTo(DescriptorArray desc, int nof_descriptors) { ...@@ -3816,8 +3816,7 @@ bool DescriptorArray::IsEqualUpTo(DescriptorArray desc, int nof_descriptors) {
Handle<FixedArray> FixedArray::SetAndGrow(Isolate* isolate, Handle<FixedArray> FixedArray::SetAndGrow(Isolate* isolate,
Handle<FixedArray> array, int index, Handle<FixedArray> array, int index,
Handle<Object> value, Handle<Object> value) {
AllocationType allocation) {
if (index < array->length()) { if (index < array->length()) {
array->set(index, *value); array->set(index, *value);
return array; return array;
...@@ -3827,7 +3826,7 @@ Handle<FixedArray> FixedArray::SetAndGrow(Isolate* isolate, ...@@ -3827,7 +3826,7 @@ Handle<FixedArray> FixedArray::SetAndGrow(Isolate* isolate,
capacity = JSObject::NewElementsCapacity(capacity); capacity = JSObject::NewElementsCapacity(capacity);
} while (capacity <= index); } while (capacity <= index);
Handle<FixedArray> new_array = Handle<FixedArray> new_array =
isolate->factory()->NewUninitializedFixedArray(capacity, allocation); isolate->factory()->NewUninitializedFixedArray(capacity);
array->CopyTo(0, *new_array, 0, array->length()); array->CopyTo(0, *new_array, 0, array->length());
new_array->FillWithHoles(array->length(), new_array->length()); new_array->FillWithHoles(array->length(), new_array->length());
new_array->set(index, *value); new_array->set(index, *value);
...@@ -6913,7 +6912,7 @@ void AddToFeedbackCellsMap(Handle<CompilationCacheTable> cache, int cache_entry, ...@@ -6913,7 +6912,7 @@ void AddToFeedbackCellsMap(Handle<CompilationCacheTable> cache, int cache_entry,
if (entry < 0) { if (entry < 0) {
// Copy old optimized code map and append one new entry. // Copy old optimized code map and append one new entry.
new_literals_map = isolate->factory()->CopyWeakFixedArrayAndGrow( new_literals_map = isolate->factory()->CopyWeakFixedArrayAndGrow(
old_literals_map, kLiteralEntryLength, AllocationType::kOld); old_literals_map, kLiteralEntryLength);
entry = old_literals_map->length(); entry = old_literals_map->length();
} }
} }
......
...@@ -296,8 +296,7 @@ Handle<WeakFixedArray> TransitionArray::GrowPrototypeTransitionArray( ...@@ -296,8 +296,7 @@ Handle<WeakFixedArray> TransitionArray::GrowPrototypeTransitionArray(
new_capacity = Min(kMaxCachedPrototypeTransitions, new_capacity); new_capacity = Min(kMaxCachedPrototypeTransitions, new_capacity);
DCHECK_GT(new_capacity, capacity); DCHECK_GT(new_capacity, capacity);
int grow_by = new_capacity - capacity; int grow_by = new_capacity - capacity;
array = isolate->factory()->CopyWeakFixedArrayAndGrow(array, grow_by, array = isolate->factory()->CopyWeakFixedArrayAndGrow(array, grow_by);
AllocationType::kOld);
if (capacity < 0) { if (capacity < 0) {
// There was no prototype transitions array before, so the size // There was no prototype transitions array before, so the size
// couldn't be copied. Initialize it explicitly. // 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