// Copyright 2022 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_CODEGEN_BACKGROUND_MERGE_TASK_H_ #define V8_CODEGEN_BACKGROUND_MERGE_TASK_H_ #include #include "src/handles/maybe-handles.h" namespace v8 { namespace internal { class FeedbackMetadata; class PersistentHandles; class Script; class SharedFunctionInfo; class String; struct ScriptDetails; // Contains data transferred between threads for background merging between a // newly compiled or deserialized script and an existing script from the Isolate // compilation cache. class V8_EXPORT_PRIVATE BackgroundMergeTask { public: ~BackgroundMergeTask(); // Step 1: on the main thread, check whether the Isolate compilation cache // contains the script. void SetUpOnMainThread(Isolate* isolate, Handle source_text, const ScriptDetails& script_details, LanguageMode language_mode); // Step 2: on the background thread, update pointers in the new Script's // object graph to point to corresponding objects from the cached Script where // appropriate. May only be called if HasPendingBackgroundWork returned true. void BeginMergeInBackground(LocalIsolate* isolate, Handle