diff --git a/common.gypi b/common.gypi index a8dbd9ba13e4..5e100167a421 100644 --- a/common.gypi +++ b/common.gypi @@ -50,7 +50,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.10', + 'v8_embedder_string': '-node.11', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/codegen/compiler.cc b/deps/v8/src/codegen/compiler.cc index 0a3599ee41c4..2f8ffee6a90f 100644 --- a/deps/v8/src/codegen/compiler.cc +++ b/deps/v8/src/codegen/compiler.cc @@ -2024,6 +2024,9 @@ void BackgroundCompileTask::Run( parser.ParseOnBackground(isolate, &info, script_, start_position_, end_position_, function_literal_id_); parser.UpdateStatistics(script_, &use_counts_, &total_preparse_skipped_); + if (toplevel_script_compilation) { + debug_magic_comment_locations_ = parser.debug_magic_comment_locations(); + } TRACE_EVENT(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCodeBackground"); @@ -2767,8 +2770,14 @@ MaybeHandle BackgroundCompileTask::FinalizeScript( { DisallowGarbageCollection no_gc; SetScriptFieldsFromDetails(isolate, *script, script_details, &no_gc); - LOG(isolate, ScriptDetails(*script)); } + // After SetScriptFieldsFromDetails, so that a source map URL provided + // through the API takes precedence. The locations come from the streamed + // source; the embedder is expected to pass the same source here, but an + // out-of-bounds location is ignored. + Parser::SetDebugMagicCommentFields(isolate, script, source, + debug_magic_comment_locations_); + LOG(isolate, ScriptDetails(*script)); } ReportStatistics(isolate); diff --git a/deps/v8/src/codegen/compiler.h b/deps/v8/src/codegen/compiler.h index cfa6af01010b..429be4cc70ec 100644 --- a/deps/v8/src/codegen/compiler.h +++ b/deps/v8/src/codegen/compiler.h @@ -24,6 +24,7 @@ #include "src/objects/debug-objects.h" #include "src/parsing/parse-info.h" #include "src/parsing/pending-compilation-error-handler.h" +#include "src/parsing/scanner.h" // For Scanner::DebugMagicCommentLocations. #include "src/snapshot/code-serializer.h" #include "src/utils/allocation.h" #include "src/zone/zone.h" @@ -649,6 +650,9 @@ class V8_EXPORT_PRIVATE BackgroundCompileTask { DeferredFinalizationJobDataList jobs_to_retry_finalization_on_main_thread_; base::SmallVector use_counts_; int total_preparse_skipped_ = 0; + // The source is not available on the background thread, so the debug magic + // comment values are created from these locations when finalizing. + Scanner::DebugMagicCommentLocations debug_magic_comment_locations_; // Single function data for top-level function compilation. MaybeIndirectHandle input_shared_info_; diff --git a/deps/v8/src/parsing/literal-buffer.cc b/deps/v8/src/parsing/literal-buffer.cc index 32ff27eb10a8..bfc7e762e523 100644 --- a/deps/v8/src/parsing/literal-buffer.cc +++ b/deps/v8/src/parsing/literal-buffer.cc @@ -5,29 +5,11 @@ #include "src/parsing/literal-buffer.h" #include "src/base/strings.h" -#include "src/execution/isolate.h" -#include "src/execution/local-isolate.h" -#include "src/heap/factory.h" -#include "src/objects/objects.h" -#include "src/objects/string.h" #include "src/utils/memcopy.h" namespace v8 { namespace internal { -template -DirectHandle LiteralBuffer::Internalize(IsolateT* isolate) const { - if (is_one_byte()) { - return isolate->factory()->InternalizeString(one_byte_literal()); - } - return isolate->factory()->InternalizeString(two_byte_literal()); -} - -template DirectHandle LiteralBuffer::Internalize( - Isolate* isolate) const; -template DirectHandle LiteralBuffer::Internalize( - LocalIsolate* isolate) const; - size_t LiteralBuffer::NewCapacity(size_t min_capacity) { return min_capacity < (kMaxGrowth / (kGrowthFactor - 1)) ? min_capacity * kGrowthFactor diff --git a/deps/v8/src/parsing/literal-buffer.h b/deps/v8/src/parsing/literal-buffer.h index b6d7c9e00d09..1f0dff493662 100644 --- a/deps/v8/src/parsing/literal-buffer.h +++ b/deps/v8/src/parsing/literal-buffer.h @@ -98,9 +98,6 @@ class LiteralBuffer final { is_one_byte_ = true; } - template - DirectHandle Internalize(IsolateT* isolate) const; - private: static constexpr size_t kInitialCapacity = 256; static constexpr size_t kGrowthFactor = 4; diff --git a/deps/v8/src/parsing/parser.cc b/deps/v8/src/parsing/parser.cc index 388e4f1c96e7..60f140ef5f89 100644 --- a/deps/v8/src/parsing/parser.cc +++ b/deps/v8/src/parsing/parser.cc @@ -20,6 +20,7 @@ #include "src/common/message-template.h" #include "src/common/scoped-modification.h" #include "src/compiler-dispatcher/lazy-compile-dispatcher.h" +#include "src/heap/factory-inl.h" #include "src/heap/local-heap-inl.h" #include "src/heap/parked-scope.h" #include "src/logging/counters.h" @@ -3572,32 +3573,50 @@ void Parser::InsertSloppyBlockFunctionVarBindings(DeclarationScope* scope) { // ---------------------------------------------------------------------------- // Parser support -template -void Parser::HandleDebugMagicComments(IsolateT* isolate, +void Parser::HandleDebugMagicComments(Isolate* isolate, DirectHandle