Commit 149f7f4d authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[objects] Make UncompiledData::Init a member function

Since it doesn't allocate, make UncompiledData::Init a member function,
consistent with SharedFunctionInfo::Init.

Bug: chromium:1011762
Change-Id: I984adf9004193eb9da504ddd39dd95345eccaf82
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1926031
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65076}
parent 7a0ae73b
......@@ -2557,8 +2557,7 @@ Factory::NewUncompiledDataWithoutPreparseData(Handle<String> inferred_name,
uncompiled_data_without_preparse_data_map(), AllocationType::kOld)),
isolate());
UncompiledData::Initialize(*result, *inferred_name, start_position,
end_position);
result->Init(*inferred_name, start_position, end_position);
return result;
}
......@@ -2572,8 +2571,7 @@ Factory::NewUncompiledDataWithPreparseData(Handle<String> inferred_name,
New(uncompiled_data_with_preparse_data_map(), AllocationType::kOld)),
isolate());
UncompiledDataWithPreparseData::Initialize(
*result, *inferred_name, start_position, end_position, *preparse_data);
result->Init(*inferred_name, start_position, end_position, *preparse_data);
return result;
}
......
......@@ -2119,8 +2119,8 @@ void MarkCompactCollector::FlushBytecodeFromSFI(
// Initialize the uncompiled data.
UncompiledData uncompiled_data = UncompiledData::cast(compiled_data);
UncompiledData::Initialize(
uncompiled_data, inferred_name, start_position, end_position,
uncompiled_data.Init(
inferred_name, start_position, end_position,
[](HeapObject object, ObjectSlot slot, HeapObject target) {
RecordSlot(object, slot, target);
});
......
......@@ -609,29 +609,27 @@ void SharedFunctionInfo::ClearPreparseData() {
DCHECK(HasUncompiledDataWithoutPreparseData());
}
// static
void UncompiledData::Initialize(
UncompiledData data, String inferred_name, int start_position,
int end_position,
void UncompiledData::Init(
String inferred_name, int start_position, int end_position,
std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
gc_notify_updated_slot) {
data.set_inferred_name(inferred_name);
gc_notify_updated_slot(
data, data.RawField(UncompiledData::kInferredNameOffset), inferred_name);
data.set_start_position(start_position);
data.set_end_position(end_position);
set_inferred_name(inferred_name);
gc_notify_updated_slot(*this, RawField(UncompiledData::kInferredNameOffset),
inferred_name);
set_start_position(start_position);
set_end_position(end_position);
}
void UncompiledDataWithPreparseData::Initialize(
UncompiledDataWithPreparseData data, String inferred_name,
int start_position, int end_position, PreparseData scope_data,
void UncompiledDataWithPreparseData::Init(
String inferred_name, int start_position, int end_position,
PreparseData scope_data,
std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
gc_notify_updated_slot) {
UncompiledData::Initialize(data, inferred_name, start_position, end_position,
this->UncompiledData::Init(inferred_name, start_position, end_position,
gc_notify_updated_slot);
data.set_preparse_data(scope_data);
set_preparse_data(scope_data);
gc_notify_updated_slot(
data, data.RawField(UncompiledDataWithPreparseData::kPreparseDataOffset),
*this, RawField(UncompiledDataWithPreparseData::kPreparseDataOffset),
scope_data);
}
......
......@@ -97,9 +97,8 @@ class PreparseData
class UncompiledData
: public TorqueGeneratedUncompiledData<UncompiledData, HeapObject> {
public:
inline static void Initialize(
UncompiledData data, String inferred_name, int start_position,
int end_position,
inline void Init(
String inferred_name, int start_position, int end_position,
std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
gc_notify_updated_slot =
[](HeapObject object, ObjectSlot slot, HeapObject target) {});
......@@ -134,9 +133,9 @@ class UncompiledDataWithPreparseData
public:
DECL_PRINTER(UncompiledDataWithPreparseData)
inline static void Initialize(
UncompiledDataWithPreparseData data, String inferred_name,
int start_position, int end_position, PreparseData scope_data,
inline void Init(
String inferred_name, int start_position, int end_position,
PreparseData scope_data,
std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
gc_notify_updated_slot =
[](HeapObject object, ObjectSlot slot, HeapObject target) {});
......
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