diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-12-04 08:20:37 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-12-06 15:23:33 +0100 |
commit | 9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3 (patch) | |
tree | 2b0c843168dafb939d8df8a15b2aa72b76dee51d /deps/v8/src/compiler.h | |
parent | b8fbe69db1292307adb2c2b2e0d5ef48c4ab2faf (diff) | |
download | android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.gz android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.bz2 android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.zip |
deps: update V8 to 7.1.302.28
PR-URL: https://github.com/nodejs/node/pull/23423
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/src/compiler.h')
-rw-r--r-- | deps/v8/src/compiler.h | 93 |
1 files changed, 66 insertions, 27 deletions
diff --git a/deps/v8/src/compiler.h b/deps/v8/src/compiler.h index b3a5b73997..f32d771266 100644 --- a/deps/v8/src/compiler.h +++ b/deps/v8/src/compiler.h @@ -20,6 +20,8 @@ namespace v8 { namespace internal { // Forward declarations. +class AstRawString; +class BackgroundCompileTask; class JavaScriptFrame; class OptimizedCompilationInfo; class OptimizedCompilationJob; @@ -27,8 +29,10 @@ class ParseInfo; class Parser; class ScriptData; struct ScriptStreamingData; +class TimedHistogram; class UnoptimizedCompilationInfo; class UnoptimizedCompilationJob; +class WorkerThreadRuntimeCallStats; typedef std::forward_list<std::unique_ptr<UnoptimizedCompilationJob>> UnoptimizedCompilationJobList; @@ -61,19 +65,14 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { V8_WARN_UNUSED_RESULT static MaybeHandle<SharedFunctionInfo> CompileForLiveEdit(ParseInfo* parse_info, Isolate* isolate); - // Creates a new task that when run will parse and compile the streamed - // script associated with |streaming_data| and can be finalized with - // Compiler::GetSharedFunctionInfoForStreamedScript. - // Note: does not take ownership of streaming_data. - static ScriptCompiler::ScriptStreamingTask* NewBackgroundCompileTask( - ScriptStreamingData* streaming_data, Isolate* isolate); + // Finalize and install code from previously run background compile task. + static bool FinalizeBackgroundCompileTask( + BackgroundCompileTask* task, Handle<SharedFunctionInfo> shared_info, + Isolate* isolate, ClearExceptionFlag flag); - // Generate and install code from previously queued compilation job. - static bool FinalizeCompilationJob(UnoptimizedCompilationJob* job, - Handle<SharedFunctionInfo> shared_info, - Isolate* isolate); - static bool FinalizeCompilationJob(OptimizedCompilationJob* job, - Isolate* isolate); + // Finalize and install optimized code from previously run job. + static bool FinalizeOptimizedCompilationJob(OptimizedCompilationJob* job, + Isolate* isolate); // Give the compiler a chance to perform low-latency initialization tasks of // the given {function} on its instantiation. Note that only the runtime will @@ -101,9 +100,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { Handle<String> source, Handle<SharedFunctionInfo> outer_info, Handle<Context> context, LanguageMode language_mode, ParseRestriction restriction, int parameters_end_pos, - int eval_scope_position, int eval_position, int line_offset = 0, - int column_offset = 0, Handle<Object> script_name = Handle<Object>(), - ScriptOriginOptions options = ScriptOriginOptions()); + int eval_scope_position, int eval_position); struct ScriptDetails { ScriptDetails() : line_offset(0), column_offset(0) {} @@ -192,7 +189,7 @@ class V8_EXPORT_PRIVATE CompilationJob { CompilationJob(uintptr_t stack_limit, State initial_state) : state_(initial_state), stack_limit_(stack_limit) {} - virtual ~CompilationJob() {} + virtual ~CompilationJob() = default; void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; } uintptr_t stack_limit() const { return stack_limit_; } @@ -319,6 +316,57 @@ class OptimizedCompilationJob : public CompilationJob { const char* compiler_name_; }; +class BackgroundCompileTask { + public: + // Creates a new task that when run will parse and compile the streamed + // script associated with |data| and can be finalized with + // Compiler::GetSharedFunctionInfoForStreamedScript. + // Note: does not take ownership of |data|. + BackgroundCompileTask(ScriptStreamingData* data, Isolate* isolate); + + // Creates a new task that when run will parse and compile the + // |function_literal| and can be finalized with + // Compiler::FinalizeBackgroundCompileTask. + BackgroundCompileTask( + AccountingAllocator* allocator, const ParseInfo* outer_parse_info, + const AstRawString* function_name, + const FunctionLiteral* function_literal, + WorkerThreadRuntimeCallStats* worker_thread_runtime_stats, + TimedHistogram* timer, int max_stack_size); + + void Run(); + + ParseInfo* info() { return info_.get(); } + Parser* parser() { return parser_.get(); } + UnoptimizedCompilationJob* outer_function_job() { + return outer_function_job_.get(); + } + UnoptimizedCompilationJobList* inner_function_jobs() { + return &inner_function_jobs_; + } + + private: + // Data needed for parsing, and data needed to to be passed between thread + // between parsing and compilation. These need to be initialized before the + // compilation starts. + std::unique_ptr<ParseInfo> info_; + std::unique_ptr<Parser> parser_; + // TODO(rmcilroy): Consider having thread-local unicode-caches rather than + // creating a new one each time. + UnicodeCache unicode_cache_; + + // Data needed for finalizing compilation after background compilation. + std::unique_ptr<UnoptimizedCompilationJob> outer_function_job_; + UnoptimizedCompilationJobList inner_function_jobs_; + + int stack_size_; + WorkerThreadRuntimeCallStats* worker_thread_runtime_call_stats_; + AccountingAllocator* allocator_; + TimedHistogram* timer_; + + DISALLOW_COPY_AND_ASSIGN(BackgroundCompileTask); +}; + // Contains all data which needs to be transmitted between threads for // background parsing and compiling and finalizing it on the main thread. struct ScriptStreamingData { @@ -331,18 +379,9 @@ struct ScriptStreamingData { // Internal implementation of v8::ScriptCompiler::StreamedSource. std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream; ScriptCompiler::StreamedSource::Encoding encoding; - std::unique_ptr<ScriptCompiler::CachedData> cached_data; - // Data needed for parsing, and data needed to to be passed between thread - // between parsing and compilation. These need to be initialized before the - // compilation starts. - UnicodeCache unicode_cache; - std::unique_ptr<ParseInfo> info; - std::unique_ptr<Parser> parser; - - // Data needed for finalizing compilation after background compilation. - std::unique_ptr<UnoptimizedCompilationJob> outer_function_job; - UnoptimizedCompilationJobList inner_function_jobs; + // Task that performs background parsing and compilation. + std::unique_ptr<BackgroundCompileTask> task; DISALLOW_COPY_AND_ASSIGN(ScriptStreamingData); }; |