[api] Rename isolate variables

* Prefix all isolate variables with i_ for i::Isolate and
  v8_ for v8::Isolate
* Change _DO_NOT_USE macro suffix to _INTERNAL

Change-Id: I005efbe0192cf202741448c63a4263e6a4b1fa1b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610429
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80252}
This commit is contained in:
Camillo Bruni 2022-04-27 20:52:38 +02:00 committed by V8 LUCI CQ
parent a6b8d064cc
commit 759e841a05
18 changed files with 1783 additions and 1728 deletions

View File

@ -205,10 +205,10 @@ class V8_EXPORT EmbedderHeapTracer {
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it
* is not attached to any v8::Isolate.
*/
v8::Isolate* isolate() const { return isolate_; }
v8::Isolate* isolate() const { return v8_isolate_; }
protected:
v8::Isolate* isolate_ = nullptr;
v8::Isolate* v8_isolate_ = nullptr;
friend class internal::LocalEmbedderHeapTracer;
};

View File

@ -197,7 +197,7 @@ class V8_EXPORT TryCatch {
void ResetInternal();
internal::Isolate* isolate_;
internal::Isolate* i_isolate_;
TryCatch* next_;
void* exception_;
void* message_obj_;

View File

@ -301,16 +301,18 @@ class V8_EXPORT Isolate {
*/
class V8_EXPORT V8_NODISCARD Scope {
public:
explicit Scope(Isolate* isolate) : isolate_(isolate) { isolate->Enter(); }
explicit Scope(Isolate* isolate) : v8_isolate_(isolate) {
v8_isolate_->Enter();
}
~Scope() { isolate_->Exit(); }
~Scope() { v8_isolate_->Exit(); }
// Prevent copying of Scope objects.
Scope(const Scope&) = delete;
Scope& operator=(const Scope&) = delete;
private:
Isolate* const isolate_;
Isolate* const v8_isolate_;
};
/**
@ -331,7 +333,7 @@ class V8_EXPORT Isolate {
private:
OnFailure on_failure_;
Isolate* isolate_;
v8::Isolate* v8_isolate_;
bool was_execution_allowed_assert_;
bool was_execution_allowed_throws_;
@ -353,7 +355,7 @@ class V8_EXPORT Isolate {
const AllowJavascriptExecutionScope&) = delete;
private:
Isolate* isolate_;
Isolate* v8_isolate_;
bool was_execution_allowed_assert_;
bool was_execution_allowed_throws_;
bool was_execution_allowed_dump_;
@ -376,7 +378,7 @@ class V8_EXPORT Isolate {
const SuppressMicrotaskExecutionScope&) = delete;
private:
internal::Isolate* const isolate_;
internal::Isolate* const i_isolate_;
internal::MicrotaskQueue* const microtask_queue_;
internal::Address previous_stack_height_;
@ -389,7 +391,7 @@ class V8_EXPORT Isolate {
*/
class V8_EXPORT V8_NODISCARD SafeForTerminationScope {
public:
explicit SafeForTerminationScope(v8::Isolate* isolate);
explicit SafeForTerminationScope(v8::Isolate* v8_isolate);
~SafeForTerminationScope();
// Prevent copying of Scope objects.
@ -397,7 +399,7 @@ class V8_EXPORT Isolate {
SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;
private:
internal::Isolate* isolate_;
internal::Isolate* i_isolate_;
bool prev_value_;
};

View File

@ -86,7 +86,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
static int NumberOfHandles(Isolate* isolate);
V8_INLINE Isolate* GetIsolate() const {
return reinterpret_cast<Isolate*>(isolate_);
return reinterpret_cast<Isolate*>(i_isolate_);
}
HandleScope(const HandleScope&) = delete;
@ -97,7 +97,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
void Initialize(Isolate* isolate);
static internal::Address* CreateHandle(internal::Isolate* isolate,
static internal::Address* CreateHandle(internal::Isolate* i_isolate,
internal::Address value);
private:
@ -108,7 +108,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
void operator delete(void*, size_t);
void operator delete[](void*, size_t);
internal::Isolate* isolate_;
internal::Isolate* i_isolate_;
internal::Address* prev_next_;
internal::Address* prev_limit_;
@ -445,7 +445,7 @@ class V8_EXPORT V8_NODISCARD SealHandleScope {
void operator delete(void*, size_t);
void operator delete[](void*, size_t);
internal::Isolate* const isolate_;
internal::Isolate* const i_isolate_;
internal::Address* prev_limit_;
int prev_sealed_level_;
};

View File

@ -70,7 +70,7 @@ class V8_EXPORT ScriptOrigin {
bool resource_is_opaque = false, bool is_wasm = false,
bool is_module = false,
Local<Data> host_defined_options = Local<Data>())
: isolate_(isolate),
: v8_isolate_(isolate),
resource_name_(resource_name),
resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset),
@ -94,7 +94,7 @@ class V8_EXPORT ScriptOrigin {
private:
void VerifyHostDefinedOptions() const;
Isolate* isolate_;
Isolate* v8_isolate_;
Local<Value> resource_name_;
int resource_line_offset_;
int resource_column_offset_;

View File

@ -142,7 +142,7 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope {
MicrotasksScope& operator=(const MicrotasksScope&) = delete;
private:
internal::Isolate* const isolate_;
internal::Isolate* const i_isolate_;
internal::MicrotaskQueue* const microtask_queue_;
bool run_;
};

View File

@ -235,7 +235,7 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
const WasmModuleObjectBuilderStreaming&) = delete;
WasmModuleObjectBuilderStreaming& operator=(
WasmModuleObjectBuilderStreaming&&) = default;
Isolate* isolate_ = nullptr;
Isolate* v8_isolate_ = nullptr;
#if V8_CC_MSVC
/**

View File

@ -233,14 +233,6 @@ class V8_NODISCARD InternalEscapableScope : public EscapableHandleScope {
: EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {}
};
inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) {
if (isolate->has_scheduled_exception()) {
return isolate->scheduled_exception() ==
i::ReadOnlyRoots(isolate).termination_exception();
}
return false;
}
template <typename T>
void CopySmiElementsToTypedBuffer(T* dst, uint32_t length,
i::FixedArray elements) {

View File

@ -5,8 +5,8 @@
// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD
#undef LOG_API
#undef ENTER_V8_DO_NOT_USE
#undef ENTER_V8_HELPER_DO_NOT_USE
#undef ENTER_V8_BASIC
#undef ENTER_V8_HELPER_INTERNAL
#undef PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE
#undef PREPARE_FOR_EXECUTION_WITH_CONTEXT
#undef PREPARE_FOR_EXECUTION

View File

@ -35,98 +35,99 @@
* TODO(verwaest): Remove calls form API methods to DO_NOT_USE macros.
*/
#define API_RCS_SCOPE(isolate, class_name, function_name) \
RCS_SCOPE(isolate, \
#define API_RCS_SCOPE(i_isolate, class_name, function_name) \
RCS_SCOPE(i_isolate, \
i::RuntimeCallCounterId::kAPI_##class_name##_##function_name);
#define ENTER_V8_DO_NOT_USE(isolate) i::VMState<v8::OTHER> __state__((isolate))
#define ENTER_V8_BASIC(i_isolate) i::VMState<v8::OTHER> __state__((i_isolate))
#define ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, \
function_name, bailout_value, \
HandleScopeClass, do_callback) \
if (IsExecutionTerminatingCheck(isolate)) { \
return bailout_value; \
} \
HandleScopeClass handle_scope(isolate); \
CallDepthScope<do_callback> call_depth_scope(isolate, context); \
API_RCS_SCOPE(isolate, class_name, function_name); \
i::VMState<v8::OTHER> __state__((isolate)); \
#define ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, \
function_name, bailout_value, \
HandleScopeClass, do_callback) \
if (i_isolate->is_execution_terminating()) { \
return bailout_value; \
} \
HandleScopeClass handle_scope(i_isolate); \
CallDepthScope<do_callback> call_depth_scope(i_isolate, context); \
API_RCS_SCOPE(i_isolate, class_name, function_name); \
i::VMState<v8::OTHER> __state__((i_isolate)); \
bool has_pending_exception = false
#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, T) \
if (IsExecutionTerminatingCheck(isolate)) { \
return MaybeLocal<T>(); \
} \
InternalEscapableScope handle_scope(isolate); \
CallDepthScope<false> call_depth_scope(isolate, v8::Local<v8::Context>()); \
i::VMState<v8::OTHER> __state__((isolate)); \
#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, T) \
if (i_isolate->is_execution_terminating()) { \
return MaybeLocal<T>(); \
} \
InternalEscapableScope handle_scope(i_isolate); \
CallDepthScope<false> call_depth_scope(i_isolate, v8::Local<v8::Context>()); \
i::VMState<v8::OTHER> __state__((i_isolate)); \
bool has_pending_exception = false
#define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \
bailout_value, HandleScopeClass, \
do_callback) \
auto isolate = context.IsEmpty() \
? i::Isolate::Current() \
: reinterpret_cast<i::Isolate*>(context->GetIsolate()); \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, do_callback);
auto i_isolate = context.IsEmpty() \
? i::Isolate::Current() \
: reinterpret_cast<i::Isolate*>(context->GetIsolate()); \
ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, do_callback);
#define PREPARE_FOR_EXECUTION(context, class_name, function_name, T) \
PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \
MaybeLocal<T>(), InternalEscapableScope, \
false)
#define ENTER_V8(isolate, context, class_name, function_name, bailout_value, \
HandleScopeClass) \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, true)
#define ENTER_V8(i_isolate, context, class_name, function_name, bailout_value, \
HandleScopeClass) \
ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, true)
#ifdef DEBUG
#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \
#define ENTER_V8_NO_SCRIPT(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass) \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, false); \
i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate))
ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, false); \
i::DisallowJavascriptExecutionDebugOnly __no_script__((i_isolate))
// Lightweight version for APIs that don't require an active context.
#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) \
i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)); \
i::DisallowExceptions __no_exceptions__((isolate))
#define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
i::DisallowJavascriptExecutionDebugOnly __no_script__((i_isolate)); \
i::DisallowExceptions __no_exceptions__((i_isolate))
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \
i::VMState<v8::OTHER> __state__((isolate)); \
ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate)
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
i::VMState<v8::OTHER> __state__((i_isolate)); \
DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate)
#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \
i::VMState<v8::OTHER> __state__((isolate)); \
i::DisallowExceptions __no_exceptions__((isolate))
#else
#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \
#define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \
DCHECK(!(i_isolate)->is_execution_terminating()); \
i::VMState<v8::OTHER> __state__((i_isolate)); \
i::DisallowExceptions __no_exceptions__((i_isolate))
#else // DEBUG
#define ENTER_V8_NO_SCRIPT(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass) \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, false)
ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, false)
#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate)
#define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate)
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \
i::VMState<v8::OTHER> __state__((isolate));
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
i::VMState<v8::OTHER> __state__((i_isolate));
#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \
i::VMState<v8::OTHER> __state__((isolate));
#define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \
i::VMState<v8::OTHER> __state__((i_isolate));
#endif // DEBUG
#define EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, value) \
do { \
if (has_pending_exception) { \
call_depth_scope.Escape(); \
return value; \
} \
#define EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(i_isolate, value) \
do { \
if (has_pending_exception) { \
call_depth_scope.Escape(); \
return value; \
} \
} while (false)
#define RETURN_ON_FAILED_EXECUTION(T) \
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, MaybeLocal<T>())
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(i_isolate, MaybeLocal<T>())
#define RETURN_ON_FAILED_EXECUTION_PRIMITIVE(T) \
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, Nothing<T>())
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(i_isolate, Nothing<T>())
#define RETURN_ESCAPED(value) return handle_scope.Escape(value);

File diff suppressed because it is too large Load Diff

View File

@ -292,11 +292,11 @@ MaybeLocal<Context> GetCreationContext(Local<Object> value) {
}
void ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
internal_isolate->debug()->ChangeBreakOnException(
i::BreakException, type == BreakOnAnyException);
internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException,
type != NoBreakOnException);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i_isolate->debug()->ChangeBreakOnException(i::BreakException,
type == BreakOnAnyException);
i_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException,
type != NoBreakOnException);
}
void SetBreakPointsActive(Isolate* v8_isolate, bool is_active) {
@ -307,7 +307,7 @@ void SetBreakPointsActive(Isolate* v8_isolate, bool is_active) {
void PrepareStep(Isolate* v8_isolate, StepAction action) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_DO_NOT_USE(isolate);
ENTER_V8_BASIC(isolate);
CHECK(isolate->debug()->CheckExecutionState());
// Clear all current stepping setup.
isolate->debug()->ClearStepping();
@ -325,7 +325,7 @@ void ClearStepping(Isolate* v8_isolate) {
void BreakRightNow(Isolate* v8_isolate,
base::EnumSet<debug::BreakReason> break_reasons) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_DO_NOT_USE(isolate);
ENTER_V8_BASIC(isolate);
isolate->debug()->HandleDebugBreak(i::kIgnoreIfAllFramesBlackboxed,
break_reasons);
}
@ -338,7 +338,7 @@ void SetTerminateOnResume(Isolate* v8_isolate) {
bool CanBreakProgram(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_DO_NOT_USE(isolate);
ENTER_V8_BASIC(isolate);
return !isolate->debug()->AllFramesOnStackAreBlackboxed();
}
@ -1036,13 +1036,13 @@ MaybeLocal<Value> CallFunctionOn(Local<Context> context,
MaybeLocal<v8::Value> EvaluateGlobal(v8::Isolate* isolate,
v8::Local<v8::String> source,
EvaluateGlobalMode mode, bool repl) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(internal_isolate, Value);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, Value);
i::REPLMode repl_mode = repl ? i::REPLMode::kYes : i::REPLMode::kNo;
Local<Value> result;
has_pending_exception = !ToLocal<Value>(
i::DebugEvaluate::Global(internal_isolate, Utils::OpenHandle(*source),
mode, repl_mode),
i::DebugEvaluate::Global(i_isolate, Utils::OpenHandle(*source), mode,
repl_mode),
&result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
@ -1051,13 +1051,13 @@ MaybeLocal<v8::Value> EvaluateGlobal(v8::Isolate* isolate,
v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting(
v8::Isolate* isolate, v8::Local<v8::Script> function,
v8::debug::EvaluateGlobalMode mode, bool repl) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(internal_isolate, Value);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, Value);
i::REPLMode repl_mode = repl ? i::REPLMode::kYes : i::REPLMode::kNo;
Local<Value> result;
has_pending_exception = !ToLocal<Value>(
i::DebugEvaluate::Global(internal_isolate, Utils::OpenHandle(*function),
mode, repl_mode),
i::DebugEvaluate::Global(i_isolate, Utils::OpenHandle(*function), mode,
repl_mode),
&result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
@ -1246,12 +1246,12 @@ TypeProfile::ScriptData TypeProfile::GetScriptData(size_t i) const {
MaybeLocal<v8::Value> EphemeronTable::Get(v8::Isolate* isolate,
v8::Local<v8::Value> key) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
auto self = i::Handle<i::EphemeronHashTable>::cast(Utils::OpenHandle(this));
i::Handle<i::Object> internal_key = Utils::OpenHandle(*key);
DCHECK(internal_key->IsJSReceiver());
i::Handle<i::Object> value(self->Lookup(internal_key), internal_isolate);
i::Handle<i::Object> value(self->Lookup(internal_key), i_isolate);
if (value->IsTheHole()) return {};
return Utils::ToLocal(value);
@ -1323,7 +1323,7 @@ std::unique_ptr<PropertyIterator> PropertyIterator::Create(
Local<Context> context, Local<Object> object, bool skip_indices) {
internal::Isolate* isolate =
reinterpret_cast<i::Isolate*>(object->GetIsolate());
if (IsExecutionTerminatingCheck(isolate)) {
if (isolate->is_execution_terminating()) {
return nullptr;
}
CallDepthScope<false> call_depth_scope(isolate, context);
@ -1342,7 +1342,7 @@ std::unique_ptr<PropertyIterator> PropertyIterator::Create(
namespace internal {
Maybe<bool> DebugPropertyIterator::Advance() {
if (IsExecutionTerminatingCheck(isolate_)) {
if (isolate_->is_execution_terminating()) {
return Nothing<bool>();
}
Local<v8::Context> context =

View File

@ -130,6 +130,11 @@ bool Isolate::is_catchable_by_wasm(Object exception) {
return !JSReceiver::HasProperty(&it).FromJust();
}
bool Isolate::is_execution_terminating() {
return thread_local_top()->scheduled_exception_ ==
i::ReadOnlyRoots(this).termination_exception();
}
void Isolate::FireBeforeCallEnteredCallback() {
for (auto& callback : before_call_entered_callbacks_) {
callback(reinterpret_cast<v8::Isolate*>(this));

View File

@ -810,6 +810,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
inline bool is_catchable_by_javascript(Object exception);
inline bool is_catchable_by_wasm(Object exception);
inline bool is_execution_terminating();
// JS execution stack (see frames.h).
static Address c_entry_fp(ThreadLocalTop* thread) {

View File

@ -52,8 +52,8 @@ void Locker::Initialize(v8::Isolate* isolate) {
bool Locker::IsLocked(v8::Isolate* isolate) {
DCHECK_NOT_NULL(isolate);
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
return internal_isolate->thread_manager()->IsLockedByCurrentThread();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
return i_isolate->thread_manager()->IsLockedByCurrentThread();
}
// static

View File

@ -16,12 +16,12 @@ namespace internal {
void LocalEmbedderHeapTracer::SetRemoteTracer(EmbedderHeapTracer* tracer) {
CHECK_NULL(cpp_heap_);
if (remote_tracer_) remote_tracer_->isolate_ = nullptr;
if (remote_tracer_) remote_tracer_->v8_isolate_ = nullptr;
remote_tracer_ = tracer;
default_embedder_roots_handler_.SetTracer(tracer);
if (remote_tracer_)
remote_tracer_->isolate_ = reinterpret_cast<v8::Isolate*>(isolate_);
remote_tracer_->v8_isolate_ = reinterpret_cast<v8::Isolate*>(isolate_);
}
void LocalEmbedderHeapTracer::SetCppHeap(CppHeap* cpp_heap) {

View File

@ -87,7 +87,7 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
explicit LocalEmbedderHeapTracer(Isolate* isolate) : isolate_(isolate) {}
~LocalEmbedderHeapTracer() {
if (remote_tracer_) remote_tracer_->isolate_ = nullptr;
if (remote_tracer_) remote_tracer_->v8_isolate_ = nullptr;
// CppHeap is not detached from Isolate here. Detaching is done explciitly
// on Isolate/Heap/CppHeap destruction.
}

View File

@ -205,23 +205,22 @@ static StartupBlobs Serialize(v8::Isolate* isolate) {
v8::Context::New(isolate);
}
Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate);
internal_isolate->heap()->CollectAllAvailableGarbage(
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
i_isolate->heap()->CollectAllAvailableGarbage(
i::GarbageCollectionReason::kTesting);
SafepointScope safepoint(internal_isolate->heap());
HandleScope scope(internal_isolate);
SafepointScope safepoint(i_isolate->heap());
HandleScope scope(i_isolate);
DisallowGarbageCollection no_gc;
ReadOnlySerializer read_only_serializer(internal_isolate,
ReadOnlySerializer read_only_serializer(i_isolate,
Snapshot::kDefaultSerializerFlags);
read_only_serializer.SerializeReadOnlyRoots();
SharedHeapSerializer shared_space_serializer(
internal_isolate, Snapshot::kDefaultSerializerFlags,
&read_only_serializer);
i_isolate, Snapshot::kDefaultSerializerFlags, &read_only_serializer);
StartupSerializer ser(internal_isolate, Snapshot::kDefaultSerializerFlags,
StartupSerializer ser(i_isolate, Snapshot::kDefaultSerializerFlags,
&read_only_serializer, &shared_space_serializer);
ser.SerializeStrongReferences(no_gc);