Commit 9f43850f authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[offthread] Move line-end init to FinalizeScriptCompilation

Moves the Script line-end initialization for profiling out of
CreateScript and into FinalizeScriptCompilation. This ensures that
scripts created off-thread still get line-ends when necessary.

Bug: chormium:1011762
Change-Id: If16ad17b2b3ec96908420107bd5f9161eab9492f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122020
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67363}
parent 2b8cc34b
......@@ -1060,6 +1060,9 @@ void FinalizeScriptCompilation(
}
}
}
if (isolate->NeedsSourcePositionsForProfiling()) {
Script::InitLineEnds(isolate, script);
}
}
template <typename LocalIsolate>
......
......@@ -135,11 +135,6 @@ int OffThreadIsolate::GetNextUniqueSharedFunctionInfoId() {
}
#endif // V8_SFI_HAS_UNIQUE_ID
bool OffThreadIsolate::NeedsSourcePositionsForProfiling() {
// TODO(leszeks): Figure out if it makes sense to check this asynchronously.
return isolate_->NeedsSourcePositionsForProfiling();
}
bool OffThreadIsolate::is_collecting_type_profile() {
// TODO(leszeks): Figure out if it makes sense to check this asynchronously.
return isolate_->is_collecting_type_profile();
......
......@@ -138,7 +138,6 @@ class V8_EXPORT_PRIVATE OffThreadIsolate final
int GetNextUniqueSharedFunctionInfoId();
#endif // V8_SFI_HAS_UNIQUE_ID
bool NeedsSourcePositionsForProfiling();
bool is_collecting_type_profile();
OffThreadLogger* logger() { return logger_.get(); }
......
......@@ -239,9 +239,6 @@ Handle<Script> ParseInfo::CreateScript(
flags().script_id() == Script::kTemporaryScriptId);
Handle<Script> script =
isolate->factory()->NewScriptWithId(source, flags().script_id());
if (isolate->NeedsSourcePositionsForProfiling()) {
Script::InitLineEnds(isolate, script);
}
switch (natives) {
case EXTENSION_CODE:
script->set_type(Script::TYPE_EXTENSION);
......
......@@ -104,6 +104,13 @@ function handleScriptParsed(messageObject)
var startLine = messageObject.params.startLine + 3;
var endLine = messageObject.params.endLine;
if (startLine > endLine) {
InspectorTest.log(
`Terminating early: start line ${startLine} is after end line ${endLine}.`
);
return;
}
InspectorTest.log('First script; assuming testFunction.');
InspectorTest.log(
'Flooding script with breakpoints for the lines ' + startLine + ' to ' +
......
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