[vm/profiler] Handle out of blocks case in ReserveSampleAndLink.

Both SampleBlock::ReserveAllocationSample and
SampleBlock::ReserveCPUSample can return nullptr, so that needs to be
appropriately handled in SampleBlock::ReserveSampleAndLink. The only
caller of the latter checks for nullptr, so pass though nullptr results
from the former methods.

TEST=Fixes current service tests failures on some trybots,
     see test results on CL.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,app-kernel-linux-debug-x64-try
Change-Id: Ib70cc6726862bc5fe3bfb0c06ee2aae84ec026c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208321
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
This commit is contained in:
Tess Strickland
2021-07-28 11:14:53 +00:00
committed by commit-bot@chromium.org
parent 16ebd4fe57
commit 9397b8ff05
+3
View File
@@ -282,6 +282,9 @@ Sample* SampleBlock::ReserveSampleAndLink(Sample* previous) {
Sample* next = previous->is_allocation_sample()
? buffer->ReserveAllocationSample(isolate)
: buffer->ReserveCPUSample(isolate);
if (next == nullptr) {
return nullptr; // No blocks left, so drop sample.
}
next->Init(previous->port(), previous->timestamp(), previous->tid());
next->set_head_sample(false);
// Mark that previous continues at next.