#include <v8.h>
|
enum | CompileOptions { kNoCompileOptions = 0,
kConsumeCodeCache,
kEagerCompile
} |
|
enum | NoCacheReason {
kNoCacheNoReason = 0,
kNoCacheBecauseCachingDisabled,
kNoCacheBecauseNoResource,
kNoCacheBecauseInlineScript,
kNoCacheBecauseModule,
kNoCacheBecauseStreamingSource,
kNoCacheBecauseInspector,
kNoCacheBecauseScriptTooSmall,
kNoCacheBecauseCacheTooCold,
kNoCacheBecauseV8Extension,
kNoCacheBecauseExtensionModule,
kNoCacheBecausePacScript,
kNoCacheBecauseInDocumentWrite,
kNoCacheBecauseResourceWithNoCacheHandler,
kNoCacheBecauseDeferredProduceCodeCache
} |
|
|
static V8_WARN_UNUSED_RESULT MaybeLocal< UnboundScript > | CompileUnboundScript (Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason) |
|
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > | Compile (Local< Context > context, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason) |
|
static ScriptStreamingTask * | StartStreamingScript (Isolate *isolate, StreamedSource *source, CompileOptions options=kNoCompileOptions) |
|
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > | Compile (Local< Context > context, StreamedSource *source, Local< String > full_source_string, const ScriptOrigin &origin) |
|
static uint32_t | CachedDataVersionTag () |
|
static V8_WARN_UNUSED_RESULT MaybeLocal< Module > | CompileModule (Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason) |
|
static V8_WARN_UNUSED_RESULT MaybeLocal< Function > | CompileFunctionInContext (Local< Context > context, Source *source, size_t arguments_count, Local< String > arguments[], size_t context_extension_count, Local< Object > context_extensions[], CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason) |
|
static CachedData * | CreateCodeCache (Local< UnboundScript > unbound_script) |
|
static CachedData * | CreateCodeCache (Local< UnboundModuleScript > unbound_module_script) |
|
static CachedData * | CreateCodeCacheForFunction (Local< Function > function) |
|
For compiling scripts.
Definition at line 1251 of file v8.h.
◆ NoCacheReason
The reason for which we are not requesting or providing a code cache.
Definition at line 1435 of file v8.h.
◆ CachedDataVersionTag()
uint32_t v8::ScriptCompiler::CachedDataVersionTag |
( |
| ) |
|
|
static |
Return a version tag for CachedData for the current V8 version & flags.
This value is meant only for determining whether a previously generated CachedData instance is still valid; the tag has no other meaing.
Background: The data carried by CachedData may depend on the exact V8 version number or current compiler flags. This means that when persisting CachedData, the embedder must take care to not pass in data from another V8 version, or the same version with different features enabled.
The easiest way to do so is to clear the embedder's cache on any such change.
Alternatively, this tag can be stored alongside the cached data and compared when it is being used.
Definition at line 2573 of file api.cc.
◆ Compile() [1/2]
Compiles the specified script (bound to current context).
- Parameters
-
source | Script source code. |
pre_data | Pre-parsing data, as obtained by ScriptData::PreCompile() using pre_data speeds compilation if it's done multiple times. Owned by caller, no references are kept when this function returns. |
- Returns
- Compiled script object, bound to the context that was active when this function was called. When run it will always use this context.
Definition at line 2378 of file api.cc.
◆ Compile() [2/2]
Compiles a streamed script (bound to current context).
This can only be called after the streaming has finished (ScriptStreamingTask has been run). V8 doesn't construct the source string during streaming, so the embedder needs to pass the full source here.
Definition at line 2540 of file api.cc.
◆ CompileFunctionInContext()
Compile a function for a given context. This is equivalent to running
with (obj) { return function(args) { ... } }
It is possible to specify multiple context extensions (obj in the above example).
Definition at line 2451 of file api.cc.
◆ CompileModule()
MaybeLocal< Module > v8::ScriptCompiler::CompileModule |
( |
Isolate * |
isolate, |
|
|
Source * |
source, |
|
|
CompileOptions |
options = kNoCompileOptions , |
|
|
NoCacheReason |
no_cache_reason = kNoCacheNoReason |
|
) |
| |
|
static |
Compile an ES module, returning a Module that encapsulates the compiled code.
Corresponds to the ParseModule abstract operation in the ECMAScript specification.
Definition at line 2394 of file api.cc.
◆ CompileUnboundScript()
Compiles the specified script (context-independent). Cached data as part of the source object can be optionally produced to be consumed later to speed up compilation of identical source scripts.
Note that when producing cached data, the source must point to NULL for cached data. When consuming cached data, the cached data must have been produced by the same version of V8.
- Parameters
-
- Returns
- Compiled script object (context independent; for running it must be bound to a context).
Definition at line 2368 of file api.cc.
◆ CreateCodeCache() [1/2]
Creates and returns code cache for the specified unbound_script. This will return nullptr if the script cannot be serialized. The CachedData returned by this function should be owned by the caller.
Definition at line 2579 of file api.cc.
◆ CreateCodeCache() [2/2]
Creates and returns code cache for the specified unbound_module_script. This will return nullptr if the script cannot be serialized. The CachedData returned by this function should be owned by the caller.
Definition at line 2589 of file api.cc.
◆ CreateCodeCacheForFunction()
Creates and returns code cache for the specified function that was previously produced by CompileFunctionInContext. This will return nullptr if the script cannot be serialized. The CachedData returned by this function should be owned by the caller.
Definition at line 2598 of file api.cc.
◆ StartStreamingScript()
Returns a task which streams script data into V8, or NULL if the script cannot be streamed. The user is responsible for running the task on a background thread and deleting it. When ran, the task starts parsing the script, and it will request data from the StreamedSource as needed. When ScriptStreamingTask::Run exits, all data has been streamed and the script can be compiled (see Compile below).
This API allows to start the streaming with as little data as possible, and the remaining data (for example, the ScriptOrigin) is passed to Compile.
Definition at line 2524 of file api.cc.
The documentation for this class was generated from the following files: