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 { ...@@ -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 --- // --- 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 // When V8 cannot allocate memory FatalProcessOutOfMemory is called. The default
// OOM error handler is called and execution is stopped. // OOM error handler is called and execution is stopped.
void i::V8::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location, void i::V8::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location,
...@@ -4060,7 +4056,7 @@ std::unique_ptr<v8::BackingStore> v8::BackingStore::Reallocate( ...@@ -4060,7 +4056,7 @@ std::unique_ptr<v8::BackingStore> v8::BackingStore::Reallocate(
i::BackingStore* i_backing_store = i::BackingStore* i_backing_store =
reinterpret_cast<i::BackingStore*>(backing_store.get()); reinterpret_cast<i::BackingStore*>(backing_store.get());
if (!i_backing_store->Reallocate(i_isolate, byte_length)) { 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; return backing_store;
} }
...@@ -7975,7 +7971,7 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* v8_isolate, ...@@ -7975,7 +7971,7 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* v8_isolate,
if (!result.ToHandle(&array_buffer)) { if (!result.ToHandle(&array_buffer)) {
// TODO(jbroman): It may be useful in the future to provide a MaybeLocal // TODO(jbroman): It may be useful in the future to provide a MaybeLocal
// version that throws an exception or otherwise does not crash. // 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); return Utils::ToLocal(array_buffer);
...@@ -8009,7 +8005,8 @@ std::unique_ptr<v8::BackingStore> v8::ArrayBuffer::NewBackingStore( ...@@ -8009,7 +8005,8 @@ std::unique_ptr<v8::BackingStore> v8::ArrayBuffer::NewBackingStore(
i::SharedFlag::kNotShared, i::SharedFlag::kNotShared,
i::InitializedFlag::kZeroInitialized); i::InitializedFlag::kZeroInitialized);
if (!backing_store) { if (!backing_store) {
i::FatalProcessOutOfMemory(i_isolate, "v8::ArrayBuffer::NewBackingStore"); i::V8::FatalProcessOutOfMemory(i_isolate,
"v8::ArrayBuffer::NewBackingStore");
} }
return std::unique_ptr<v8::BackingStore>( return std::unique_ptr<v8::BackingStore>(
static_cast<v8::BackingStore*>(backing_store.release())); static_cast<v8::BackingStore*>(backing_store.release()));
...@@ -8172,7 +8169,7 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(Isolate* v8_isolate, ...@@ -8172,7 +8169,7 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(Isolate* v8_isolate,
if (!backing_store) { if (!backing_store) {
// TODO(jbroman): It may be useful in the future to provide a MaybeLocal // TODO(jbroman): It may be useful in the future to provide a MaybeLocal
// version that throws an exception or otherwise does not crash. // 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 = i::Handle<i::JSArrayBuffer> obj =
...@@ -8210,8 +8207,8 @@ std::unique_ptr<v8::BackingStore> v8::SharedArrayBuffer::NewBackingStore( ...@@ -8210,8 +8207,8 @@ std::unique_ptr<v8::BackingStore> v8::SharedArrayBuffer::NewBackingStore(
i::BackingStore::Allocate(i_isolate, byte_length, i::SharedFlag::kShared, i::BackingStore::Allocate(i_isolate, byte_length, i::SharedFlag::kShared,
i::InitializedFlag::kZeroInitialized); i::InitializedFlag::kZeroInitialized);
if (!backing_store) { if (!backing_store) {
i::FatalProcessOutOfMemory(i_isolate, i::V8::FatalProcessOutOfMemory(i_isolate,
"v8::SharedArrayBuffer::NewBackingStore"); "v8::SharedArrayBuffer::NewBackingStore");
} }
return std::unique_ptr<v8::BackingStore>( return std::unique_ptr<v8::BackingStore>(
static_cast<v8::BackingStore*>(backing_store.release())); static_cast<v8::BackingStore*>(backing_store.release()));
......
...@@ -236,8 +236,8 @@ UnifiedHeapConcurrentMarker::CreateConcurrentMarkingVisitor( ...@@ -236,8 +236,8 @@ UnifiedHeapConcurrentMarker::CreateConcurrentMarkingVisitor(
void FatalOutOfMemoryHandlerImpl(const std::string& reason, void FatalOutOfMemoryHandlerImpl(const std::string& reason,
const SourceLocation&, HeapBase* heap) { const SourceLocation&, HeapBase* heap) {
FatalProcessOutOfMemory(static_cast<v8::internal::CppHeap*>(heap)->isolate(), V8::FatalProcessOutOfMemory(
reason.c_str()); static_cast<v8::internal::CppHeap*>(heap)->isolate(), reason.c_str());
} }
} // namespace } // namespace
......
...@@ -26,9 +26,8 @@ class V8 : public AllStatic { ...@@ -26,9 +26,8 @@ class V8 : public AllStatic {
// This function will not return, but will terminate the execution. // This function will not return, but will terminate the execution.
// IMPORTANT: Update the Google-internal crash processer if this signature // IMPORTANT: Update the Google-internal crash processer if this signature
// changes to be able to extract detailed v8::internal::HeapStats on OOM. // changes to be able to extract detailed v8::internal::HeapStats on OOM.
[[noreturn]] static void FatalProcessOutOfMemory(Isolate* isolate, [[noreturn]] V8_EXPORT_PRIVATE static void FatalProcessOutOfMemory(
const char* location, Isolate* isolate, const char* location, bool is_heap_oom = false);
bool is_heap_oom = false);
#ifdef V8_SANDBOX #ifdef V8_SANDBOX
static bool InitializeSandbox(); static bool InitializeSandbox();
......
...@@ -3952,7 +3952,7 @@ RegExpNode* RegExpCompiler::PreprocessRegExp(RegExpCompileData* data, ...@@ -3952,7 +3952,7 @@ RegExpNode* RegExpCompiler::PreprocessRegExp(RegExpCompileData* data,
void RegExpCompiler::ToNodeCheckForStackOverflow() { void RegExpCompiler::ToNodeCheckForStackOverflow() {
if (StackLimitCheck{isolate()}.HasOverflowed()) { if (StackLimitCheck{isolate()}.HasOverflowed()) {
FatalProcessOutOfMemory(isolate(), "RegExpCompiler"); V8::FatalProcessOutOfMemory(isolate(), "RegExpCompiler");
} }
} }
......
...@@ -26,11 +26,6 @@ class Isolate; ...@@ -26,11 +26,6 @@ class Isolate;
// allocation fails, these functions call back into the embedder, then attempt // allocation fails, these functions call back into the embedder, then attempt
// the allocation a second time. The embedder callback must not reenter V8. // 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. // Superclass for classes managed with new & delete.
class V8_EXPORT_PRIVATE Malloced { class V8_EXPORT_PRIVATE Malloced {
public: public:
...@@ -44,7 +39,7 @@ T* NewArray(size_t size) { ...@@ -44,7 +39,7 @@ T* NewArray(size_t size) {
if (result == nullptr) { if (result == nullptr) {
V8::GetCurrentPlatform()->OnCriticalMemoryPressure(); V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
result = new (std::nothrow) T[size]; result = new (std::nothrow) T[size];
if (result == nullptr) FatalProcessOutOfMemory(nullptr, "NewArray"); if (result == nullptr) V8::FatalProcessOutOfMemory(nullptr, "NewArray");
} }
return result; 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