Commit f3b29768 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[api] Move forward deprecations in EmbedderHeapTracer and its references

- Move foward deprecations in EmbedderHeapTracer
- Deprecate SetFinalizationCallback in v8::TraceReference

Change-Id: Ic68402096ce8f5fe08521253836d3b19d73326ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1863941
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64388}
parent df131dbe
...@@ -883,19 +883,6 @@ class TracedReferenceBase { ...@@ -883,19 +883,6 @@ class TracedReferenceBase {
*/ */
V8_INLINE uint16_t WrapperClassId() const; V8_INLINE uint16_t WrapperClassId() const;
/**
* Adds a finalization callback to the handle. The type of this callback is
* similar to WeakCallbackType::kInternalFields, i.e., it will pass the
* parameter and the first two internal fields of the object.
*
* The callback is then supposed to reset the handle in the callback. No
* further V8 API may be called in this callback. In case additional work
* involving V8 needs to be done, a second callback can be scheduled using
* WeakCallbackInfo<void>::SetSecondPassCallback.
*/
V8_INLINE void SetFinalizationCallback(
void* parameter, WeakCallbackInfo<void>::Callback callback);
template <class S> template <class S>
V8_INLINE TracedReferenceBase<S>& As() const { V8_INLINE TracedReferenceBase<S>& As() const {
return reinterpret_cast<TracedReferenceBase<S>&>( return reinterpret_cast<TracedReferenceBase<S>&>(
...@@ -1033,6 +1020,19 @@ class TracedGlobal : public TracedReferenceBase<T> { ...@@ -1033,6 +1020,19 @@ class TracedGlobal : public TracedReferenceBase<T> {
return reinterpret_cast<TracedGlobal<S>&>( return reinterpret_cast<TracedGlobal<S>&>(
const_cast<TracedGlobal<T>&>(*this)); const_cast<TracedGlobal<T>&>(*this));
} }
/**
* Adds a finalization callback to the handle. The type of this callback is
* similar to WeakCallbackType::kInternalFields, i.e., it will pass the
* parameter and the first two internal fields of the object.
*
* The callback is then supposed to reset the handle in the callback. No
* further V8 API may be called in this callback. In case additional work
* involving V8 needs to be done, a second callback can be scheduled using
* WeakCallbackInfo<void>::SetSecondPassCallback.
*/
V8_INLINE void SetFinalizationCallback(
void* parameter, WeakCallbackInfo<void>::Callback callback);
}; };
/** /**
...@@ -1142,6 +1142,20 @@ class TracedReference : public TracedReferenceBase<T> { ...@@ -1142,6 +1142,20 @@ class TracedReference : public TracedReferenceBase<T> {
return reinterpret_cast<TracedReference<S>&>( return reinterpret_cast<TracedReference<S>&>(
const_cast<TracedReference<T>&>(*this)); const_cast<TracedReference<T>&>(*this));
} }
/**
* Adds a finalization callback to the handle. The type of this callback is
* similar to WeakCallbackType::kInternalFields, i.e., it will pass the
* parameter and the first two internal fields of the object.
*
* The callback is then supposed to reset the handle in the callback. No
* further V8 API may be called in this callback. In case additional work
* involving V8 needs to be done, a second callback can be scheduled using
* WeakCallbackInfo<void>::SetSecondPassCallback.
*/
V8_DEPRECATE_SOON("Use TracedGlobal<> if callbacks are required.")
V8_INLINE void SetFinalizationCallback(
void* parameter, WeakCallbackInfo<void>::Callback callback);
}; };
/** /**
...@@ -7618,7 +7632,7 @@ class V8_EXPORT EmbedderHeapTracer { ...@@ -7618,7 +7632,7 @@ class V8_EXPORT EmbedderHeapTracer {
virtual void RegisterV8References( virtual void RegisterV8References(
const std::vector<std::pair<void*, void*> >& embedder_fields) = 0; const std::vector<std::pair<void*, void*> >& embedder_fields) = 0;
V8_DEPRECATE_SOON("Use version taking TracedReferenceBase<v8::Data> argument") V8_DEPRECATED("Use version taking TracedReferenceBase<v8::Data> argument")
void RegisterEmbedderReference(const TracedReferenceBase<v8::Value>& ref); void RegisterEmbedderReference(const TracedReferenceBase<v8::Value>& ref);
void RegisterEmbedderReference(const TracedReferenceBase<v8::Data>& ref); void RegisterEmbedderReference(const TracedReferenceBase<v8::Data>& ref);
...@@ -7652,8 +7666,7 @@ class V8_EXPORT EmbedderHeapTracer { ...@@ -7652,8 +7666,7 @@ class V8_EXPORT EmbedderHeapTracer {
* overriden to fill a |TraceSummary| that is used by V8 to schedule future * overriden to fill a |TraceSummary| that is used by V8 to schedule future
* garbage collections. * garbage collections.
*/ */
V8_DEPRECATED("Use version with parameter.") virtual void TraceEpilogue() {} virtual void TraceEpilogue(TraceSummary* trace_summary) {}
virtual void TraceEpilogue(TraceSummary* trace_summary);
/** /**
* Called upon entering the final marking pause. No more incremental marking * Called upon entering the final marking pause. No more incremental marking
...@@ -7704,8 +7717,7 @@ class V8_EXPORT EmbedderHeapTracer { ...@@ -7704,8 +7717,7 @@ class V8_EXPORT EmbedderHeapTracer {
*/ */
virtual void ResetHandleInNonTracingGC( virtual void ResetHandleInNonTracingGC(
const v8::TracedReference<v8::Value>& handle); const v8::TracedReference<v8::Value>& handle);
V8_DEPRECATE_SOON( V8_DEPRECATED("Use TracedReference version when not requiring destructors.")
"Use TracedReference version when not requiring destructors.")
virtual void ResetHandleInNonTracingGC( virtual void ResetHandleInNonTracingGC(
const v8::TracedGlobal<v8::Value>& handle); const v8::TracedGlobal<v8::Value>& handle);
...@@ -10524,10 +10536,17 @@ uint16_t TracedReferenceBase<T>::WrapperClassId() const { ...@@ -10524,10 +10536,17 @@ uint16_t TracedReferenceBase<T>::WrapperClassId() const {
} }
template <class T> template <class T>
void TracedReferenceBase<T>::SetFinalizationCallback( void TracedGlobal<T>::SetFinalizationCallback(
void* parameter, typename WeakCallbackInfo<void>::Callback callback) {
V8::SetFinalizationCallbackTraced(
reinterpret_cast<internal::Address*>(this->val_), parameter, callback);
}
template <class T>
void TracedReference<T>::SetFinalizationCallback(
void* parameter, typename WeakCallbackInfo<void>::Callback callback) { void* parameter, typename WeakCallbackInfo<void>::Callback callback) {
V8::SetFinalizationCallbackTraced(reinterpret_cast<internal::Address*>(val_), V8::SetFinalizationCallbackTraced(
parameter, callback); reinterpret_cast<internal::Address*>(this->val_), parameter, callback);
} }
template <typename T> template <typename T>
......
...@@ -10503,17 +10503,6 @@ void Testing::DeoptimizeAll(Isolate* isolate) { ...@@ -10503,17 +10503,6 @@ void Testing::DeoptimizeAll(Isolate* isolate) {
i::Deoptimizer::DeoptimizeAll(i_isolate); i::Deoptimizer::DeoptimizeAll(i_isolate);
} }
void EmbedderHeapTracer::TraceEpilogue(TraceSummary* trace_summary) {
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#endif
TraceEpilogue();
#if __clang__
#pragma clang diagnostic pop
#endif
}
void EmbedderHeapTracer::FinalizeTracing() { void EmbedderHeapTracer::FinalizeTracing() {
if (isolate_) { if (isolate_) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(isolate_); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(isolate_);
......
...@@ -78,7 +78,7 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer { ...@@ -78,7 +78,7 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
} }
} }
void TraceEpilogue() final {} void TraceEpilogue(TraceSummary*) final {}
void EnterFinalPause(EmbedderStackState) final {} void EnterFinalPause(EmbedderStackState) final {}
bool IsRegisteredFromV8(void* first_field) const { bool IsRegisteredFromV8(void* first_field) const {
...@@ -704,7 +704,7 @@ class EmptyEmbedderHeapTracer : public v8::EmbedderHeapTracer { ...@@ -704,7 +704,7 @@ class EmptyEmbedderHeapTracer : public v8::EmbedderHeapTracer {
bool AdvanceTracing(double deadline_in_ms) final { return true; } bool AdvanceTracing(double deadline_in_ms) final { return true; }
bool IsTracingDone() final { return true; } bool IsTracingDone() final { return true; }
void TracePrologue(EmbedderHeapTracer::TraceFlags) final {} void TracePrologue(EmbedderHeapTracer::TraceFlags) final {}
void TraceEpilogue() final {} void TraceEpilogue(TraceSummary*) final {}
void EnterFinalPause(EmbedderStackState) final {} void EnterFinalPause(EmbedderStackState) final {}
}; };
......
...@@ -50,7 +50,7 @@ class NonRootingEmbedderHeapTracer final : public v8::EmbedderHeapTracer { ...@@ -50,7 +50,7 @@ class NonRootingEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
bool AdvanceTracing(double deadline_in_ms) final { return true; } bool AdvanceTracing(double deadline_in_ms) final { return true; }
bool IsTracingDone() final { return true; } bool IsTracingDone() final { return true; }
void TracePrologue(TraceFlags) final {} void TracePrologue(TraceFlags) final {}
void TraceEpilogue() final {} void TraceEpilogue(TraceSummary*) final {}
void EnterFinalPause(EmbedderStackState) final {} void EnterFinalPause(EmbedderStackState) final {}
bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle) final { bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle) final {
......
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