5#ifndef INCLUDE_V8_SCRIPT_H_
6#define INCLUDE_V8_SCRIPT_H_
28class BackgroundDeserializeTask;
29struct ScriptStreamingData;
83 static const int kNoScriptId = 0;
102 : line_number_(line_number), column_number_(column_number) {}
141 static void CheckCast(
Data* obj);
292 static void CheckCast(
Data* obj);
352 buffer_policy(BufferNotOwned) {}
403 int resource_line_offset;
404 int resource_column_offset;
412 std::unique_ptr<CachedData> cached_data;
413 std::unique_ptr<ConsumeCodeCacheTask> consume_cache_task;
456 enum Encoding { ONE_BYTE, TWO_BYTE, UTF8, WINDOWS_1252 };
462 internal::ScriptStreamingData*
impl()
const {
return impl_.get(); }
469 std::unique_ptr<internal::ScriptStreamingData> impl_;
486 internal::ScriptStreamingData* data_;
504 std::unique_ptr<internal::BackgroundDeserializeTask> impl);
506 std::unique_ptr<internal::BackgroundDeserializeTask> impl_;
510 kNoCompileOptions = 0,
519 kNoCacheNoReason = 0,
533 kNoCacheBecauseDeferredProduceCodeCache
587 Isolate* isolate, std::unique_ptr<CachedData> source);
656 Local<
String> arguments[],
size_t context_extension_count,
663 Local<
String> arguments[] =
nullptr,
size_t context_extension_count = 0,
698 Local<
String> arguments[],
size_t context_extension_count,
707 : source_string(
string),
708 resource_name(origin.ResourceName()),
709 resource_line_offset(origin.LineOffset()),
710 resource_column_offset(origin.ColumnOffset()),
711 resource_options(origin.Options()),
712 source_map_url(origin.SourceMapUrl()),
713 host_defined_options(origin.GetHostDefinedOptions()),
715 consume_cache_task(consume_cache_task) {}
719 : source_string(string),
721 consume_cache_task(consume_cache_task) {}
725 return cached_data.get();
729 return resource_options;
733#ifdef V8_ENABLE_CHECKS
740#ifdef V8_ENABLE_CHECKS
743 return reinterpret_cast<Module*
>(data);
Location(int line_number, int column_number)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Evaluate(Local< Context > context)
Local< UnboundModuleScript > GetUnboundModuleScript()
Local< FixedArray > GetModuleRequests() const
Local< Value > GetModuleNamespace()
Local< Value > GetException() const
V8_WARN_UNUSED_RESULT Maybe< bool > InstantiateModule(Local< Context > context, ResolveModuleCallback callback)
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
static Local< Module > CreateSyntheticModule(Isolate *isolate, Local< String > module_name, const std::vector< Local< String > > &export_names, SyntheticModuleEvaluationSteps evaluation_steps)
static V8_INLINE ModuleRequest * Cast(Data *data)
Local< FixedArray > GetImportAssertions() const
int GetSourceOffset() const
Local< String > GetSpecifier() const
virtual size_t GetMoreData(const uint8_t **src)=0
virtual ~ExternalSourceStream()=default
V8_INLINE ~Source()=default
V8_INLINE const CachedData * GetCachedData() const
V8_INLINE const ScriptOriginOptions & GetResourceOptions() const
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< 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
@ kNoCacheBecauseInspector
@ kNoCacheBecauseV8Extension
@ 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 V8_WARN_UNUSED_RESULT MaybeLocal< UnboundScript > CompileUnboundScript(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static ScriptStreamingTask * StartStreaming(Isolate *isolate, StreamedSource *source, ScriptType type=ScriptType::kClassic)
static uint32_t CachedDataVersionTag()
static V8_WARN_UNUSED_RESULT MaybeLocal< Module > CompileModule(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
Local< UnboundScript > GetUnboundScript()
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > Compile(Local< Context > context, Local< String > source, ScriptOrigin *origin=nullptr)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Run(Local< Context > context)
Local< Value > GetResourceName()
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Run(Local< Context > context, Local< Data > host_defined_options)
Local< Value > GetResourceName()
Local< Script > BindToCurrentContext()
Local< Value > GetSourceMappingURL()
Local< Value > GetSourceURL()
int GetLineNumber(int code_pos)
Local< Value > GetScriptName()
CachedData(const CachedData &)=delete
CachedData & operator=(const CachedData &)=delete
BufferPolicy buffer_policy
CachedData(const uint8_t *data, int length, BufferPolicy buffer_policy=BufferNotOwned)
#define V8_DEPRECATED(message)
#define V8_WARN_UNUSED_RESULT