Loading...
Searching...
No Matches
v8-script.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_SCRIPT_H_
6#define INCLUDE_V8_SCRIPT_H_
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include <memory>
12#include <span>
13#include <tuple>
14#include <vector>
15
16#include "v8-callbacks.h" // NOLINT(build/include_directory)
17#include "v8-data.h" // NOLINT(build/include_directory)
18#include "v8-local-handle.h" // NOLINT(build/include_directory)
19#include "v8-maybe.h" // NOLINT(build/include_directory)
20#include "v8-message.h" // NOLINT(build/include_directory)
21#include "v8config.h" // NOLINT(build/include_directory)
22
23namespace v8 {
24
25class Function;
26class Message;
27class Object;
28class PrimitiveArray;
29class Script;
30
31namespace internal {
32class BackgroundDeserializeTask;
33struct ScriptStreamingData;
34} // namespace internal
35
43 public:
49
55};
56
61 public:
66
67 /*
68 * A unique id.
69 */
70 int ScriptId() const;
71 V8_DEPRECATE_SOON("Use ScriptId")
72 int GetId() const;
73
74 Local<Value> GetScriptName();
75
79 Local<Value> GetSourceURL();
83 Local<Value> GetSourceMappingURL();
84
89 int GetLineNumber(int code_pos = 0);
90
95 int GetColumnNumber(int code_pos = 0);
96
97 static const int kNoScriptId = 0;
98};
99
104 public:
113
114 /*
115 * A unique id.
116 */
117 int ScriptId() const;
118
119 static const int kNoScriptId = 0;
120};
121
122static_assert(UnboundModuleScript::kNoScriptId == UnboundScript::kNoScriptId);
123
128 public:
129 int GetLineNumber() { return line_number_; }
130 int GetColumnNumber() { return column_number_; }
131
132 Location(int line_number, int column_number)
133 : line_number_(line_number), column_number_(column_number) {}
134
135 private:
136 int line_number_;
137 int column_number_;
138};
139
141 public:
146
151
156 int GetSourceOffset() const;
157
172
173 V8_DEPRECATED("Use GetImportAttributes instead")
174 Local<FixedArray> GetImportAssertions() const {
175 return GetImportAttributes();
176 }
177
178 V8_INLINE static ModuleRequest* Cast(Data* data);
179
180 private:
181 static void CheckCast(Data* obj);
182};
183
187class V8_EXPORT Module : public Data {
188 public:
196 enum Status {
202 kErrored
203 };
204
211
216
221
226
232
236 int GetIdentityHash() const;
237
239 Local<Context> context, Local<String> specifier,
240 Local<FixedArray> import_attributes, Local<Module> referrer);
242 Local<Context> context, Local<String> specifier,
243 Local<FixedArray> import_attributes, Local<Module> referrer);
244
246 Local<Context> context, size_t module_request_index,
247 Local<Module> referrer);
249 Local<Context> context, size_t module_request_index,
250 Local<Module> referrer);
251
260 Local<Context> context, ResolveModuleCallback module_callback,
261 ResolveSourceCallback source_callback = nullptr);
262
270 Local<Context> context, ResolveModuleByIndexCallback module_callback,
271 ResolveSourceByIndexCallback source_callback = nullptr);
272
284
296 Local<Context> context);
297
305
313
319 int ScriptId() const;
320
327 bool IsGraphAsync() const;
328
334 bool HasTopLevelAwait() const;
335
339 bool IsSourceTextModule() const;
340
344 bool IsSyntheticModule() const;
345
346 /*
347 * Callback defined in the embedder. This is responsible for setting
348 * the module's exported values with calls to SetSyntheticModuleExport().
349 * The callback must return a resolved Promise to indicate success (where no
350 * exception was thrown) and return an empy MaybeLocal to indicate falure
351 * (where an exception was thrown).
352 */
355
364 Isolate* isolate, Local<String> module_name,
365 const std::span<const Local<String>>& export_names,
366 SyntheticModuleEvaluationSteps evaluation_steps,
367 Local<Data> host_defined_options = Local<Data>());
368
374
383 Isolate* isolate, Local<String> export_name, Local<Value> export_value);
384
392 std::pair<LocalVector<Module>, LocalVector<Message>>
394
395 V8_INLINE static Module* Cast(Data* data);
396
397 private:
398 static void CheckCast(Data* obj);
399};
400
402 public:
406 std::vector<int> GetCompileHints(Isolate* isolate) const;
407};
408
413class V8_EXPORT Script : public Data {
414 public:
419 Local<Context> context, Local<String> source,
420 ScriptOrigin* origin = nullptr);
421
429 Local<Data> host_defined_options);
430
435
439 int ScriptId() const;
440
446
451 V8_DEPRECATE_SOON("Use GetCompileHintsCollector instead")
452 std::vector<int> GetProducedCompileHints() const;
453
459 Local<CompileHintsCollector> GetCompileHintsCollector() const;
460};
461
463
468 public:
470
479 enum BufferPolicy { BufferNotOwned, BufferOwned };
480
482 : data(nullptr),
483 length(0),
484 rejected(false),
485 buffer_policy(BufferNotOwned) {}
486
487 // If buffer_policy is BufferNotOwned, the caller keeps the ownership of
488 // data and guarantees that it stays alive until the CachedData object is
489 // destroyed. If the policy is BufferOwned, the given data will be deleted
490 // (with delete[]) when the CachedData object is destroyed.
491 CachedData(const uint8_t* data, int length,
492 BufferPolicy buffer_policy = BufferNotOwned);
494
496 // Don't change order/existing values of this enum since it keys into the
497 // `code_cache_reject_reason` histogram. Append-only!
499 kMagicNumberMismatch = 1,
500 kVersionMismatch = 2,
501 kSourceMismatch = 3,
502 kFlagsMismatch = 5,
503 kChecksumMismatch = 6,
504 kInvalidHeader = 7,
505 kLengthMismatch = 8,
506 kReadOnlySnapshotChecksumMismatch = 9,
507
508 // This should always point at the last real enum value.
509 kLast = kReadOnlySnapshotChecksumMismatch
510 };
511
512 // Check if the CachedData can be loaded in the given isolate.
514
515 // TODO(marja): Async compilation; add constructors which take a callback
516 // which will be called when V8 no longer needs the data.
517 const uint8_t* data;
521
522 // Prevent copying.
523 CachedData(const CachedData&) = delete;
524 CachedData& operator=(const CachedData&) = delete;
525 };
526
528 // V8 did not attempt to find this script in its in-memory cache.
529 kNotAttempted,
530
531 // V8 found a previously compiled copy of this script in its in-memory
532 // cache. Any data generated by a streaming compilation or background
533 // deserialization was abandoned.
534 kHit,
535
536 // V8 didn't have any previously compiled data for this script.
537 kMiss,
538
539 // V8 had some previously compiled data for an identical script, but the
540 // data was incomplete.
541 kPartial,
542 };
543
544 // Details about what happened during a compilation.
546 InMemoryCacheResult in_memory_cache_result =
547 InMemoryCacheResult::kNotAttempted;
548
549 static constexpr int64_t kTimeNotMeasured = -1;
550 int64_t foreground_time_in_microseconds = kTimeNotMeasured;
551 int64_t background_time_in_microseconds = kTimeNotMeasured;
552 };
553
557 class Source {
558 public:
559 // Source takes ownership of both CachedData and CodeCacheConsumeTask.
560 // The caller *must* ensure that the cached data is from a trusted source.
561 V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
562 CachedData* cached_data = nullptr,
563 ConsumeCodeCacheTask* consume_cache_task = nullptr);
564 // Source takes ownership of both CachedData and CodeCacheConsumeTask.
565 V8_INLINE explicit Source(
566 Local<String> source_string, CachedData* cached_data = nullptr,
567 ConsumeCodeCacheTask* consume_cache_task = nullptr);
568 V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
569 CompileHintCallback callback, void* callback_data);
570 V8_INLINE ~Source() = default;
571
572 // Ownership of the CachedData or its buffers is *not* transferred to the
573 // caller. The CachedData object is alive as long as the Source object is
574 // alive.
575 V8_INLINE const CachedData* GetCachedData() const;
576
577 V8_INLINE const ScriptOriginOptions& GetResourceOptions() const;
578
579 V8_INLINE const CompilationDetails& GetCompilationDetails() const;
580
581 private:
582 friend class ScriptCompiler;
583
584 Local<String> source_string;
585
586 // Origin information
587 Local<Value> resource_name;
588 int resource_line_offset = -1;
589 int resource_column_offset = -1;
590 ScriptOriginOptions resource_options;
591 Local<Value> source_map_url;
592 Local<Data> host_defined_options;
593
594 // Cached data from previous compilation (if a kConsume*Cache flag is
595 // set), or hold newly generated cache data (kProduce*Cache flags) are
596 // set when calling a compile method.
597 std::unique_ptr<CachedData> cached_data;
598 std::unique_ptr<ConsumeCodeCacheTask> consume_cache_task;
599
600 // For requesting compile hints from the embedder.
601 CompileHintCallback compile_hint_callback = nullptr;
602 void* compile_hint_callback_data = nullptr;
603
604 // V8 writes this data and never reads it. It exists only to be informative
605 // to the embedder.
606 CompilationDetails compilation_details;
607 };
608
610 public:
611 virtual ~ExternalSourceStreamBase() = default;
612 };
613
619 public:
620 ~ExternalSourceStream() override = default;
621
643 virtual size_t GetMoreData(const uint8_t** src) = 0;
644 };
645
656 : public ExternalSourceStreamBase {
657 public:
658 enum class ChunkEncoding { kOneByte, kTwoByte };
659
660 ~FlexibleExternalSourceStream() override = default;
661
662 struct Chunk {
663 Chunk(const uint8_t* data, size_t position, size_t length_in_characters,
664 ChunkEncoding encoding)
665 : data(data),
666 position(position),
667 length_in_characters(length_in_characters),
668 encoding(encoding) {}
669 Chunk() : Chunk(nullptr, 0, 0, ChunkEncoding::kOneByte) {}
670
671 size_t end_position() const { return position + length_in_characters; }
672
673 const uint8_t* data;
674 size_t position;
677 };
678
686 virtual Chunk GetNextChunk() = 0;
687 };
688
696 public:
697 enum Encoding { ONE_BYTE, TWO_BYTE, UTF8, WINDOWS_1252, FLEXIBLE_UTF16 };
698
699 StreamedSource(std::unique_ptr<ExternalSourceStream> source_stream,
700 Encoding encoding);
702 std::unique_ptr<FlexibleExternalSourceStream> source_stream);
704
705 internal::ScriptStreamingData* impl() const { return impl_.get(); }
706
707 // Prevent copying.
710
711 CompilationDetails& compilation_details() { return compilation_details_; }
712
713 private:
714 std::unique_ptr<internal::ScriptStreamingData> impl_;
715
716 // V8 writes this data and never reads it. It exists only to be informative
717 // to the embedder.
718 CompilationDetails compilation_details_;
719 };
720
726 public:
727 void Run();
728
729 private:
730 friend class ScriptCompiler;
731
732 explicit ScriptStreamingTask(internal::ScriptStreamingData* data)
733 : data_(data) {}
734
735 internal::ScriptStreamingData* data_;
736 };
737
744 public:
746
747 void Run();
748
762 void SourceTextAvailable(Isolate* isolate, Local<String> source_text,
763 const ScriptOrigin& origin);
764
771
778
779 private:
780 friend class ScriptCompiler;
781
782 explicit ConsumeCodeCacheTask(
783 std::unique_ptr<internal::BackgroundDeserializeTask> impl);
784
785 std::unique_ptr<internal::BackgroundDeserializeTask> impl_;
786 };
787
789 kNoCompileOptions = 0,
790 kConsumeCodeCache = 1 << 0,
791 kEagerCompile = 1 << 1,
792 kProduceCompileHints = 1 << 2,
793 kConsumeCompileHints = 1 << 3,
794 kFollowCompileHintsMagicComment = 1 << 4,
795 kFollowCompileHintsPerFunctionMagicComment = 1 << 5,
796 };
797
798 static inline bool CompileOptionsIsValid(CompileOptions compile_options) {
799 // kConsumeCodeCache is mutually exclusive with all other flag bits.
800 if ((compile_options & kConsumeCodeCache) &&
801 compile_options != kConsumeCodeCache) {
802 return false;
803 }
804 // kEagerCompile is mutually exclusive with all other flag bits.
805 if ((compile_options & kEagerCompile) && compile_options != kEagerCompile) {
806 return false;
807 }
808 // We don't currently support producing and consuming compile hints at the
809 // same time.
810 constexpr int produce_and_consume = CompileOptions::kProduceCompileHints |
811 CompileOptions::kConsumeCompileHints;
812 if ((compile_options & produce_and_consume) == produce_and_consume) {
813 return false;
814 }
815 return true;
816 }
817
822 kNoCacheNoReason = 0,
839 };
840
856 Isolate* isolate, Source* source,
857 CompileOptions options = kNoCompileOptions,
858 NoCacheReason no_cache_reason = kNoCacheNoReason);
859
872 Local<Context> context, Source* source,
873 CompileOptions options = kNoCompileOptions,
874 NoCacheReason no_cache_reason = kNoCacheNoReason);
875
888 Isolate* isolate, StreamedSource* source,
889 ScriptType type = ScriptType::kClassic,
890 CompileOptions options = kNoCompileOptions,
891 CompileHintCallback compile_hint_callback = nullptr,
892 void* compile_hint_callback_data = nullptr);
893
895 Isolate* isolate, std::unique_ptr<CachedData> source);
897 Isolate* isolate, std::unique_ptr<CachedData> source);
898
907 Local<Context> context, StreamedSource* source,
908 Local<String> full_source_string, const ScriptOrigin& origin);
909
928 static uint32_t CachedDataVersionTag();
929
938 Isolate* isolate, Source* source,
939 CompileOptions options = kNoCompileOptions,
940 NoCacheReason no_cache_reason = kNoCacheNoReason);
941
950 Local<Context> context, StreamedSource* v8_source,
951 Local<String> full_source_string, const ScriptOrigin& origin);
952
964 Local<Context> context, Source* source, size_t arguments_count = 0,
965 Local<String> arguments[] = nullptr, size_t context_extension_count = 0,
966 Local<Object> context_extensions[] = nullptr,
967 CompileOptions options = kNoCompileOptions,
968 NoCacheReason no_cache_reason = kNoCacheNoReason);
969
976
983 Local<UnboundModuleScript> unbound_module_script);
984
992
993 private:
994 static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
995 Isolate* isolate, Source* source, CompileOptions options,
996 NoCacheReason no_cache_reason);
997
998 static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInternal(
999 Local<Context> context, Source* source, size_t arguments_count,
1000 Local<String> arguments[], size_t context_extension_count,
1001 Local<Object> context_extensions[], CompileOptions options,
1002 NoCacheReason no_cache_reason,
1003 Local<ScriptOrModule>* script_or_module_out);
1004};
1005
1006ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
1007 CachedData* data,
1008 ConsumeCodeCacheTask* consume_cache_task)
1009 : source_string(string),
1010 resource_name(origin.ResourceName()),
1011 resource_line_offset(origin.LineOffset()),
1012 resource_column_offset(origin.ColumnOffset()),
1013 resource_options(origin.Options()),
1014 source_map_url(origin.SourceMapUrl()),
1015 host_defined_options(origin.GetHostDefinedOptions()),
1016 cached_data(data),
1017 consume_cache_task(consume_cache_task) {}
1018
1020 ConsumeCodeCacheTask* consume_cache_task)
1021 : source_string(string),
1022 cached_data(data),
1023 consume_cache_task(consume_cache_task) {}
1024
1026 CompileHintCallback callback,
1027 void* callback_data)
1028 : source_string(string),
1029 resource_name(origin.ResourceName()),
1030 resource_line_offset(origin.LineOffset()),
1031 resource_column_offset(origin.ColumnOffset()),
1032 resource_options(origin.Options()),
1033 source_map_url(origin.SourceMapUrl()),
1034 host_defined_options(origin.GetHostDefinedOptions()),
1035 compile_hint_callback(callback),
1036 compile_hint_callback_data(callback_data) {}
1037
1039 const {
1040 return cached_data.get();
1041}
1042
1044 return resource_options;
1045}
1046
1049 return compilation_details;
1050}
1051
1053#ifdef V8_ENABLE_CHECKS
1054 CheckCast(data);
1055#endif
1056 return reinterpret_cast<ModuleRequest*>(data);
1057}
1058
1060#ifdef V8_ENABLE_CHECKS
1061 CheckCast(data);
1062#endif
1063 return reinterpret_cast<Module*>(data);
1064}
1065
1066} // namespace v8
1067
1068#endif // INCLUDE_V8_SCRIPT_H_
Definition: v8-script.h:401
std::vector< int > GetCompileHints(Isolate *isolate) const
Definition: v8-data.h:18
Definition: v8-data.h:77
Definition: v8-isolate.h:292
Definition: v8-local-handle.h:594
Definition: v8-local-handle.h:366
Definition: v8-script.h:127
int GetLineNumber()
Definition: v8-script.h:129
Location(int line_number, int column_number)
Definition: v8-script.h:132
int GetColumnNumber()
Definition: v8-script.h:130
Definition: v8-local-handle.h:734
Definition: v8-maybe.h:39
Definition: v8-script.h:140
static ModuleRequest * Cast(Data *data)
Definition: v8-script.h:1052
Local< FixedArray > GetImportAttributes() const
Local< String > GetSpecifier() const
ModuleImportPhase GetPhase() const
int GetSourceOffset() const
Definition: v8-script.h:187
Local< Value > GetResourceName() const
Location SourceOffsetToLocation(int offset) const
MaybeLocal< Value > Evaluate(Local< Context > context)
MaybeLocal< Value > EvaluateForImportDefer(Local< Context > context)
Maybe< bool > InstantiateModule(Local< Context > context, ResolveModuleByIndexCallback module_callback, ResolveSourceByIndexCallback source_callback=nullptr)
Maybe< bool > SetSyntheticModuleExport(Isolate *isolate, Local< String > export_name, Local< Value > export_value)
Local< FixedArray > GetModuleRequests() const
bool IsGraphAsync() const
bool HasTopLevelAwait() const
int ScriptId() const
Status GetStatus() const
bool IsSyntheticModule() const
Local< Value > GetException() const
static Local< Module > CreateSyntheticModule(Isolate *isolate, Local< String > module_name, const std::span< const Local< String > > &export_names, SyntheticModuleEvaluationSteps evaluation_steps, Local< Data > host_defined_options=Local< Data >())
std::pair< LocalVector< Module >, LocalVector< Message > > GetStalledTopLevelAwaitMessages(Isolate *isolate)
Status
Definition: v8-script.h:196
@ kInstantiating
Definition: v8-script.h:198
@ kInstantiated
Definition: v8-script.h:199
@ kUninstantiated
Definition: v8-script.h:197
@ kEvaluating
Definition: v8-script.h:200
@ kEvaluated
Definition: v8-script.h:201
int GetIdentityHash() const
Local< UnboundModuleScript > GetUnboundModuleScript()
Local< Value > GetModuleNamespace(v8::ModuleImportPhase phase=v8::ModuleImportPhase::kEvaluation)
static Module * Cast(Data *data)
Definition: v8-script.h:1059
Maybe< bool > InstantiateModule(Local< Context > context, ResolveModuleCallback module_callback, ResolveSourceCallback source_callback=nullptr)
bool IsSourceTextModule() const
Local< Data > GetSyntheticModuleHostDefinedOptions() const
Definition: v8-script.h:743
void SourceTextAvailable(Isolate *isolate, Local< String > source_text, const ScriptOrigin &origin)
Definition: v8-script.h:618
virtual size_t GetMoreData(const uint8_t **src)=0
Definition: v8-script.h:725
Definition: v8-script.h:557
Source(Local< String > source_string, const ScriptOrigin &origin, CachedData *cached_data=nullptr, ConsumeCodeCacheTask *consume_cache_task=nullptr)
Definition: v8-script.h:1006
const CompilationDetails & GetCompilationDetails() const
Definition: v8-script.h:1048
const CachedData * GetCachedData() const
Definition: v8-script.h:1038
const ScriptOriginOptions & GetResourceOptions() const
Definition: v8-script.h:1043
Definition: v8-script.h:695
internal::ScriptStreamingData * impl() const
Definition: v8-script.h:705
Encoding
Definition: v8-script.h:697
CompilationDetails & compilation_details()
Definition: v8-script.h:711
StreamedSource & operator=(const StreamedSource &)=delete
StreamedSource(const StreamedSource &)=delete
StreamedSource(std::unique_ptr< FlexibleExternalSourceStream > source_stream)
StreamedSource(std::unique_ptr< ExternalSourceStream > source_stream, Encoding encoding)
Definition: v8-script.h:467
static CachedData * CreateCodeCacheForFunction(Local< Function > function)
static 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)
InMemoryCacheResult
Definition: v8-script.h:527
static bool CompileOptionsIsValid(CompileOptions compile_options)
Definition: v8-script.h:798
static CachedData * CreateCodeCache(Local< UnboundModuleScript > unbound_module_script)
NoCacheReason
Definition: v8-script.h:821
@ kNoCacheBecausePacScript
Definition: v8-script.h:833
@ kNoCacheBecauseV8Extension
Definition: v8-script.h:831
@ kNoCacheBecauseStreamingSource
Definition: v8-script.h:827
@ kNoCacheBecauseNoResource
Definition: v8-script.h:824
@ kNoCacheBecauseInlineScriptCacheTooCold
Definition: v8-script.h:838
@ kNoCacheBecauseStaticCodeCache
Definition: v8-script.h:837
@ kNoCacheBecauseInspector
Definition: v8-script.h:828
@ kNoCacheBecauseCacheTooCold
Definition: v8-script.h:830
@ kNoCacheBecauseScriptTooSmall
Definition: v8-script.h:829
@ kNoCacheBecauseCachingDisabled
Definition: v8-script.h:823
@ kNoCacheBecauseDeferredProduceCodeCache
Definition: v8-script.h:836
@ kNoCacheBecauseExtensionModule
Definition: v8-script.h:832
@ kNoCacheBecauseInlineScript
Definition: v8-script.h:825
@ kNoCacheBecauseInDocumentWrite
Definition: v8-script.h:834
@ kNoCacheBecauseModule
Definition: v8-script.h:826
@ kNoCacheBecauseResourceWithNoCacheHandler
Definition: v8-script.h:835
static ConsumeCodeCacheTask * StartConsumingCodeCacheOnBackground(Isolate *isolate, std::unique_ptr< CachedData > source)
static CachedData * CreateCodeCache(Local< UnboundScript > unbound_script)
static MaybeLocal< Module > CompileModule(Local< Context > context, StreamedSource *v8_source, Local< String > full_source_string, const ScriptOrigin &origin)
CompileOptions
Definition: v8-script.h:788
static MaybeLocal< Script > Compile(Local< Context > context, StreamedSource *source, Local< String > full_source_string, const ScriptOrigin &origin)
static MaybeLocal< Script > Compile(Local< Context > context, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
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 uint32_t CachedDataVersionTag()
static MaybeLocal< UnboundScript > CompileUnboundScript(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static ConsumeCodeCacheTask * StartConsumingCodeCache(Isolate *isolate, std::unique_ptr< CachedData > source)
static MaybeLocal< Module > CompileModule(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
Definition: v8-script.h:42
Local< Value > GetResourceName()
Local< Data > HostDefinedOptions()
Definition: v8-message.h:29
Definition: v8-message.h:63
Definition: v8-script.h:413
static MaybeLocal< Script > Compile(Local< Context > context, Local< String > source, ScriptOrigin *origin=nullptr)
MaybeLocal< Value > Run(Local< Context > context)
Local< UnboundScript > GetUnboundScript()
int ScriptId() const
MaybeLocal< Value > Run(Local< Context > context, Local< Data > host_defined_options)
Local< Value > GetResourceName()
Definition: v8-script.h:103
Local< Value > GetSourceURL()
Local< Value > GetSourceMappingURL()
Definition: v8-script.h:60
int ScriptId() const
Local< Script > BindToCurrentContext()
Definition: v8-value.h:32
Definition: libplatform.h:15
bool(*)(int, void *) CompileHintCallback
Definition: v8-callbacks.h:435
ModuleImportPhase
Definition: v8-callbacks.h:352
ScriptType
Definition: v8-script.h:462
Definition: v8-script.h:478
BufferPolicy buffer_policy
Definition: v8-script.h:520
const uint8_t * data
Definition: v8-script.h:517
CachedData(const CachedData &)=delete
CompatibilityCheckResult
Definition: v8-script.h:495
bool rejected
Definition: v8-script.h:519
CachedData(const uint8_t *data, int length, BufferPolicy buffer_policy=BufferNotOwned)
BufferPolicy
Definition: v8-script.h:479
@ BufferNotOwned
Definition: v8-script.h:479
CachedData()
Definition: v8-script.h:481
int length
Definition: v8-script.h:518
CompatibilityCheckResult CompatibilityCheck(Isolate *isolate)
CachedData & operator=(const CachedData &)=delete
Definition: v8-script.h:545
const uint8_t * data
Definition: v8-script.h:673
size_t length_in_characters
Definition: v8-script.h:675
ChunkEncoding encoding
Definition: v8-script.h:676
Chunk(const uint8_t *data, size_t position, size_t length_in_characters, ChunkEncoding encoding)
Definition: v8-script.h:663
size_t end_position() const
Definition: v8-script.h:671
#define V8_EXPORT
Definition: v8config.h:867
#define V8_INLINE
Definition: v8config.h:511
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:624
#define V8_DEPRECATED(message)
Definition: v8config.h:616
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:681