Commit 9e28cf13 authored by kschimpf's avatar kschimpf Committed by Commit bot

Add counter for new shared/array buffers that fail to allocate space.

Records histogram of ArrayBuffer/SharedArrayBuffer new allocations
that failed because it couldn't allocate space for the
buffer. Histogram is based on the buffer size requested.

This counter is intended to give some clue as to how often, and what sizes are being requested. Unfortunately, the how often can't be answered with the current counter. The problem is that V8 doesn't currently support this possibility yet. Hence, for now, introducing a counter that at least counts the number/size of failing requests.

BUG=chromium:704922
R=bbudge@chromium.org,bradnelson@chromium.org,mtrofin@chromium.org

Review-Url: https://codereview.chromium.org/2786913004
Cr-Commit-Position: refs/heads/master@{#44318}
parent 0c5f5a3a
...@@ -929,7 +929,8 @@ class RuntimeCallTimerScope { ...@@ -929,7 +929,8 @@ class RuntimeCallTimerScope {
51) \ 51) \
HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1, \ HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1, \
100000, 51) \ 100000, 51) \
HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 1, 32, 32) HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 1, 32, 32) \
HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 1, 32, 32)
#define HISTOGRAM_TIMER_LIST(HT) \ #define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \ /* Garbage collection timers. */ \
......
...@@ -19485,7 +19485,12 @@ bool JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer> array_buffer, ...@@ -19485,7 +19485,12 @@ bool JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer> array_buffer,
data = isolate->array_buffer_allocator()->AllocateUninitialized( data = isolate->array_buffer_allocator()->AllocateUninitialized(
allocated_length); allocated_length);
} }
if (data == NULL) return false; if (data == NULL) {
isolate->counters()->array_buffer_new_size_failures()->AddSample(
sizeof(uint64_t) * kBitsPerByte -
base::bits::CountLeadingZeros64(allocated_length));
return false;
}
} else { } else {
data = NULL; data = NULL;
} }
......
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