Commit 759e841a authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[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: 's avatarAnton Bikineev <bikineev@chromium.org>
Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80252}
parent a6b8d064
...@@ -205,10 +205,10 @@ class V8_EXPORT EmbedderHeapTracer { ...@@ -205,10 +205,10 @@ class V8_EXPORT EmbedderHeapTracer {
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it * Returns the v8::Isolate this tracer is attached too and |nullptr| if it
* is not attached to any v8::Isolate. * is not attached to any v8::Isolate.
*/ */
v8::Isolate* isolate() const { return isolate_; } v8::Isolate* isolate() const { return v8_isolate_; }
protected: protected:
v8::Isolate* isolate_ = nullptr; v8::Isolate* v8_isolate_ = nullptr;
friend class internal::LocalEmbedderHeapTracer; friend class internal::LocalEmbedderHeapTracer;
}; };
......
...@@ -197,7 +197,7 @@ class V8_EXPORT TryCatch { ...@@ -197,7 +197,7 @@ class V8_EXPORT TryCatch {
void ResetInternal(); void ResetInternal();
internal::Isolate* isolate_; internal::Isolate* i_isolate_;
TryCatch* next_; TryCatch* next_;
void* exception_; void* exception_;
void* message_obj_; void* message_obj_;
......
...@@ -301,16 +301,18 @@ class V8_EXPORT Isolate { ...@@ -301,16 +301,18 @@ class V8_EXPORT Isolate {
*/ */
class V8_EXPORT V8_NODISCARD Scope { class V8_EXPORT V8_NODISCARD Scope {
public: 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. // Prevent copying of Scope objects.
Scope(const Scope&) = delete; Scope(const Scope&) = delete;
Scope& operator=(const Scope&) = delete; Scope& operator=(const Scope&) = delete;
private: private:
Isolate* const isolate_; Isolate* const v8_isolate_;
}; };
/** /**
...@@ -331,7 +333,7 @@ class V8_EXPORT Isolate { ...@@ -331,7 +333,7 @@ class V8_EXPORT Isolate {
private: private:
OnFailure on_failure_; OnFailure on_failure_;
Isolate* isolate_; v8::Isolate* v8_isolate_;
bool was_execution_allowed_assert_; bool was_execution_allowed_assert_;
bool was_execution_allowed_throws_; bool was_execution_allowed_throws_;
...@@ -353,7 +355,7 @@ class V8_EXPORT Isolate { ...@@ -353,7 +355,7 @@ class V8_EXPORT Isolate {
const AllowJavascriptExecutionScope&) = delete; const AllowJavascriptExecutionScope&) = delete;
private: private:
Isolate* isolate_; Isolate* v8_isolate_;
bool was_execution_allowed_assert_; bool was_execution_allowed_assert_;
bool was_execution_allowed_throws_; bool was_execution_allowed_throws_;
bool was_execution_allowed_dump_; bool was_execution_allowed_dump_;
...@@ -376,7 +378,7 @@ class V8_EXPORT Isolate { ...@@ -376,7 +378,7 @@ class V8_EXPORT Isolate {
const SuppressMicrotaskExecutionScope&) = delete; const SuppressMicrotaskExecutionScope&) = delete;
private: private:
internal::Isolate* const isolate_; internal::Isolate* const i_isolate_;
internal::MicrotaskQueue* const microtask_queue_; internal::MicrotaskQueue* const microtask_queue_;
internal::Address previous_stack_height_; internal::Address previous_stack_height_;
...@@ -389,7 +391,7 @@ class V8_EXPORT Isolate { ...@@ -389,7 +391,7 @@ class V8_EXPORT Isolate {
*/ */
class V8_EXPORT V8_NODISCARD SafeForTerminationScope { class V8_EXPORT V8_NODISCARD SafeForTerminationScope {
public: public:
explicit SafeForTerminationScope(v8::Isolate* isolate); explicit SafeForTerminationScope(v8::Isolate* v8_isolate);
~SafeForTerminationScope(); ~SafeForTerminationScope();
// Prevent copying of Scope objects. // Prevent copying of Scope objects.
...@@ -397,7 +399,7 @@ class V8_EXPORT Isolate { ...@@ -397,7 +399,7 @@ class V8_EXPORT Isolate {
SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete; SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;
private: private:
internal::Isolate* isolate_; internal::Isolate* i_isolate_;
bool prev_value_; bool prev_value_;
}; };
......
...@@ -86,7 +86,7 @@ class V8_EXPORT V8_NODISCARD HandleScope { ...@@ -86,7 +86,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
static int NumberOfHandles(Isolate* isolate); static int NumberOfHandles(Isolate* isolate);
V8_INLINE Isolate* GetIsolate() const { V8_INLINE Isolate* GetIsolate() const {
return reinterpret_cast<Isolate*>(isolate_); return reinterpret_cast<Isolate*>(i_isolate_);
} }
HandleScope(const HandleScope&) = delete; HandleScope(const HandleScope&) = delete;
...@@ -97,7 +97,7 @@ class V8_EXPORT V8_NODISCARD HandleScope { ...@@ -97,7 +97,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
void Initialize(Isolate* isolate); void Initialize(Isolate* isolate);
static internal::Address* CreateHandle(internal::Isolate* isolate, static internal::Address* CreateHandle(internal::Isolate* i_isolate,
internal::Address value); internal::Address value);
private: private:
...@@ -108,7 +108,7 @@ class V8_EXPORT V8_NODISCARD HandleScope { ...@@ -108,7 +108,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
void operator delete(void*, size_t); void operator delete(void*, size_t);
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_next_;
internal::Address* prev_limit_; internal::Address* prev_limit_;
...@@ -445,7 +445,7 @@ class V8_EXPORT V8_NODISCARD SealHandleScope { ...@@ -445,7 +445,7 @@ class V8_EXPORT V8_NODISCARD SealHandleScope {
void operator delete(void*, size_t); void operator delete(void*, size_t);
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_; internal::Address* prev_limit_;
int prev_sealed_level_; int prev_sealed_level_;
}; };
......
...@@ -70,7 +70,7 @@ class V8_EXPORT ScriptOrigin { ...@@ -70,7 +70,7 @@ class V8_EXPORT ScriptOrigin {
bool resource_is_opaque = false, bool is_wasm = false, bool resource_is_opaque = false, bool is_wasm = false,
bool is_module = false, bool is_module = false,
Local<Data> host_defined_options = Local<Data>()) Local<Data> host_defined_options = Local<Data>())
: isolate_(isolate), : v8_isolate_(isolate),
resource_name_(resource_name), resource_name_(resource_name),
resource_line_offset_(resource_line_offset), resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset), resource_column_offset_(resource_column_offset),
...@@ -94,7 +94,7 @@ class V8_EXPORT ScriptOrigin { ...@@ -94,7 +94,7 @@ class V8_EXPORT ScriptOrigin {
private: private:
void VerifyHostDefinedOptions() const; void VerifyHostDefinedOptions() const;
Isolate* isolate_; Isolate* v8_isolate_;
Local<Value> resource_name_; Local<Value> resource_name_;
int resource_line_offset_; int resource_line_offset_;
int resource_column_offset_; int resource_column_offset_;
......
...@@ -142,7 +142,7 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope { ...@@ -142,7 +142,7 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope {
MicrotasksScope& operator=(const MicrotasksScope&) = delete; MicrotasksScope& operator=(const MicrotasksScope&) = delete;
private: private:
internal::Isolate* const isolate_; internal::Isolate* const i_isolate_;
internal::MicrotaskQueue* const microtask_queue_; internal::MicrotaskQueue* const microtask_queue_;
bool run_; bool run_;
}; };
......
...@@ -235,7 +235,7 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final { ...@@ -235,7 +235,7 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
const WasmModuleObjectBuilderStreaming&) = delete; const WasmModuleObjectBuilderStreaming&) = delete;
WasmModuleObjectBuilderStreaming& operator=( WasmModuleObjectBuilderStreaming& operator=(
WasmModuleObjectBuilderStreaming&&) = default; WasmModuleObjectBuilderStreaming&&) = default;
Isolate* isolate_ = nullptr; Isolate* v8_isolate_ = nullptr;
#if V8_CC_MSVC #if V8_CC_MSVC
/** /**
......
...@@ -233,14 +233,6 @@ class V8_NODISCARD InternalEscapableScope : public EscapableHandleScope { ...@@ -233,14 +233,6 @@ class V8_NODISCARD InternalEscapableScope : public EscapableHandleScope {
: EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {} : 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> template <typename T>
void CopySmiElementsToTypedBuffer(T* dst, uint32_t length, void CopySmiElementsToTypedBuffer(T* dst, uint32_t length,
i::FixedArray elements) { i::FixedArray elements) {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD // PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD
#undef LOG_API #undef LOG_API
#undef ENTER_V8_DO_NOT_USE #undef ENTER_V8_BASIC
#undef ENTER_V8_HELPER_DO_NOT_USE #undef ENTER_V8_HELPER_INTERNAL
#undef PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE #undef PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE
#undef PREPARE_FOR_EXECUTION_WITH_CONTEXT #undef PREPARE_FOR_EXECUTION_WITH_CONTEXT
#undef PREPARE_FOR_EXECUTION #undef PREPARE_FOR_EXECUTION
......
...@@ -35,40 +35,40 @@ ...@@ -35,40 +35,40 @@
* TODO(verwaest): Remove calls form API methods to DO_NOT_USE macros. * TODO(verwaest): Remove calls form API methods to DO_NOT_USE macros.
*/ */
#define API_RCS_SCOPE(isolate, class_name, function_name) \ #define API_RCS_SCOPE(i_isolate, class_name, function_name) \
RCS_SCOPE(isolate, \ RCS_SCOPE(i_isolate, \
i::RuntimeCallCounterId::kAPI_##class_name##_##function_name); 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, \ #define ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, \
function_name, bailout_value, \ function_name, bailout_value, \
HandleScopeClass, do_callback) \ HandleScopeClass, do_callback) \
if (IsExecutionTerminatingCheck(isolate)) { \ if (i_isolate->is_execution_terminating()) { \
return bailout_value; \ return bailout_value; \
} \ } \
HandleScopeClass handle_scope(isolate); \ HandleScopeClass handle_scope(i_isolate); \
CallDepthScope<do_callback> call_depth_scope(isolate, context); \ CallDepthScope<do_callback> call_depth_scope(i_isolate, context); \
API_RCS_SCOPE(isolate, class_name, function_name); \ API_RCS_SCOPE(i_isolate, class_name, function_name); \
i::VMState<v8::OTHER> __state__((isolate)); \ i::VMState<v8::OTHER> __state__((i_isolate)); \
bool has_pending_exception = false bool has_pending_exception = false
#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, T) \ #define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, T) \
if (IsExecutionTerminatingCheck(isolate)) { \ if (i_isolate->is_execution_terminating()) { \
return MaybeLocal<T>(); \ return MaybeLocal<T>(); \
} \ } \
InternalEscapableScope handle_scope(isolate); \ InternalEscapableScope handle_scope(i_isolate); \
CallDepthScope<false> call_depth_scope(isolate, v8::Local<v8::Context>()); \ CallDepthScope<false> call_depth_scope(i_isolate, v8::Local<v8::Context>()); \
i::VMState<v8::OTHER> __state__((isolate)); \ i::VMState<v8::OTHER> __state__((i_isolate)); \
bool has_pending_exception = false bool has_pending_exception = false
#define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ #define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \
bailout_value, HandleScopeClass, \ bailout_value, HandleScopeClass, \
do_callback) \ do_callback) \
auto isolate = context.IsEmpty() \ auto i_isolate = context.IsEmpty() \
? i::Isolate::Current() \ ? i::Isolate::Current() \
: reinterpret_cast<i::Isolate*>(context->GetIsolate()); \ : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, do_callback); bailout_value, HandleScopeClass, do_callback);
#define PREPARE_FOR_EXECUTION(context, class_name, function_name, T) \ #define PREPARE_FOR_EXECUTION(context, class_name, function_name, T) \
...@@ -76,46 +76,47 @@ ...@@ -76,46 +76,47 @@
MaybeLocal<T>(), InternalEscapableScope, \ MaybeLocal<T>(), InternalEscapableScope, \
false) false)
#define ENTER_V8(isolate, context, class_name, function_name, bailout_value, \ #define ENTER_V8(i_isolate, context, class_name, function_name, bailout_value, \
HandleScopeClass) \ HandleScopeClass) \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, true) bailout_value, HandleScopeClass, true)
#ifdef DEBUG #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) \ bailout_value, HandleScopeClass) \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, false); \ bailout_value, HandleScopeClass, false); \
i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)) i::DisallowJavascriptExecutionDebugOnly __no_script__((i_isolate))
// Lightweight version for APIs that don't require an active context. // Lightweight version for APIs that don't require an active context.
#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) \ #define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)); \ i::DisallowJavascriptExecutionDebugOnly __no_script__((i_isolate)); \
i::DisallowExceptions __no_exceptions__((isolate)) i::DisallowExceptions __no_exceptions__((i_isolate))
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \ #define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
i::VMState<v8::OTHER> __state__((isolate)); \ i::VMState<v8::OTHER> __state__((i_isolate)); \
ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate)
#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \ #define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \
i::VMState<v8::OTHER> __state__((isolate)); \ DCHECK(!(i_isolate)->is_execution_terminating()); \
i::DisallowExceptions __no_exceptions__((isolate)) i::VMState<v8::OTHER> __state__((i_isolate)); \
#else i::DisallowExceptions __no_exceptions__((i_isolate))
#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \ #else // DEBUG
#define ENTER_V8_NO_SCRIPT(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass) \ bailout_value, HandleScopeClass) \
ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, function_name, \
bailout_value, HandleScopeClass, false) 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) \ #define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
i::VMState<v8::OTHER> __state__((isolate)); i::VMState<v8::OTHER> __state__((i_isolate));
#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \ #define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \
i::VMState<v8::OTHER> __state__((isolate)); i::VMState<v8::OTHER> __state__((i_isolate));
#endif // DEBUG #endif // DEBUG
#define EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, value) \ #define EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(i_isolate, value) \
do { \ do { \
if (has_pending_exception) { \ if (has_pending_exception) { \
call_depth_scope.Escape(); \ call_depth_scope.Escape(); \
...@@ -124,9 +125,9 @@ ...@@ -124,9 +125,9 @@
} while (false) } while (false)
#define RETURN_ON_FAILED_EXECUTION(T) \ #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) \ #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); #define RETURN_ESCAPED(value) return handle_scope.Escape(value);
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -292,10 +292,10 @@ MaybeLocal<Context> GetCreationContext(Local<Object> value) { ...@@ -292,10 +292,10 @@ MaybeLocal<Context> GetCreationContext(Local<Object> value) {
} }
void ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) { void ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
internal_isolate->debug()->ChangeBreakOnException( i_isolate->debug()->ChangeBreakOnException(i::BreakException,
i::BreakException, type == BreakOnAnyException); type == BreakOnAnyException);
internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException, i_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException,
type != NoBreakOnException); type != NoBreakOnException);
} }
...@@ -307,7 +307,7 @@ 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) { void PrepareStep(Isolate* v8_isolate, StepAction action) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_DO_NOT_USE(isolate); ENTER_V8_BASIC(isolate);
CHECK(isolate->debug()->CheckExecutionState()); CHECK(isolate->debug()->CheckExecutionState());
// Clear all current stepping setup. // Clear all current stepping setup.
isolate->debug()->ClearStepping(); isolate->debug()->ClearStepping();
...@@ -325,7 +325,7 @@ void ClearStepping(Isolate* v8_isolate) { ...@@ -325,7 +325,7 @@ void ClearStepping(Isolate* v8_isolate) {
void BreakRightNow(Isolate* v8_isolate, void BreakRightNow(Isolate* v8_isolate,
base::EnumSet<debug::BreakReason> break_reasons) { base::EnumSet<debug::BreakReason> break_reasons) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_DO_NOT_USE(isolate); ENTER_V8_BASIC(isolate);
isolate->debug()->HandleDebugBreak(i::kIgnoreIfAllFramesBlackboxed, isolate->debug()->HandleDebugBreak(i::kIgnoreIfAllFramesBlackboxed,
break_reasons); break_reasons);
} }
...@@ -338,7 +338,7 @@ void SetTerminateOnResume(Isolate* v8_isolate) { ...@@ -338,7 +338,7 @@ void SetTerminateOnResume(Isolate* v8_isolate) {
bool CanBreakProgram(Isolate* v8_isolate) { bool CanBreakProgram(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::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(); return !isolate->debug()->AllFramesOnStackAreBlackboxed();
} }
...@@ -1036,13 +1036,13 @@ MaybeLocal<Value> CallFunctionOn(Local<Context> context, ...@@ -1036,13 +1036,13 @@ MaybeLocal<Value> CallFunctionOn(Local<Context> context,
MaybeLocal<v8::Value> EvaluateGlobal(v8::Isolate* isolate, MaybeLocal<v8::Value> EvaluateGlobal(v8::Isolate* isolate,
v8::Local<v8::String> source, v8::Local<v8::String> source,
EvaluateGlobalMode mode, bool repl) { EvaluateGlobalMode mode, bool repl) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(internal_isolate, Value); PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, Value);
i::REPLMode repl_mode = repl ? i::REPLMode::kYes : i::REPLMode::kNo; i::REPLMode repl_mode = repl ? i::REPLMode::kYes : i::REPLMode::kNo;
Local<Value> result; Local<Value> result;
has_pending_exception = !ToLocal<Value>( has_pending_exception = !ToLocal<Value>(
i::DebugEvaluate::Global(internal_isolate, Utils::OpenHandle(*source), i::DebugEvaluate::Global(i_isolate, Utils::OpenHandle(*source), mode,
mode, repl_mode), repl_mode),
&result); &result);
RETURN_ON_FAILED_EXECUTION(Value); RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result); RETURN_ESCAPED(result);
...@@ -1051,13 +1051,13 @@ MaybeLocal<v8::Value> EvaluateGlobal(v8::Isolate* isolate, ...@@ -1051,13 +1051,13 @@ MaybeLocal<v8::Value> EvaluateGlobal(v8::Isolate* isolate,
v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting( v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting(
v8::Isolate* isolate, v8::Local<v8::Script> function, v8::Isolate* isolate, v8::Local<v8::Script> function,
v8::debug::EvaluateGlobalMode mode, bool repl) { v8::debug::EvaluateGlobalMode mode, bool repl) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(internal_isolate, Value); PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, Value);
i::REPLMode repl_mode = repl ? i::REPLMode::kYes : i::REPLMode::kNo; i::REPLMode repl_mode = repl ? i::REPLMode::kYes : i::REPLMode::kNo;
Local<Value> result; Local<Value> result;
has_pending_exception = !ToLocal<Value>( has_pending_exception = !ToLocal<Value>(
i::DebugEvaluate::Global(internal_isolate, Utils::OpenHandle(*function), i::DebugEvaluate::Global(i_isolate, Utils::OpenHandle(*function), mode,
mode, repl_mode), repl_mode),
&result); &result);
RETURN_ON_FAILED_EXECUTION(Value); RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result); RETURN_ESCAPED(result);
...@@ -1246,12 +1246,12 @@ TypeProfile::ScriptData TypeProfile::GetScriptData(size_t i) const { ...@@ -1246,12 +1246,12 @@ TypeProfile::ScriptData TypeProfile::GetScriptData(size_t i) const {
MaybeLocal<v8::Value> EphemeronTable::Get(v8::Isolate* isolate, MaybeLocal<v8::Value> EphemeronTable::Get(v8::Isolate* isolate,
v8::Local<v8::Value> key) { 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)); auto self = i::Handle<i::EphemeronHashTable>::cast(Utils::OpenHandle(this));
i::Handle<i::Object> internal_key = Utils::OpenHandle(*key); i::Handle<i::Object> internal_key = Utils::OpenHandle(*key);
DCHECK(internal_key->IsJSReceiver()); 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 {}; if (value->IsTheHole()) return {};
return Utils::ToLocal(value); return Utils::ToLocal(value);
...@@ -1323,7 +1323,7 @@ std::unique_ptr<PropertyIterator> PropertyIterator::Create( ...@@ -1323,7 +1323,7 @@ std::unique_ptr<PropertyIterator> PropertyIterator::Create(
Local<Context> context, Local<Object> object, bool skip_indices) { Local<Context> context, Local<Object> object, bool skip_indices) {
internal::Isolate* isolate = internal::Isolate* isolate =
reinterpret_cast<i::Isolate*>(object->GetIsolate()); reinterpret_cast<i::Isolate*>(object->GetIsolate());
if (IsExecutionTerminatingCheck(isolate)) { if (isolate->is_execution_terminating()) {
return nullptr; return nullptr;
} }
CallDepthScope<false> call_depth_scope(isolate, context); CallDepthScope<false> call_depth_scope(isolate, context);
...@@ -1342,7 +1342,7 @@ std::unique_ptr<PropertyIterator> PropertyIterator::Create( ...@@ -1342,7 +1342,7 @@ std::unique_ptr<PropertyIterator> PropertyIterator::Create(
namespace internal { namespace internal {
Maybe<bool> DebugPropertyIterator::Advance() { Maybe<bool> DebugPropertyIterator::Advance() {
if (IsExecutionTerminatingCheck(isolate_)) { if (isolate_->is_execution_terminating()) {
return Nothing<bool>(); return Nothing<bool>();
} }
Local<v8::Context> context = Local<v8::Context> context =
......
...@@ -130,6 +130,11 @@ bool Isolate::is_catchable_by_wasm(Object exception) { ...@@ -130,6 +130,11 @@ bool Isolate::is_catchable_by_wasm(Object exception) {
return !JSReceiver::HasProperty(&it).FromJust(); return !JSReceiver::HasProperty(&it).FromJust();
} }
bool Isolate::is_execution_terminating() {
return thread_local_top()->scheduled_exception_ ==
i::ReadOnlyRoots(this).termination_exception();
}
void Isolate::FireBeforeCallEnteredCallback() { void Isolate::FireBeforeCallEnteredCallback() {
for (auto& callback : before_call_entered_callbacks_) { for (auto& callback : before_call_entered_callbacks_) {
callback(reinterpret_cast<v8::Isolate*>(this)); callback(reinterpret_cast<v8::Isolate*>(this));
......
...@@ -810,6 +810,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { ...@@ -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_javascript(Object exception);
inline bool is_catchable_by_wasm(Object exception); inline bool is_catchable_by_wasm(Object exception);
inline bool is_execution_terminating();
// JS execution stack (see frames.h). // JS execution stack (see frames.h).
static Address c_entry_fp(ThreadLocalTop* thread) { static Address c_entry_fp(ThreadLocalTop* thread) {
......
...@@ -52,8 +52,8 @@ void Locker::Initialize(v8::Isolate* isolate) { ...@@ -52,8 +52,8 @@ void Locker::Initialize(v8::Isolate* isolate) {
bool Locker::IsLocked(v8::Isolate* isolate) { bool Locker::IsLocked(v8::Isolate* isolate) {
DCHECK_NOT_NULL(isolate); DCHECK_NOT_NULL(isolate);
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
return internal_isolate->thread_manager()->IsLockedByCurrentThread(); return i_isolate->thread_manager()->IsLockedByCurrentThread();
} }
// static // static
......
...@@ -16,12 +16,12 @@ namespace internal { ...@@ -16,12 +16,12 @@ namespace internal {
void LocalEmbedderHeapTracer::SetRemoteTracer(EmbedderHeapTracer* tracer) { void LocalEmbedderHeapTracer::SetRemoteTracer(EmbedderHeapTracer* tracer) {
CHECK_NULL(cpp_heap_); CHECK_NULL(cpp_heap_);
if (remote_tracer_) remote_tracer_->isolate_ = nullptr; if (remote_tracer_) remote_tracer_->v8_isolate_ = nullptr;
remote_tracer_ = tracer; remote_tracer_ = tracer;
default_embedder_roots_handler_.SetTracer(tracer); default_embedder_roots_handler_.SetTracer(tracer);
if (remote_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) { void LocalEmbedderHeapTracer::SetCppHeap(CppHeap* cpp_heap) {
......
...@@ -87,7 +87,7 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final { ...@@ -87,7 +87,7 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
explicit LocalEmbedderHeapTracer(Isolate* isolate) : isolate_(isolate) {} explicit LocalEmbedderHeapTracer(Isolate* isolate) : isolate_(isolate) {}
~LocalEmbedderHeapTracer() { ~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 // CppHeap is not detached from Isolate here. Detaching is done explciitly
// on Isolate/Heap/CppHeap destruction. // on Isolate/Heap/CppHeap destruction.
} }
......
...@@ -205,23 +205,22 @@ static StartupBlobs Serialize(v8::Isolate* isolate) { ...@@ -205,23 +205,22 @@ static StartupBlobs Serialize(v8::Isolate* isolate) {
v8::Context::New(isolate); v8::Context::New(isolate);
} }
Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate); Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
internal_isolate->heap()->CollectAllAvailableGarbage( i_isolate->heap()->CollectAllAvailableGarbage(
i::GarbageCollectionReason::kTesting); i::GarbageCollectionReason::kTesting);
SafepointScope safepoint(internal_isolate->heap()); SafepointScope safepoint(i_isolate->heap());
HandleScope scope(internal_isolate); HandleScope scope(i_isolate);
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
ReadOnlySerializer read_only_serializer(internal_isolate, ReadOnlySerializer read_only_serializer(i_isolate,
Snapshot::kDefaultSerializerFlags); Snapshot::kDefaultSerializerFlags);
read_only_serializer.SerializeReadOnlyRoots(); read_only_serializer.SerializeReadOnlyRoots();
SharedHeapSerializer shared_space_serializer( SharedHeapSerializer shared_space_serializer(
internal_isolate, Snapshot::kDefaultSerializerFlags, i_isolate, Snapshot::kDefaultSerializerFlags, &read_only_serializer);
&read_only_serializer);
StartupSerializer ser(internal_isolate, Snapshot::kDefaultSerializerFlags, StartupSerializer ser(i_isolate, Snapshot::kDefaultSerializerFlags,
&read_only_serializer, &shared_space_serializer); &read_only_serializer, &shared_space_serializer);
ser.SerializeStrongReferences(no_gc); ser.SerializeStrongReferences(no_gc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment