Commit 2bfa1c37 authored by ishell@chromium.org's avatar ishell@chromium.org Committed by V8 LUCI CQ

[builtins] Allocate builtins PGO data in old space

... to please mksnapshot which expects the new space to be empty.

Bug: v8:10470
Change-Id: I7d5b62db138ef2e334581a8697d137cd13291d7c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3827877
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82440}
parent 924be695
...@@ -151,8 +151,8 @@ MaybeHandle<Code> Factory::CodeBuilder::BuildInternal( ...@@ -151,8 +151,8 @@ MaybeHandle<Code> Factory::CodeBuilder::BuildInternal(
// iteration. // iteration.
Handle<ArrayList> list(isolate_->heap()->basic_block_profiling_data(), Handle<ArrayList> list(isolate_->heap()->basic_block_profiling_data(),
isolate_); isolate_);
Handle<ArrayList> new_list = Handle<ArrayList> new_list = ArrayList::Add(
ArrayList::Add(isolate_, list, on_heap_profiler_data); isolate_, list, on_heap_profiler_data, AllocationType::kOld);
isolate_->heap()->SetBasicBlockProfilingData(new_list); isolate_->heap()->SetBasicBlockProfilingData(new_list);
} }
...@@ -2237,11 +2237,6 @@ Handle<FixedArray> Factory::CopyFixedArrayWithMap(Handle<FixedArray> array, ...@@ -2237,11 +2237,6 @@ Handle<FixedArray> Factory::CopyFixedArrayWithMap(Handle<FixedArray> array,
return CopyArrayWithMap(array, map); return CopyArrayWithMap(array, map);
} }
Handle<FixedArray> Factory::CopyFixedArrayAndGrow(Handle<FixedArray> array,
int grow_by) {
return CopyArrayAndGrow(array, grow_by, AllocationType::kYoung);
}
Handle<WeakArrayList> Factory::NewUninitializedWeakArrayList( Handle<WeakArrayList> Factory::NewUninitializedWeakArrayList(
int capacity, AllocationType allocation) { int capacity, AllocationType allocation) {
DCHECK_LE(0, capacity); DCHECK_LE(0, capacity);
...@@ -2266,6 +2261,12 @@ Handle<WeakArrayList> Factory::NewWeakArrayList(int capacity, ...@@ -2266,6 +2261,12 @@ Handle<WeakArrayList> Factory::NewWeakArrayList(int capacity,
return result; return result;
} }
Handle<FixedArray> Factory::CopyFixedArrayAndGrow(Handle<FixedArray> array,
int grow_by,
AllocationType allocation) {
return CopyArrayAndGrow(array, grow_by, allocation);
}
Handle<WeakFixedArray> Factory::CopyWeakFixedArrayAndGrow( Handle<WeakFixedArray> Factory::CopyWeakFixedArrayAndGrow(
Handle<WeakFixedArray> src, int grow_by) { Handle<WeakFixedArray> src, int grow_by) {
DCHECK(!src->IsTransitionArray()); // Compacted by GC, this code doesn't work DCHECK(!src->IsTransitionArray()); // Compacted by GC, this code doesn't work
......
...@@ -496,8 +496,9 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -496,8 +496,9 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array, Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array,
Handle<Map> map); Handle<Map> map);
Handle<FixedArray> CopyFixedArrayAndGrow(Handle<FixedArray> array, Handle<FixedArray> CopyFixedArrayAndGrow(
int grow_by); Handle<FixedArray> array, int grow_by,
AllocationType allocation = AllocationType::kYoung);
Handle<WeakArrayList> NewWeakArrayList( Handle<WeakArrayList> NewWeakArrayList(
int capacity, AllocationType allocation = AllocationType::kYoung); int capacity, AllocationType allocation = AllocationType::kYoung);
......
...@@ -458,9 +458,9 @@ class WeakArrayList::Iterator { ...@@ -458,9 +458,9 @@ class WeakArrayList::Iterator {
// underlying FixedArray starting at kFirstIndex. // underlying FixedArray starting at kFirstIndex.
class ArrayList : public TorqueGeneratedArrayList<ArrayList, FixedArray> { class ArrayList : public TorqueGeneratedArrayList<ArrayList, FixedArray> {
public: public:
V8_EXPORT_PRIVATE static Handle<ArrayList> Add(Isolate* isolate, V8_EXPORT_PRIVATE static Handle<ArrayList> Add(
Handle<ArrayList> array, Isolate* isolate, Handle<ArrayList> array, Handle<Object> obj,
Handle<Object> obj); AllocationType allocation = AllocationType::kYoung);
V8_EXPORT_PRIVATE static Handle<ArrayList> Add(Isolate* isolate, V8_EXPORT_PRIVATE static Handle<ArrayList> Add(Isolate* isolate,
Handle<ArrayList> array, Handle<ArrayList> array,
Handle<Object> obj1, Handle<Object> obj1,
...@@ -505,8 +505,9 @@ class ArrayList : public TorqueGeneratedArrayList<ArrayList, FixedArray> { ...@@ -505,8 +505,9 @@ class ArrayList : public TorqueGeneratedArrayList<ArrayList, FixedArray> {
DECL_VERIFIER(ArrayList) DECL_VERIFIER(ArrayList)
private: private:
static Handle<ArrayList> EnsureSpace(Isolate* isolate, static Handle<ArrayList> EnsureSpace(
Handle<ArrayList> array, int length); Isolate* isolate, Handle<ArrayList> array, int length,
AllocationType allocation = AllocationType::kYoung);
TQ_OBJECT_CONSTRUCTORS(ArrayList) TQ_OBJECT_CONSTRUCTORS(ArrayList)
}; };
......
...@@ -4034,9 +4034,10 @@ void FixedArray::CopyTo(int pos, FixedArray dest, int dest_pos, int len) const { ...@@ -4034,9 +4034,10 @@ void FixedArray::CopyTo(int pos, FixedArray dest, int dest_pos, int len) const {
// static // static
Handle<ArrayList> ArrayList::Add(Isolate* isolate, Handle<ArrayList> array, Handle<ArrayList> ArrayList::Add(Isolate* isolate, Handle<ArrayList> array,
Handle<Object> obj) { Handle<Object> obj,
AllocationType allocation) {
int length = array->Length(); int length = array->Length();
array = EnsureSpace(isolate, array, length + 1); array = EnsureSpace(isolate, array, length + 1, allocation);
// Check that GC didn't remove elements from the array. // Check that GC didn't remove elements from the array.
DCHECK_EQ(array->Length(), length); DCHECK_EQ(array->Length(), length);
{ {
...@@ -4101,14 +4102,15 @@ Handle<FixedArray> ArrayList::Elements(Isolate* isolate, ...@@ -4101,14 +4102,15 @@ Handle<FixedArray> ArrayList::Elements(Isolate* isolate,
namespace { namespace {
Handle<FixedArray> EnsureSpaceInFixedArray(Isolate* isolate, Handle<FixedArray> EnsureSpaceInFixedArray(Isolate* isolate,
Handle<FixedArray> array, Handle<FixedArray> array, int length,
int length) { AllocationType allocation) {
int capacity = array->length(); int capacity = array->length();
if (capacity < length) { if (capacity < length) {
int new_capacity = length; int new_capacity = length;
new_capacity = new_capacity + std::max(new_capacity / 2, 2); new_capacity = new_capacity + std::max(new_capacity / 2, 2);
int grow_by = new_capacity - capacity; int grow_by = new_capacity - capacity;
array = isolate->factory()->CopyFixedArrayAndGrow(array, grow_by); array =
isolate->factory()->CopyFixedArrayAndGrow(array, grow_by, allocation);
} }
return array; return array;
} }
...@@ -4117,10 +4119,11 @@ Handle<FixedArray> EnsureSpaceInFixedArray(Isolate* isolate, ...@@ -4117,10 +4119,11 @@ Handle<FixedArray> EnsureSpaceInFixedArray(Isolate* isolate,
// static // static
Handle<ArrayList> ArrayList::EnsureSpace(Isolate* isolate, Handle<ArrayList> ArrayList::EnsureSpace(Isolate* isolate,
Handle<ArrayList> array, int length) { Handle<ArrayList> array, int length,
AllocationType allocation) {
DCHECK_LT(0, length); DCHECK_LT(0, length);
auto new_array = Handle<ArrayList>::cast( auto new_array = Handle<ArrayList>::cast(EnsureSpaceInFixedArray(
EnsureSpaceInFixedArray(isolate, array, kFirstIndex + length)); isolate, array, kFirstIndex + length, allocation));
DCHECK_EQ(array->Length(), new_array->Length()); DCHECK_EQ(array->Length(), new_array->Length());
return new_array; return new_array;
} }
...@@ -4402,8 +4405,9 @@ Handle<RegExpMatchInfo> RegExpMatchInfo::ReserveCaptures( ...@@ -4402,8 +4405,9 @@ Handle<RegExpMatchInfo> RegExpMatchInfo::ReserveCaptures(
int capture_register_count = int capture_register_count =
JSRegExp::RegistersForCaptureCount(capture_count); JSRegExp::RegistersForCaptureCount(capture_count);
const int required_length = kFirstCaptureIndex + capture_register_count; const int required_length = kFirstCaptureIndex + capture_register_count;
Handle<RegExpMatchInfo> result = Handle<RegExpMatchInfo>::cast( Handle<RegExpMatchInfo> result =
EnsureSpaceInFixedArray(isolate, match_info, required_length)); Handle<RegExpMatchInfo>::cast(EnsureSpaceInFixedArray(
isolate, match_info, required_length, AllocationType::kYoung));
result->SetNumberOfCaptureRegisters(capture_register_count); result->SetNumberOfCaptureRegisters(capture_register_count);
return result; return result;
} }
......
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