[api] Deprecate *MemoryAllocationCallback

To keep track of memory characteristics of a JS program use
GetHeapSpaceStatistics from a combination of
- a GC epilogue callback registered using AddGCEpilogueCallback
- an interrupt registered using RequestInterrupt

Rationale:
The feature is currently broken as those callbacks are (also) executed from
background threads, breaking our implicit contract for only performing callbacks
on the foreground thread. Furhtermore, it's not clear for the embedder whether
these allocations originate in JS, or are required for a GC.

Note:
- The already deprecated non-isolate versions are removed with this CL.

R=jochen@chromium.org
BUG=v8:4813
LOG=Y

Review URL: https://codereview.chromium.org/1886573006

Cr-Commit-Position: refs/heads/master@{#35474}
This commit is contained in:
mlippautz 2016-04-14 01:53:31 -07:00 committed by Commit bot
parent 1e6f2ff368
commit 97e3909a53

View File

@ -6225,13 +6225,17 @@ class V8_EXPORT Isolate {
* Enables the host application to provide a mechanism to be notified
* and perform custom logging when V8 Allocates Executable Memory.
*/
void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
ObjectSpace space, AllocationAction action);
void V8_DEPRECATED(
"Use a combination of RequestInterrupt and GCCallback instead",
AddMemoryAllocationCallback(MemoryAllocationCallback callback,
ObjectSpace space, AllocationAction action));
/**
* Removes callback that was installed by AddMemoryAllocationCallback.
*/
void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback);
void V8_DEPRECATED(
"Use a combination of RequestInterrupt and GCCallback instead",
RemoveMemoryAllocationCallback(MemoryAllocationCallback callback));
/**
* Iterates through all external resources referenced from current isolate
@ -6467,23 +6471,6 @@ class V8_EXPORT V8 {
"Use isolate version",
void RemoveGCEpilogueCallback(GCCallback callback));
/**
* Enables the host application to provide a mechanism to be notified
* and perform custom logging when V8 Allocates Executable Memory.
*/
V8_INLINE static V8_DEPRECATED(
"Use isolate version",
void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
ObjectSpace space,
AllocationAction action));
/**
* Removes callback that was installed by AddMemoryAllocationCallback.
*/
V8_INLINE static V8_DEPRECATED(
"Use isolate version",
void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback));
/**
* Initializes V8. This function needs to be called before the first Isolate
* is created. It always returns true.
@ -8704,21 +8691,6 @@ void V8::RemoveGCEpilogueCallback(GCCallback callback) {
reinterpret_cast<v8::Isolate::GCCallback>(callback));
}
void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
ObjectSpace space,
AllocationAction action) {
Isolate* isolate = Isolate::GetCurrent();
isolate->AddMemoryAllocationCallback(callback, space, action);
}
void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
Isolate* isolate = Isolate::GetCurrent();
isolate->RemoveMemoryAllocationCallback(callback);
}
void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); }