Commit 5d48c41f authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

Remove redundant (internal) FatalProcessOutOfMemory

Use V8::FatalProcessOutOfMemory directly instead.

R=mlippautz@chromium.org

Bug: chromium:1323177
Change-Id: Ib1efd9e8099c76cd9ae0ac412b2e37307a698f4f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3641176Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80517}
parent d7e08eb3
......@@ -204,10 +204,6 @@ Local<PrimitiveArray> ScriptOrigin::HostDefinedOptions() const {
// --- E x c e p t i o n B e h a v i o r ---
void i::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location) {
i::V8::FatalProcessOutOfMemory(i_isolate, location, false);
}
// When V8 cannot allocate memory FatalProcessOutOfMemory is called. The default
// OOM error handler is called and execution is stopped.
void i::V8::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location,
......@@ -4060,7 +4056,7 @@ std::unique_ptr<v8::BackingStore> v8::BackingStore::Reallocate(
i::BackingStore* i_backing_store =
reinterpret_cast<i::BackingStore*>(backing_store.get());
if (!i_backing_store->Reallocate(i_isolate, byte_length)) {
i::FatalProcessOutOfMemory(i_isolate, "v8::BackingStore::Reallocate");
i::V8::FatalProcessOutOfMemory(i_isolate, "v8::BackingStore::Reallocate");
}
return backing_store;
}
......@@ -7975,7 +7971,7 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* v8_isolate,
if (!result.ToHandle(&array_buffer)) {
// TODO(jbroman): It may be useful in the future to provide a MaybeLocal
// version that throws an exception or otherwise does not crash.
i::FatalProcessOutOfMemory(i_isolate, "v8::ArrayBuffer::New");
i::V8::FatalProcessOutOfMemory(i_isolate, "v8::ArrayBuffer::New");
}
return Utils::ToLocal(array_buffer);
......@@ -8009,7 +8005,8 @@ std::unique_ptr<v8::BackingStore> v8::ArrayBuffer::NewBackingStore(
i::SharedFlag::kNotShared,
i::InitializedFlag::kZeroInitialized);
if (!backing_store) {
i::FatalProcessOutOfMemory(i_isolate, "v8::ArrayBuffer::NewBackingStore");
i::V8::FatalProcessOutOfMemory(i_isolate,
"v8::ArrayBuffer::NewBackingStore");
}
return std::unique_ptr<v8::BackingStore>(
static_cast<v8::BackingStore*>(backing_store.release()));
......@@ -8172,7 +8169,7 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(Isolate* v8_isolate,
if (!backing_store) {
// TODO(jbroman): It may be useful in the future to provide a MaybeLocal
// version that throws an exception or otherwise does not crash.
i::FatalProcessOutOfMemory(i_isolate, "v8::SharedArrayBuffer::New");
i::V8::FatalProcessOutOfMemory(i_isolate, "v8::SharedArrayBuffer::New");
}
i::Handle<i::JSArrayBuffer> obj =
......@@ -8210,8 +8207,8 @@ std::unique_ptr<v8::BackingStore> v8::SharedArrayBuffer::NewBackingStore(
i::BackingStore::Allocate(i_isolate, byte_length, i::SharedFlag::kShared,
i::InitializedFlag::kZeroInitialized);
if (!backing_store) {
i::FatalProcessOutOfMemory(i_isolate,
"v8::SharedArrayBuffer::NewBackingStore");
i::V8::FatalProcessOutOfMemory(i_isolate,
"v8::SharedArrayBuffer::NewBackingStore");
}
return std::unique_ptr<v8::BackingStore>(
static_cast<v8::BackingStore*>(backing_store.release()));
......
......@@ -236,8 +236,8 @@ UnifiedHeapConcurrentMarker::CreateConcurrentMarkingVisitor(
void FatalOutOfMemoryHandlerImpl(const std::string& reason,
const SourceLocation&, HeapBase* heap) {
FatalProcessOutOfMemory(static_cast<v8::internal::CppHeap*>(heap)->isolate(),
reason.c_str());
V8::FatalProcessOutOfMemory(
static_cast<v8::internal::CppHeap*>(heap)->isolate(), reason.c_str());
}
} // namespace
......
......@@ -26,9 +26,8 @@ class V8 : public AllStatic {
// This function will not return, but will terminate the execution.
// IMPORTANT: Update the Google-internal crash processer if this signature
// changes to be able to extract detailed v8::internal::HeapStats on OOM.
[[noreturn]] static void FatalProcessOutOfMemory(Isolate* isolate,
const char* location,
bool is_heap_oom = false);
[[noreturn]] V8_EXPORT_PRIVATE static void FatalProcessOutOfMemory(
Isolate* isolate, const char* location, bool is_heap_oom = false);
#ifdef V8_SANDBOX
static bool InitializeSandbox();
......
......@@ -3952,7 +3952,7 @@ RegExpNode* RegExpCompiler::PreprocessRegExp(RegExpCompileData* data,
void RegExpCompiler::ToNodeCheckForStackOverflow() {
if (StackLimitCheck{isolate()}.HasOverflowed()) {
FatalProcessOutOfMemory(isolate(), "RegExpCompiler");
V8::FatalProcessOutOfMemory(isolate(), "RegExpCompiler");
}
}
......
......@@ -26,11 +26,6 @@ class Isolate;
// allocation fails, these functions call back into the embedder, then attempt
// the allocation a second time. The embedder callback must not reenter V8.
// Called when allocation routines fail to allocate, even with a possible retry.
// This function should not return, but should terminate the current processing.
[[noreturn]] V8_EXPORT_PRIVATE void FatalProcessOutOfMemory(
Isolate* isolate, const char* message);
// Superclass for classes managed with new & delete.
class V8_EXPORT_PRIVATE Malloced {
public:
......@@ -44,7 +39,7 @@ T* NewArray(size_t size) {
if (result == nullptr) {
V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
result = new (std::nothrow) T[size];
if (result == nullptr) FatalProcessOutOfMemory(nullptr, "NewArray");
if (result == nullptr) V8::FatalProcessOutOfMemory(nullptr, "NewArray");
}
return result;
}
......
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