Commit be5dd772 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[heap] Remove PrintStack from Heap::RecordStats

Since RecordStats during GC, (when it fails to recover enough memory),
it unsafe for it to allocate any memory. Thus it cannot call PrintStack
which can call SharedFunctionInfo::EnsureSourcePositionsAvailable and
which may allocate, so this removes the call to PrintStack which is
apparently not useful for debugging anyway.

Bug: chromium:1032087
Change-Id: I94feeaab1445f7fd4f770a20197546fc40c77390
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1967377Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65475}
parent 08a5b95d
......@@ -4651,15 +4651,6 @@ void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
}
if (stats->last_few_messages != nullptr)
GetFromRingBuffer(stats->last_few_messages);
if (stats->js_stacktrace != nullptr) {
FixedStringAllocator fixed(stats->js_stacktrace, kStacktraceBufferSize - 1);
StringStream accumulator(&fixed, StringStream::kPrintObjectConcise);
if (gc_state() == Heap::NOT_IN_GC) {
isolate()->PrintStack(&accumulator, Isolate::kPrintStackVerbose);
} else {
accumulator.Add("Cannot get stack trace in GC.");
}
}
}
size_t Heap::OldGenerationSizeOfObjects() {
......
......@@ -6526,6 +6526,36 @@ UNINITIALIZED_TEST(OutOfMemoryIneffectiveGC) {
isolate->Dispose();
}
UNINITIALIZED_TEST(OutOfMemoryIneffectiveGCRunningJS) {
if (!FLAG_detect_ineffective_gcs_near_heap_limit) return;
if (FLAG_stress_incremental_marking) return;
FLAG_max_old_space_size = 5;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
oom_isolate = i_isolate;
isolate->SetOOMErrorHandler(OOMCallback);
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Context::New(isolate)->Enter();
// Test that source positions are not collected as part of a failing GC, which
// will fail as allocation is disallowed. If the test works, this should call
// OOMCallback and terminate without crashing.
CompileRun(R"javascript(
var array = [];
for(var i = 20000; i < 40000; ++i) {
array.push(new Array(i));
}
)javascript");
FATAL("Should not get here as OOMCallback should be called");
}
HEAP_TEST(Regress779503) {
// The following regression test ensures that the Scavenger does not allocate
// over invalid slots. More specific, the Scavenger should not sweep a page
......
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