5#ifndef INCLUDE_V8_CONTEXT_H_
6#define INCLUDE_V8_CONTEXT_H_
34 : name_count_(name_count), names_(names) {}
36 const char**
begin()
const {
return &names_[0]; }
37 const char**
end()
const {
return &names_[name_count_]; }
40 const int name_count_;
164 Isolate* isolate,
size_t context_snapshot_index,
317 V8_INLINE void* GetAlignedPointerFromEmbedderData(
Isolate* isolate,
int index,
319 V8_INLINE void* GetAlignedPointerFromEmbedderData(
int index,
330 return GetAlignedPointerFromEmbedderData(isolate, index,
337 template <
typename T>
452 friend class internal::Isolate;
454 uintptr_t JSStackComparableAddressPrivate()
const {
455 return js_stack_comparable_address_;
459 uintptr_t js_stack_comparable_address_ = 0;
471 static void CheckCast(
Data* obj);
477 void* SlowGetAlignedPointerFromEmbedderData(
int index,
484#ifndef V8_ENABLE_CHECKS
489 I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
491 I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
492 A value = I::ReadRawField<A>(embedder_data, value_offset);
493#ifdef V8_COMPRESS_POINTERS
496 value = I::DecompressTaggedField(embedder_data,
static_cast<uint32_t
>(value));
499 auto* isolate = I::GetCurrentIsolate();
502 return SlowGetEmbedderData(index);
507#ifndef V8_ENABLE_CHECKS
512 I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
514 I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
515 A value = I::ReadRawField<A>(embedder_data, value_offset);
516#ifdef V8_COMPRESS_POINTERS
519 value = I::DecompressTaggedField(embedder_data,
static_cast<uint32_t
>(value));
522 auto* isolate = I::GetCurrentIsolate();
525 return SlowGetEmbedderDataV2(index);
531#if !defined(V8_ENABLE_CHECKS)
536 I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
537 int value_offset = I::kEmbedderDataArrayHeaderSize +
538 (I::kEmbedderDataSlotSize * index) +
539 I::kEmbedderDataSlotExternalPointerOffset;
540 return reinterpret_cast<void*
>(I::ReadExternalPointerField(
543 return SlowGetAlignedPointerFromEmbedderData(index, tag);
549#if !defined(V8_ENABLE_CHECKS)
554 I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
555 int value_offset = I::kEmbedderDataArrayHeaderSize +
556 (I::kEmbedderDataSlotSize * index) +
557 I::kEmbedderDataSlotExternalPointerOffset;
558 Isolate* isolate = I::GetCurrentIsolateForSandbox();
559 return reinterpret_cast<void*
>(I::ReadExternalPointerField(
562 return SlowGetAlignedPointerFromEmbedderData(index, tag);
577#ifdef V8_ENABLE_CHECKS
580 return static_cast<Context*
>(data);
Definition: garbage-collected.h:53
Definition: v8-context.h:442
BackupIncumbentScope(Local< Context > backup_incumbent_context)
Definition: v8-context.h:226
virtual bool FreezeEmbedderObjectAndGetChildren(Local< Object > obj, LocalVector< Object > &children_out)=0
Definition: v8-context.h:426
Scope(Local< Context > context)
Definition: v8-context.h:428
~Scope()
Definition: v8-context.h:431
Definition: v8-context.h:48
Local< Data > GetEmbedderDataV2(int index)
Definition: v8-context.h:506
static MaybeLocal< Object > NewRemoteContext(Isolate *isolate, Local< ObjectTemplate > global_template, MaybeLocal< Value > global_object=MaybeLocal< Value >())
void SetErrorMessageForWasmCodeGeneration(Local< String > message)
void SetPromiseHooks(Local< Function > init_hook, Local< Function > before_hook, Local< Function > after_hook, Local< Function > resolve_hook)
void SetSecurityToken(Local< Value > token)
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=nullptr, MaybeLocal< ObjectTemplate > global_template=MaybeLocal< ObjectTemplate >(), MaybeLocal< Value > global_object=MaybeLocal< Value >(), DeserializeInternalFieldsCallback internal_fields_deserializer=DeserializeInternalFieldsCallback(), MicrotaskQueue *microtask_queue=nullptr, DeserializeContextDataCallback context_data_deserializer=DeserializeContextDataCallback(), DeserializeAPIWrapperCallback api_wrapper_deserializer=DeserializeAPIWrapperCallback())
void SetTemporalHostSystemUTCEpochNanosecondsCallback(TemporalHostSystemUTCEpochNanosecondsCallback callback)
bool IsCodeGenerationFromStringsAllowed() const
static Context * Cast(Data *data)
Definition: v8-context.h:576
MicrotaskQueue * GetMicrotaskQueue()
void SetAbortScriptExecution(AbortScriptExecutionCallback callback)
Maybe< void > DeepFreeze(DeepFreezeDelegate *delegate=nullptr)
bool HasTemplateLiteralObject(Local< Value > object)
void AllowCodeGenerationFromStrings(bool allow)
Local< Value > GetSecurityToken()
MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
Definition: v8-context.h:567
void SetErrorMessageForCodeGenerationFromStrings(Local< String > message)
EmbedderDataFields
Definition: v8-context.h:268
uint32_t GetNumberOfEmbedderDataFields()
Local< Value > GetEmbedderData(int index)
Definition: v8-context.h:483
void SetMicrotaskQueue(MicrotaskQueue *queue)
void UseDefaultSecurityToken()
void * GetAlignedPointerFromEmbedderData(Isolate *isolate, int index, EmbedderDataTypeTag tag)
Definition: v8-context.h:529
void(*)(Isolate *isolate, Local< Context > context) AbortScriptExecutionCallback
Definition: v8-context.h:399
static MaybeLocal< Context > FromSnapshot(Isolate *isolate, size_t context_snapshot_index, DeserializeInternalFieldsCallback internal_fields_deserializer=DeserializeInternalFieldsCallback(), ExtensionConfiguration *extensions=nullptr, MaybeLocal< Value > global_object=MaybeLocal< Value >(), MicrotaskQueue *microtask_queue=nullptr, DeserializeContextDataCallback context_data_deserializer=DeserializeContextDataCallback(), DeserializeAPIWrapperCallback api_wrapper_deserializer=DeserializeAPIWrapperCallback())
void SetAlignedPointerInEmbedderData(int index, cppgc::GarbageCollected< T > *value, CppHeapPointerTag tag)
Definition: v8-context.h:338
int64_t(*)(Local< Context > context) TemporalHostSystemUTCEpochNanosecondsCallback
Definition: v8-context.h:406
void SetEmbedderDataV2(int index, Local< Data > value)
void SetAlignedPointerInEmbedderData(int index, void *value, EmbedderDataTypeTag tag)
Definition: v8-context.h:30
ExtensionConfiguration(int name_count, const char *names[])
Definition: v8-context.h:33
ExtensionConfiguration()
Definition: v8-context.h:32
const char ** begin() const
Definition: v8-context.h:36
const char ** end() const
Definition: v8-context.h:37
Definition: v8-function.h:27
Definition: v8-isolate.h:292
Definition: v8-local-handle.h:594
Definition: v8-local-handle.h:366
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:448
Definition: v8-local-handle.h:734
Definition: v8-maybe.h:39
Definition: v8-microtask-queue.h:51
Definition: v8-object.h:266
Definition: v8-script.h:415
Definition: v8-value.h:32
Definition: v8-internal.h:975
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1853
internal::Address * InternalRepresentationType
Definition: v8-internal.h:1807
static constexpr InternalRepresentationType kEmpty
Definition: v8-internal.h:1808
uintptr_t Address
Definition: v8-internal.h:38
void PerformCastCheck(T *data)
Definition: v8-internal.h:1568
Definition: libplatform.h:15
internal::ExternalPointerTag ToExternalPointerTag(v8::EmbedderDataTypeTag api_tag)
CppHeapPointerTag
Definition: v8-sandbox.h:28
constexpr EmbedderDataTypeTag kEmbedderDataTypeTagDefault
Definition: v8-object.h:36
uint16_t EmbedderDataTypeTag
Definition: v8-object.h:34
Definition: v8-snapshot.h:116
Definition: v8-snapshot.h:106
Definition: v8-snapshot.h:91
#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_NODISCARD
Definition: v8config.h:703