5#ifndef INCLUDE_V8_SCRIPT_H_
6#define INCLUDE_V8_SCRIPT_H_
32class BackgroundDeserializeTask;
33struct ScriptStreamingData;
118 : line_number_(line_number), column_number_(column_number) {}
166 static void CheckCast(
Data* obj);
338 static void CheckCast(Data* obj);
523 int resource_line_offset = -1;
524 int resource_column_offset = -1;
532 std::unique_ptr<CachedData> cached_data;
533 std::unique_ptr<ConsumeCodeCacheTask> consume_cache_task;
537 void* compile_hint_callback_data =
nullptr;
590 internal::ScriptStreamingData*
impl()
const {
return impl_.get(); }
599 std::unique_ptr<internal::ScriptStreamingData> impl_;
617 explicit ScriptStreamingTask(internal::ScriptStreamingData* data)
620 internal::ScriptStreamingData* data_;
667 explicit ConsumeCodeCacheTask(
668 std::unique_ptr<internal::BackgroundDeserializeTask> impl);
670 std::unique_ptr<internal::BackgroundDeserializeTask> impl_;
697 if ((compile_options & produce_and_consume) == produce_and_consume) {
776 void* compile_hint_callback_data =
nullptr);
779 Isolate* isolate, std::unique_ptr<CachedData> source);
781 Isolate* isolate, std::unique_ptr<CachedData> source);
849 Local<String> arguments[] =
nullptr,
size_t context_extension_count = 0,
893 : source_string(string),
894 resource_name(origin.ResourceName()),
895 resource_line_offset(origin.LineOffset()),
896 resource_column_offset(origin.ColumnOffset()),
897 resource_options(origin.Options()),
898 source_map_url(origin.SourceMapUrl()),
899 host_defined_options(origin.GetHostDefinedOptions()),
901 consume_cache_task(consume_cache_task) {}
905 : source_string(string),
907 consume_cache_task(consume_cache_task) {}
912 : source_string(string),
913 resource_name(origin.ResourceName()),
914 resource_line_offset(origin.LineOffset()),
915 resource_column_offset(origin.ColumnOffset()),
916 resource_options(origin.Options()),
917 source_map_url(origin.SourceMapUrl()),
918 host_defined_options(origin.GetHostDefinedOptions()),
919 compile_hint_callback(callback),
920 compile_hint_callback_data(callback_data) {}
924 return cached_data.get();
928 return resource_options;
933 return compilation_details;
937#ifdef V8_ENABLE_CHECKS
944#ifdef V8_ENABLE_CHECKS
947 return reinterpret_cast<Module*
>(data);
std::vector< int > GetCompileHints(Isolate *isolate) const
Location(int line_number, int column_number)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Evaluate(Local< Context > context)
bool HasTopLevelAwait() const
std::pair< LocalVector< Module >, LocalVector< Message > > GetStalledTopLevelAwaitMessages(Isolate *isolate)
V8_WARN_UNUSED_RESULT Maybe< bool > InstantiateModule(Local< Context > context, ResolveModuleCallback module_callback, ResolveSourceCallback source_callback=nullptr)
MaybeLocal< Value >(*)(Local< Context > context, Local< Module > module) SyntheticModuleEvaluationSteps
Local< UnboundModuleScript > GetUnboundModuleScript()
static Local< Module > CreateSyntheticModule(Isolate *isolate, Local< String > module_name, const MemorySpan< const Local< String > > &export_names, SyntheticModuleEvaluationSteps evaluation_steps)
MaybeLocal< Module >(*)( Local< Context > context, Local< String > specifier, Local< FixedArray > import_attributes, Local< Module > referrer) ResolveModuleCallback
Local< FixedArray > GetModuleRequests() const
Local< Value > GetModuleNamespace()
Local< Value > GetException() const
bool IsSyntheticModule() const
static V8_INLINE Module * Cast(Data *data)
Location SourceOffsetToLocation(int offset) const
int GetIdentityHash() const
bool IsSourceTextModule() const
V8_WARN_UNUSED_RESULT Maybe< bool > SetSyntheticModuleExport(Isolate *isolate, Local< String > export_name, Local< Value > export_value)
bool IsGraphAsync() const
MaybeLocal< Object >(*)( Local< Context > context, Local< String > specifier, Local< FixedArray > import_attributes, Local< Module > referrer) ResolveSourceCallback
ModuleImportPhase GetPhase() const
static V8_INLINE ModuleRequest * Cast(Data *data)
Local< FixedArray > GetImportAssertions() const
int GetSourceOffset() const
Local< FixedArray > GetImportAttributes() const
Local< String > GetSpecifier() const
friend class ScriptCompiler
void SourceTextAvailable(Isolate *isolate, Local< String > source_text, const ScriptOrigin &origin)
bool ShouldMergeWithExistingScript() const
void MergeWithExistingScript()
virtual size_t GetMoreData(const uint8_t **src)=0
virtual ~ExternalSourceStream()=default
friend class ScriptCompiler
friend class ScriptCompiler
V8_INLINE ~Source()=default
V8_INLINE const CompilationDetails & GetCompilationDetails() const
V8_INLINE const CachedData * GetCachedData() const
V8_INLINE const ScriptOriginOptions & GetResourceOptions() const
V8_INLINE Source(Local< String > source_string, const ScriptOrigin &origin, CachedData *cached_data=nullptr, ConsumeCodeCacheTask *consume_cache_task=nullptr)
CompilationDetails & compilation_details()
internal::ScriptStreamingData * impl() const
StreamedSource & operator=(const StreamedSource &)=delete
StreamedSource(const StreamedSource &)=delete
StreamedSource(std::unique_ptr< ExternalSourceStream > source_stream, Encoding encoding)
static V8_WARN_UNUSED_RESULT MaybeLocal< Module > CompileModule(Local< Context > context, StreamedSource *v8_source, Local< String > full_source_string, const ScriptOrigin &origin)
static V8_WARN_UNUSED_RESULT MaybeLocal< Function > CompileFunction(Local< Context > context, Source *source, size_t arguments_count=0, Local< String > arguments[]=nullptr, size_t context_extension_count=0, Local< Object > context_extensions[]=nullptr, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > Compile(Local< Context > context, StreamedSource *source, Local< String > full_source_string, const ScriptOrigin &origin)
static ConsumeCodeCacheTask * StartConsumingCodeCache(Isolate *isolate, std::unique_ptr< CachedData > source)
@ kNoCacheBecauseScriptTooSmall
@ kNoCacheBecauseInlineScript
@ kNoCacheBecauseExtensionModule
@ kNoCacheBecauseCacheTooCold
@ kNoCacheBecauseStreamingSource
@ kNoCacheBecauseDeferredProduceCodeCache
@ kNoCacheBecauseInspector
@ kNoCacheBecauseV8Extension
@ kNoCacheBecauseStaticCodeCache
@ kNoCacheBecauseNoResource
@ kNoCacheBecausePacScript
@ kNoCacheBecauseCachingDisabled
@ kNoCacheBecauseResourceWithNoCacheHandler
@ kNoCacheBecauseInDocumentWrite
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > Compile(Local< Context > context, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static CachedData * CreateCodeCache(Local< UnboundScript > unbound_script)
static V8_WARN_UNUSED_RESULT MaybeLocal< UnboundScript > CompileUnboundScript(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static CachedData * CreateCodeCacheForFunction(Local< Function > function)
@ kFollowCompileHintsMagicComment
@ kFollowCompileHintsPerFunctionMagicComment
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 CachedData * CreateCodeCache(Local< UnboundModuleScript > unbound_module_script)
static ScriptStreamingTask * StartStreaming(Isolate *isolate, StreamedSource *source, ScriptType type=ScriptType::kClassic, CompileOptions options=kNoCompileOptions, CompileHintCallback compile_hint_callback=nullptr, void *compile_hint_callback_data=nullptr)
static ConsumeCodeCacheTask * StartConsumingCodeCacheOnBackground(Isolate *isolate, std::unique_ptr< CachedData > source)
static bool CompileOptionsIsValid(CompileOptions compile_options)
Local< UnboundScript > GetUnboundScript()
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > Compile(Local< Context > context, Local< String > source, ScriptOrigin *origin=nullptr)
Local< CompileHintsCollector > GetCompileHintsCollector() const
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Run(Local< Context > context)
std::vector< int > GetProducedCompileHints() const
Local< Value > GetResourceName()
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Run(Local< Context > context, Local< Data > host_defined_options)
Local< Value > GetResourceName()
Local< Data > HostDefinedOptions()
Local< Value > GetSourceMappingURL()
Local< Value > GetSourceURL()
static const int kNoScriptId
int GetColumnNumber(int code_pos=0)
Local< Script > BindToCurrentContext()
Local< Value > GetSourceMappingURL()
Local< Value > GetSourceURL()
int GetLineNumber(int code_pos=0)
Local< Value > GetScriptName()
bool(*)(int, void *) CompileHintCallback
CachedData(const CachedData &)=delete
CachedData & operator=(const CachedData &)=delete
BufferPolicy buffer_policy
CachedData(const uint8_t *data, int length, BufferPolicy buffer_policy=BufferNotOwned)
@ kReadOnlySnapshotChecksumMismatch
CompatibilityCheckResult CompatibilityCheck(Isolate *isolate)
int64_t foreground_time_in_microseconds
static constexpr int64_t kTimeNotMeasured
InMemoryCacheResult in_memory_cache_result
int64_t background_time_in_microseconds
#define V8_DEPRECATE_SOON(message)
#define V8_DEPRECATED(message)
#define V8_WARN_UNUSED_RESULT