Commit 02e477e3 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[cleanup] Create Factory::NewBaselineData

Change-Id: Ia115a8dfd35c935fa4356dd32dcd2e035574f7d1
Bug: v8:11429
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2692566Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72711}
parent c5cf7db1
......@@ -47,14 +47,10 @@ Handle<Code> CompileWithBaseline(Isolate* isolate,
Handle<Code> code = CompileWithBaseline(
isolate, shared, handle(shared->GetBytecodeArray(isolate), isolate));
// TODO(v8:11429): Extract to Factory::NewBaselineData
Handle<BaselineData> baseline_data = Handle<BaselineData>::cast(
isolate->factory()->NewStruct(BASELINE_DATA_TYPE, AllocationType::kOld));
baseline_data->set_baseline_code(*code);
baseline_data->set_data(
HeapObject::cast(shared->function_data(kAcquireLoad)));
Handle<HeapObject> function_data =
handle(HeapObject::cast(shared->function_data(kAcquireLoad)), isolate);
Handle<BaselineData> baseline_data =
isolate->factory()->NewBaselineData(code, function_data);
shared->set_baseline_data(*baseline_data);
if (FLAG_print_code) {
......
......@@ -330,6 +330,15 @@ Handle<Tuple2> Factory::NewTuple2(Handle<Object> value1, Handle<Object> value2,
return result;
}
Handle<BaselineData> Factory::NewBaselineData(
Handle<Code> code, Handle<HeapObject> function_data) {
Handle<BaselineData> baseline_data = Handle<BaselineData>::cast(
NewStruct(BASELINE_DATA_TYPE, AllocationType::kOld));
baseline_data->set_baseline_code(*code);
baseline_data->set_data(*function_data);
return baseline_data;
}
Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number,
const char* type_of, byte kind) {
......
......@@ -7,6 +7,7 @@
// Clients of this interface shouldn't depend on lots of heap internals.
// Do not include anything from src/heap here!
#include "src/baseline/baseline.h"
#include "src/builtins/builtins.h"
#include "src/common/globals.h"
#include "src/execution/messages.h"
......@@ -105,6 +106,9 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
return handle(obj, isolate());
}
Handle<BaselineData> NewBaselineData(Handle<Code> code,
Handle<HeapObject> function_data);
Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number, const char* type_of,
byte kind);
......
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