Commit 29ad898c authored by tzik's avatar tzik Committed by Commit Bot

Deprecate v8::Isolate::GetEnteredContext

This CL marks v8::Isolate::GetEnteredContext as deprecated in favor of
replacing it with GetEnteredOrMicrotaskContext. Blink no longer uses it,
and Node.js does not use this too.

GetEnteredOrMicrotaskContext() is relevant for all known cases over
GetEnteredContext(), and it costs 2% of a benchmark score to maintain
the entered contexts under the nestable microtask context.
https://crrev.com/c/1322290 is a context for the bencmark and nestable
microtask contexts.

Bug: v8:8124
Change-Id: I260e32daadf34dc587926a1e20ab950ff2e31699
Reviewed-on: https://chromium-review.googlesource.com/c/1353025
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57927}
parent e0414b46
......@@ -7664,7 +7664,8 @@ class V8_EXPORT Isolate {
Local<Context> GetCurrentContext();
/** Returns the last context entered through V8's C++ API. */
Local<Context> GetEnteredContext();
V8_DEPRECATED("Use GetEnteredOrMicrotaskContext().",
Local<Context> GetEnteredContext());
/**
* Returns either the last context entered through V8's C++ API, or the
......
......@@ -22828,7 +22828,6 @@ static void Regress808911_MicrotaskCallback(void* data) {
// So here we expect "current context" to be context1 and
// "entered or microtask context" to be context2.
v8::Isolate* isolate = static_cast<v8::Isolate*>(data);
CHECK(isolate->GetCurrentContext() != isolate->GetEnteredContext());
CHECK(isolate->GetCurrentContext() !=
isolate->GetEnteredOrMicrotaskContext());
}
......@@ -22838,7 +22837,6 @@ static void Regress808911_CurrentContextWrapper(
// So here we expect "current context" to be context1 and
// "entered or microtask context" to be context2.
v8::Isolate* isolate = info.GetIsolate();
CHECK(isolate->GetCurrentContext() != isolate->GetEnteredContext());
CHECK(isolate->GetCurrentContext() !=
isolate->GetEnteredOrMicrotaskContext());
isolate->EnqueueMicrotask(Regress808911_MicrotaskCallback, isolate);
......@@ -28316,7 +28314,7 @@ void CheckContexts(v8::Isolate* isolate) {
->GetEmbedderData(1)
.As<v8::Integer>()
->Value());
CHECK_EQ(EnteredContext, isolate->GetEnteredContext()
CHECK_EQ(EnteredContext, isolate->GetEnteredOrMicrotaskContext()
->GetEmbedderData(1)
.As<v8::Integer>()
->Value());
......@@ -855,11 +855,11 @@ TEST(TerminateInMicrotask) {
{
v8::Context::Scope context_scope(context2);
CHECK(context2 == isolate->GetCurrentContext());
CHECK(context2 == isolate->GetEnteredContext());
CHECK(context2 == isolate->GetEnteredOrMicrotaskContext());
CHECK(!isolate->IsExecutionTerminating());
isolate->RunMicrotasks();
CHECK(context2 == isolate->GetCurrentContext());
CHECK(context2 == isolate->GetEnteredContext());
CHECK(context2 == isolate->GetEnteredOrMicrotaskContext());
CHECK(try_catch.HasCaught());
CHECK(try_catch.HasTerminated());
}
......
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