[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: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67363}
This commit is contained in:
Leszek Swirski 2020-04-24 15:12:52 +02:00 committed by Commit Bot
parent 2b8cc34b09
commit 9f43850fb3
5 changed files with 10 additions and 9 deletions

View File

@ -1060,6 +1060,9 @@ void FinalizeScriptCompilation(
}
}
}
if (isolate->NeedsSourcePositionsForProfiling()) {
Script::InitLineEnds(isolate, script);
}
}
template <typename LocalIsolate>

View File

@ -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();

View File

@ -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(); }

View File

@ -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);

View File

@ -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 ' +