HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Pie
|
9.0.0_r8
下载
查看原文件
收藏
根目录
external
v8
src
compiler-dispatcher
compiler-dispatcher.h
// Copyright 2016 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_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ #define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ #include
#include
#include
#include
#include "src/base/atomic-utils.h" #include "src/base/macros.h" #include "src/base/platform/condition-variable.h" #include "src/base/platform/mutex.h" #include "src/base/platform/semaphore.h" #include "src/globals.h" #include "testing/gtest/include/gtest/gtest_prod.h" namespace v8 { class Platform; enum class MemoryPressureLevel; namespace internal { class CancelableTaskManager; class CompilerDispatcherJob; class CompilerDispatcherTracer; class DeferredHandles; class FunctionLiteral; class Isolate; class SharedFunctionInfo; class Zone; template
class Handle; // The CompilerDispatcher uses a combination of idle tasks and background tasks // to parse and compile lazily parsed functions. // // As both parsing and compilation currently requires a preparation and // finalization step that happens on the main thread, every task has to be // advanced during idle time first. Depending on the properties of the task, it // can then be parsed or compiled on either background threads, or during idle // time. Last, it has to be finalized during idle time again. // // CompilerDispatcher::jobs_ maintains the list of all CompilerDispatcherJobs // the CompilerDispatcher knows about. // // CompilerDispatcher::pending_background_jobs_ contains the set of // CompilerDispatcherJobs that can be processed on a background thread. // // CompilerDispatcher::running_background_jobs_ contains the set of // CompilerDispatcherJobs that are currently being processed on a background // thread. // // CompilerDispatcher::DoIdleWork tries to advance as many jobs out of jobs_ as // possible during idle time. If a job can't be advanced, but is suitable for // background processing, it fires off background threads. // // CompilerDispatcher::DoBackgroundWork advances one of the pending jobs, and // then spins of another idle task to potentially do the final step on the main // thread. class V8_EXPORT_PRIVATE CompilerDispatcher { public: enum class BlockingBehavior { kBlock, kDontBlock }; CompilerDispatcher(Isolate* isolate, Platform* platform, size_t max_stack_size); ~CompilerDispatcher(); // Returns true if the compiler dispatcher is enabled. bool IsEnabled() const; // Enqueue a job for parse and compile. Returns true if a job was enqueued. bool Enqueue(Handle
function); // Like Enqueue, but also advances the job so that it can potentially // continue running on a background thread (if at all possible). Returns // true if the job was enqueued. bool EnqueueAndStep(Handle
function); // Enqueue a job for compilation. Function must have already been parsed and // analyzed and be ready for compilation. Returns true if a job was enqueued. bool Enqueue(Handle
登录后可以享受更多权益
您还没有登录,登录后您可以:
收藏Android系统代码
收藏喜欢的文章
多个平台共享账号
去登录
首次使用?从这里
注册