Commit 91badec6 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

[api] Deprecate unused GlobalHandles APIs that peek into internals

When moving forward and optimizing internals, these APIs cannot be
trusted anymore as their semantics are tangled to the current
implementation.

Bug: v8:12819
Change-Id: I0e3370724307a420ee42fed8070b55542be9400d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3599475
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80082}
parent ea2f804e
......@@ -843,6 +843,9 @@ class V8_EXPORT Isolate {
* Returns the number of phantom handles without callbacks that were reset
* by the garbage collector since the last call to this function.
*/
V8_DEPRECATE_SOON(
"Information cannot be relied on anymore as internal representation may "
"change.")
size_t NumberOfPhantomHandleResetsSinceLastCall();
/**
......@@ -1602,6 +1605,9 @@ class V8_EXPORT Isolate {
* Iterates through all the persistent handles in the current isolate's heap
* that have class_ids.
*/
V8_DEPRECATE_SOON(
"Information cannot be relied on anymore as internal representation may "
"change.")
void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
/**
......@@ -1609,6 +1615,9 @@ class V8_EXPORT Isolate {
* that have class_ids and are weak to be marked as inactive if there is no
* pending activity for the handle.
*/
V8_DEPRECATE_SOON(
"Information cannot be relied on anymore as internal representation may "
"change.")
void VisitWeakHandles(PersistentHandleVisitor* visitor);
/**
......
......@@ -55,6 +55,7 @@
#include "src/base/platform/platform.h"
#include "src/base/strings.h"
#include "src/codegen/compilation-cache.h"
#include "src/common/allow-deprecated.h"
#include "src/compiler/globals.h"
#include "src/debug/debug.h"
#include "src/execution/arguments.h"
......@@ -18825,6 +18826,7 @@ class Visitor42 : public v8::PersistentHandleVisitor {
v8::Persistent<v8::Object>* object_;
};
START_ALLOW_USE_DEPRECATED()
TEST(PersistentHandleVisitor) {
LocalContext context;
......@@ -18842,6 +18844,7 @@ TEST(PersistentHandleVisitor) {
object.Reset();
}
END_ALLOW_USE_DEPRECATED()
TEST(WrapperClassId) {
LocalContext context;
......@@ -28,6 +28,7 @@
#include "include/v8-function.h"
#include "include/v8-locker.h"
#include "src/api/api-inl.h"
#include "src/common/allow-deprecated.h"
#include "src/execution/isolate.h"
#include "src/handles/global-handles.h"
#include "src/heap/factory.h"
......@@ -286,6 +287,8 @@ TEST(WeakPersistentSmi) {
v8::WeakCallbackType::kParameter);
}
START_ALLOW_USE_DEPRECATED()
TEST(PhantomHandlesWithoutCallbacks) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
......@@ -305,6 +308,8 @@ TEST(PhantomHandlesWithoutCallbacks) {
CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall());
}
END_ALLOW_USE_DEPRECATED()
TEST(WeakHandleToUnmodifiedJSObjectDiesOnScavenge) {
if (FLAG_single_generation) return;
CcTest::InitializeVM();
......
......@@ -38,6 +38,7 @@
#include "src/base/optional.h"
#include "src/base/strings.h"
#include "src/codegen/assembler-inl.h"
#include "src/common/allow-deprecated.h"
#include "src/debug/debug.h"
#include "src/heap/heap-inl.h"
#include "src/init/v8.h"
......@@ -1645,12 +1646,16 @@ class EmbedderGraphBuilder : public v8::PersistentHandleVisitor {
graph->AddNode(std::unique_ptr<Group>(new Group("ccc-group")));
}
START_ALLOW_USE_DEPRECATED()
static void BuildEmbedderGraph(v8::Isolate* isolate, v8::EmbedderGraph* graph,
void* data) {
EmbedderGraphBuilder builder(isolate, graph);
isolate->VisitHandlesWithClassIds(&builder);
}
END_ALLOW_USE_DEPRECATED()
void VisitPersistentHandle(v8::Persistent<v8::Value>* value,
uint16_t class_id) override {
v8::Local<v8::Value> wrapper = v8::Local<v8::Value>::New(
......
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