[turbofan] Move source positions generation out of inlining
The call to EnsureSourcePositionsAvailable for a given SharedFunctionInfo is now done in the serializer for each SFI that is marked as serialized for compilation. This will enable brokerization of the JSInliner class. Change-Id: I7821a50fcac8a3e19386e98758f2b0dea3023bb6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1582400 Commit-Queue: Maya Lekova <mslekova@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#61260}
This commit is contained in:
parent
7bc1af3d98
commit
ac37786888
@ -447,10 +447,6 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
|
||||
// it never gets flushed, so the following check should always hold true.
|
||||
CHECK(is_compiled_scope.is_compiled());
|
||||
|
||||
if (info_->is_source_positions_enabled()) {
|
||||
SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate(), shared_info);
|
||||
}
|
||||
|
||||
TRACE("Inlining %s into %s%s\n", shared_info->DebugName()->ToCString().get(),
|
||||
info_->shared_info()->DebugName()->ToCString().get(),
|
||||
(exception_target != nullptr) ? " (inside try-block)" : "");
|
||||
|
@ -1247,8 +1247,9 @@ struct SerializationPhase {
|
||||
static const char* phase_name() { return "V8.TFSerializeBytecode"; }
|
||||
|
||||
void Run(PipelineData* data, Zone* temp_zone) {
|
||||
SerializerForBackgroundCompilation serializer(data->broker(), temp_zone,
|
||||
data->info()->closure());
|
||||
SerializerForBackgroundCompilation serializer(
|
||||
data->broker(), temp_zone, data->info()->closure(),
|
||||
data->info()->is_source_positions_enabled());
|
||||
serializer.Run();
|
||||
}
|
||||
};
|
||||
|
@ -247,9 +247,11 @@ int SerializerForBackgroundCompilation::Environment::RegisterToLocalIndex(
|
||||
}
|
||||
|
||||
SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
|
||||
JSHeapBroker* broker, Zone* zone, Handle<JSFunction> closure)
|
||||
JSHeapBroker* broker, Zone* zone, Handle<JSFunction> closure,
|
||||
bool collect_source_positions)
|
||||
: broker_(broker),
|
||||
zone_(zone),
|
||||
collect_source_positions_(collect_source_positions),
|
||||
environment_(new (zone) Environment(zone, {closure, broker_->isolate()})),
|
||||
stashed_environments_(zone) {
|
||||
JSFunctionRef(broker, closure).Serialize();
|
||||
@ -257,9 +259,11 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
|
||||
|
||||
SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
|
||||
JSHeapBroker* broker, Zone* zone, CompilationSubject function,
|
||||
base::Optional<Hints> new_target, const HintsVector& arguments)
|
||||
base::Optional<Hints> new_target, const HintsVector& arguments,
|
||||
bool collect_source_positions)
|
||||
: broker_(broker),
|
||||
zone_(zone),
|
||||
collect_source_positions_(collect_source_positions),
|
||||
environment_(new (zone) Environment(zone, broker_->isolate(), function,
|
||||
new_target, arguments)),
|
||||
stashed_environments_(zone) {
|
||||
@ -277,6 +281,15 @@ Hints SerializerForBackgroundCompilation::Run() {
|
||||
return Hints(zone());
|
||||
}
|
||||
shared.SetSerializedForCompilation(feedback_vector);
|
||||
|
||||
// We eagerly call the {EnsureSourcePositionsAvailable} for all serialized
|
||||
// SFIs while still on the main thread. Source positions will later be used
|
||||
// by JSInliner::ReduceJSCall.
|
||||
if (collect_source_positions()) {
|
||||
SharedFunctionInfo::EnsureSourcePositionsAvailable(broker()->isolate(),
|
||||
shared.object());
|
||||
}
|
||||
|
||||
feedback_vector.SerializeSlots();
|
||||
TraverseBytecode();
|
||||
return environment()->return_value_hints();
|
||||
@ -565,7 +578,8 @@ Hints SerializerForBackgroundCompilation::RunChildSerializer(
|
||||
<< *environment());
|
||||
|
||||
SerializerForBackgroundCompilation child_serializer(
|
||||
broker(), zone(), function, new_target, arguments);
|
||||
broker(), zone(), function, new_target, arguments,
|
||||
collect_source_positions());
|
||||
return child_serializer.Run();
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,8 @@ using HintsVector = ZoneVector<Hints>;
|
||||
class SerializerForBackgroundCompilation {
|
||||
public:
|
||||
SerializerForBackgroundCompilation(JSHeapBroker* broker, Zone* zone,
|
||||
Handle<JSFunction> closure);
|
||||
Handle<JSFunction> closure,
|
||||
bool collect_source_positions);
|
||||
Hints Run(); // NOTE: Returns empty for an already-serialized function.
|
||||
|
||||
class Environment;
|
||||
@ -280,7 +281,8 @@ class SerializerForBackgroundCompilation {
|
||||
SerializerForBackgroundCompilation(JSHeapBroker* broker, Zone* zone,
|
||||
CompilationSubject function,
|
||||
base::Optional<Hints> new_target,
|
||||
const HintsVector& arguments);
|
||||
const HintsVector& arguments,
|
||||
bool collect_source_positions);
|
||||
|
||||
void TraverseBytecode();
|
||||
|
||||
@ -319,10 +321,14 @@ class SerializerForBackgroundCompilation {
|
||||
|
||||
JSHeapBroker* broker() const { return broker_; }
|
||||
Zone* zone() const { return zone_; }
|
||||
// The following flag is initialized from OptimizedCompilationInfo's
|
||||
// {is_source_positions_enabled}.
|
||||
bool collect_source_positions() const { return collect_source_positions_; }
|
||||
Environment* environment() const { return environment_; }
|
||||
|
||||
JSHeapBroker* const broker_;
|
||||
Zone* const zone_;
|
||||
bool const collect_source_positions_;
|
||||
Environment* const environment_;
|
||||
ZoneUnorderedMap<int, Environment*> stashed_environments_;
|
||||
};
|
||||
|
@ -26,7 +26,6 @@ GraphTest::GraphTest(int num_parameters)
|
||||
broker()->SetNativeContextRef();
|
||||
}
|
||||
|
||||
|
||||
GraphTest::~GraphTest() = default;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user