Commit 8893af7d authored by Samuel Groß's avatar Samuel Groß Committed by V8 LUCI CQ

[sandbox] Remove CagedMemoryAllocationOutcome histogram

This is no longer needed as all backing store allocations must now be
located inside the sandbox after sandboxed pointers were enabled by
default when the sandbox is enabled.

Bug: chromium:1218005
Change-Id: Id2d5feba878e1a6a5775ae3fef4012d0e7fe667a
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3738742Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81488}
parent 2dc4329f
......@@ -99,9 +99,6 @@ namespace internal {
/* Backtracks observed in a single regexp interpreter execution */ \
/* The maximum of 100M backtracks takes roughly 2 seconds on my machine. */ \
HR(regexp_backtracks, V8.RegExpBacktracks, 1, 100000000, 50) \
/* See the CagedMemoryAllocationOutcome enum in backing-store.cc */ \
HR(caged_memory_allocation_outcome, V8.CagedMemoryAllocationOutcome, 0, 2, \
3) \
/* number of times a cache event is triggered for a wasm module */ \
HR(wasm_cache_count, V8.WasmCacheCount, 0, 100, 101) \
SANDBOXED_HISTOGRAM_LIST(HR)
......
......@@ -55,21 +55,6 @@ enum class AllocationStatus {
kOtherFailure // Failed for an unknown reason
};
// Attempts to allocate memory inside the sandbox currently fall back to
// allocating memory outside of the sandbox if necessary. Once this fallback is
// no longer allowed/possible, these cases will become allocation failures
// instead. To track the frequency of such events, the outcome of memory
// allocation attempts inside the sandbox is reported to UMA.
//
// See caged_memory_allocation_outcome in counters-definitions.h
// This class and the entry in counters-definitions.h use the term "cage"
// instead of "sandbox" for historical reasons.
enum class CagedMemoryAllocationOutcome {
kSuccess, // Allocation succeeded inside the cage
kOutsideCage, // Allocation failed inside the cage but succeeded outside
kFailure, // Allocation failed inside and outside of the cage
};
base::AddressRegion GetReservedRegion(bool has_guard_regions,
void* buffer_start,
size_t byte_capacity) {
......@@ -109,28 +94,6 @@ void RecordStatus(Isolate* isolate, AllocationStatus status) {
static_cast<int>(status));
}
// When the sandbox is active, this function records the outcome of attempts to
// allocate memory inside the sandbox which fall back to allocating memory
// outside of the sandbox. Passing a value of nullptr for the result indicates
// that the memory could not be allocated at all.
void RecordSandboxMemoryAllocationResult(Isolate* isolate, void* result) {
// This metric is only meaningful when the sandbox is active.
#ifdef V8_ENABLE_SANDBOX
if (GetProcessWideSandbox()->is_initialized()) {
CagedMemoryAllocationOutcome outcome;
if (result) {
bool allocation_in_cage = GetProcessWideSandbox()->Contains(result);
outcome = allocation_in_cage ? CagedMemoryAllocationOutcome::kSuccess
: CagedMemoryAllocationOutcome::kOutsideCage;
} else {
outcome = CagedMemoryAllocationOutcome::kFailure;
}
isolate->counters()->caged_memory_allocation_outcome()->AddSample(
static_cast<int>(outcome));
}
#endif // V8_ENABLE_SANDBOX
}
inline void DebugCheckZero(void* start, size_t byte_length) {
#if DEBUG
// Double check memory is zero-initialized. Despite being DEBUG-only,
......@@ -447,7 +410,6 @@ std::unique_ptr<BackingStore> BackingStore::TryAllocateAndPartiallyCommitMemory(
if (!gc_retry(allocate_pages)) {
// Page allocator could not reserve enough pages.
RecordStatus(isolate, AllocationStatus::kOtherFailure);
RecordSandboxMemoryAllocationResult(isolate, nullptr);
TRACE_BS("BSw:try failed to allocate pages\n");
return {};
}
......@@ -484,7 +446,6 @@ std::unique_ptr<BackingStore> BackingStore::TryAllocateAndPartiallyCommitMemory(
RecordStatus(isolate, did_retry ? AllocationStatus::kSuccessAfterRetry
: AllocationStatus::kSuccess);
RecordSandboxMemoryAllocationResult(isolate, allocation_base);
ResizableFlag resizable =
is_wasm_memory ? ResizableFlag::kNotResizable : ResizableFlag::kResizable;
......
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