From 5a5976fc5167c636e077592cbda92ab388b34c5b Mon Sep 17 00:00:00 2001 From: Leszek Swirski Date: Mon, 10 Feb 2020 15:21:24 +0100 Subject: [PATCH] [offthread] Add off-thread support to Script Adds support for off-thread allocation to Script allocation and line-end calculation. This includes adding support for keeping/merging a script list on the OffThreadIsolate, and adding syntactical support for logging (in the future this could do actual logging). Bug: chromium:1011762 Change-Id: Id90f2ad7458e90e06f6926f1fce7ef7a1ef50b3d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2046884 Reviewed-by: Toon Verwaest Reviewed-by: Ulan Degenbaev Reviewed-by: Igor Sheludko Commit-Queue: Leszek Swirski Cr-Commit-Position: refs/heads/master@{#66213} --- BUILD.gn | 2 ++ src/api/api.cc | 8 ++--- src/debug/debug.cc | 2 +- src/execution/isolate.cc | 5 +++ src/execution/isolate.h | 2 ++ src/execution/off-thread-isolate.cc | 32 ++++++++++++++++++ src/execution/off-thread-isolate.h | 25 ++++++++++---- src/heap/factory-base.cc | 36 ++++++++++++++++++++ src/heap/factory-base.h | 4 +++ src/heap/factory.cc | 31 ++--------------- src/heap/factory.h | 3 +- src/heap/off-thread-factory.cc | 19 +++++++++++ src/heap/off-thread-factory.h | 3 ++ src/json/json-parser.cc | 2 +- src/logging/log.h | 10 +++--- src/logging/off-thread-logger.h | 27 +++++++++++++++ src/objects/objects.cc | 18 +++++++--- src/objects/script.h | 5 ++- src/objects/string-inl.h | 8 +++++ src/objects/string.cc | 24 +++++++++---- src/objects/string.h | 11 ++++-- src/parsing/parse-info.cc | 52 ++++++++++++++++++++--------- src/parsing/parse-info.h | 16 ++++++--- src/runtime/runtime-debug.cc | 2 +- src/snapshot/code-serializer.cc | 4 +-- src/snapshot/object-deserializer.cc | 2 +- test/cctest/test-api.cc | 2 +- test/cctest/test-debug.cc | 2 +- 28 files changed, 267 insertions(+), 90 deletions(-) create mode 100644 src/execution/off-thread-isolate.cc create mode 100644 src/logging/off-thread-logger.h diff --git a/BUILD.gn b/BUILD.gn index 4e236271cf..d5e838c71f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2235,6 +2235,7 @@ v8_source_set("v8_base_without_compiler") { "src/execution/messages.h", "src/execution/microtask-queue.cc", "src/execution/microtask-queue.h", + "src/execution/off-thread-isolate.cc", "src/execution/off-thread-isolate.h", "src/execution/protectors-inl.h", "src/execution/protectors.cc", @@ -2449,6 +2450,7 @@ v8_source_set("v8_base_without_compiler") { "src/logging/log-utils.h", "src/logging/log.cc", "src/logging/log.h", + "src/logging/off-thread-logger.h", "src/numbers/bignum-dtoa.cc", "src/numbers/bignum-dtoa.h", "src/numbers/bignum.cc", diff --git a/src/api/api.cc b/src/api/api.cc index d99fb0ae51..58b3c388cf 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -9439,7 +9439,7 @@ std::vector debug::Script::LineEnds() const { i::Isolate* isolate = script->GetIsolate(); i::HandleScope scope(isolate); - i::Script::InitLineEnds(script); + i::Script::InitLineEnds(isolate, script); CHECK(script->line_ends().IsFixedArray()); i::Handle line_ends(i::FixedArray::cast(script->line_ends()), isolate); @@ -9531,9 +9531,9 @@ bool debug::Script::GetPossibleBreakpoints( locations); } - i::Script::InitLineEnds(script); - CHECK(script->line_ends().IsFixedArray()); i::Isolate* isolate = script->GetIsolate(); + i::Script::InitLineEnds(isolate, script); + CHECK(script->line_ends().IsFixedArray()); i::Handle line_ends = i::Handle::cast(i::handle(script->line_ends(), isolate)); CHECK(line_ends->length()); @@ -9586,7 +9586,7 @@ int debug::Script::GetSourceOffset(const debug::Location& location) const { column = std::max(0, column - script->column_offset()); } - i::Script::InitLineEnds(script); + i::Script::InitLineEnds(script->GetIsolate(), script); CHECK(script->line_ends().IsFixedArray()); i::Handle line_ends = i::Handle::cast( i::handle(script->line_ends(), script->GetIsolate())); diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 2e9a9492dc..dfdab89b84 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -2068,7 +2068,7 @@ void Debug::PrintBreakLocation() { if (script_obj->IsScript()) { Handle