5#ifndef INCLUDE_V8_SCRIPT_H_
6#define INCLUDE_V8_SCRIPT_H_
32class BackgroundDeserializeTask;
33struct ScriptStreamingData;
37
38
39
40
41
45
46
47
51
52
53
58
59
63
64
71
72
75
76
80
81
82
86
87
88
95
96
100
101
104
105
110
111
118 : line_number_(line_number), column_number_(column_number) {}
128
129
133
134
138
139
140
144
145
146
147
148
149
150
151
152
153
154
155
166 static void CheckCast(
Data* obj);
170
171
175
176
177
178
179
180
191
192
196
197
201
202
206
207
208
212
213
224
225
226
227
228
229
231 Local<
Context> context, ResolveModuleCallback module_callback,
232 ResolveSourceCallback source_callback =
nullptr);
235
236
237
238
239
240
241
242
243
247
248
249
250
254
255
256
257
258
262
263
264
265
269
270
271
272
273
277
278
279
280
284
285
289
290
294
295
296
297
298
299
300 using SyntheticModuleEvaluationSteps =
304
305
306
307
308
309
313 SyntheticModuleEvaluationSteps evaluation_steps);
316
317
318
319
320
321
326
327
328
329
330
331
338 static void CheckCast(
Data* obj);
344
345
350
351
352
356
357
363
364
365
366
372
373
377
378
379
383
384
385
390
391
392
393
400
401
404 class ConsumeCodeCacheTask;
407
408
409
410
411
412
490
491
498 ConsumeCodeCacheTask* consume_cache_task =
nullptr);
502 ConsumeCodeCacheTask* consume_cache_task =
nullptr);
504 CompileHintCallback callback,
void* callback_data);
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;
536 CompileHintCallback compile_hint_callback =
nullptr;
537 void* compile_hint_callback_data =
nullptr;
545
546
547
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
577
578
579
580
581
599 std::unique_ptr<internal::ScriptStreamingData> impl_;
607
608
609
617 explicit ScriptStreamingTask(
internal::ScriptStreamingData* data)
620 internal::ScriptStreamingData* data_;
624
625
626
627
635
636
637
638
639
640
641
642
643
644
645
646
651
652
653
654
658
659
660
661
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) {
704
705
726
727
728
729
730
731
732
733
734
735
736
737
738
745
746
747
748
749
750
751
752
753
754
761
762
763
764
765
766
767
768
769
770
775 CompileHintCallback compile_hint_callback =
nullptr,
776 void* compile_hint_callback_data =
nullptr);
779 Isolate* isolate, std::unique_ptr<CachedData> source);
781 Isolate* isolate, std::unique_ptr<CachedData> source);
784
785
786
787
788
789
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
815
816
817
818
819
820
827
828
829
830
831
832
838
839
840
841
842
843
844
845
846
849 Local<
String> arguments[] =
nullptr, size_t context_extension_count = 0,
855
856
857
858
862
863
864
865
870
871
872
873
874
884 Local<
String> arguments[], size_t context_extension_count,
892 ConsumeCodeCacheTask* consume_cache_task)
904 ConsumeCodeCacheTask* consume_cache_task)
910 CompileHintCallback callback,
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)
Local< UnboundModuleScript > GetUnboundModuleScript()
static Local< Module > CreateSyntheticModule(Isolate *isolate, Local< String > module_name, const MemorySpan< const Local< String > > &export_names, SyntheticModuleEvaluationSteps evaluation_steps)
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
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
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(Local< String > source_string, const ScriptOrigin &origin, CompileHintCallback callback, void *callback_data)
V8_INLINE ~Source()=default
V8_INLINE const CompilationDetails & GetCompilationDetails() const
V8_INLINE const CachedData * GetCachedData() const
V8_INLINE Source(Local< String > source_string, CachedData *cached_data=nullptr, ConsumeCodeCacheTask *consume_cache_task=nullptr)
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()
V8_INLINE int ColumnOffset() const
V8_INLINE int LineOffset() const
V8_INLINE ScriptOriginOptions Options() const
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()
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