5#ifndef INCLUDE_V8_SCRIPT_H_
6#define INCLUDE_V8_SCRIPT_H_
30class BackgroundDeserializeTask;
31struct ScriptStreamingData;
89 static const int kNoScriptId = 0;
116 : line_number_(line_number), column_number_(column_number) {}
155 static void CheckCast(
Data* obj);
316 static void CheckCast(
Data* obj);
382 buffer_policy(BufferNotOwned) {}
435 int resource_line_offset;
436 int resource_column_offset;
444 std::unique_ptr<CachedData> cached_data;
445 std::unique_ptr<ConsumeCodeCacheTask> consume_cache_task;
449 void* compile_hint_callback_data =
nullptr;
492 enum Encoding { ONE_BYTE, TWO_BYTE, UTF8, WINDOWS_1252 };
498 internal::ScriptStreamingData*
impl()
const {
return impl_.get(); }
505 std::unique_ptr<internal::ScriptStreamingData> impl_;
522 internal::ScriptStreamingData* data_;
570 std::unique_ptr<internal::BackgroundDeserializeTask> impl);
572 std::unique_ptr<internal::BackgroundDeserializeTask> impl_;
576 kNoCompileOptions = 0,
587 kNoCacheNoReason = 0,
601 kNoCacheBecauseDeferredProduceCodeCache
656 Isolate* isolate, std::unique_ptr<CachedData> source);
725 Local<
String> arguments[],
size_t context_extension_count,
733 Local<
String> arguments[] =
nullptr,
size_t context_extension_count = 0,
768 Local<
String> arguments[],
size_t context_extension_count,
777 : source_string(
string),
778 resource_name(origin.ResourceName()),
779 resource_line_offset(origin.LineOffset()),
780 resource_column_offset(origin.ColumnOffset()),
781 resource_options(origin.Options()),
782 source_map_url(origin.SourceMapUrl()),
783 host_defined_options(origin.GetHostDefinedOptions()),
785 consume_cache_task(consume_cache_task) {}
789 : source_string(string),
791 consume_cache_task(consume_cache_task) {}
796 : source_string(string),
797 resource_name(origin.ResourceName()),
798 resource_line_offset(origin.LineOffset()),
799 resource_column_offset(origin.ColumnOffset()),
800 resource_options(origin.Options()),
801 source_map_url(origin.SourceMapUrl()),
802 host_defined_options(origin.GetHostDefinedOptions()),
803 compile_hint_callback(callback),
804 compile_hint_callback_data(callback_data) {}
808 return cached_data.get();
812 return resource_options;
816#ifdef V8_ENABLE_CHECKS
823#ifdef V8_ENABLE_CHECKS
826 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
std::vector< std::tuple< Local< Module >, Local< Message > > > GetStalledTopLevelAwaitMessage(Isolate *isolate)
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
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
V8_INLINE ~Source()=default
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)
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 uint32_t CachedDataVersionTag()
static V8_WARN_UNUSED_RESULT MaybeLocal< Module > CompileModule(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static ScriptStreamingTask * StartStreaming(Isolate *isolate, StreamedSource *source, ScriptType type=ScriptType::kClassic, CompileOptions options=kNoCompileOptions)
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)
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()
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)
#define V8_DEPRECATED(message)
#define V8_WARN_UNUSED_RESULT