Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Commit

Permalink
v8z: cherry-pick 1ef7487b from V8 upstream 5.2.22
Browse files Browse the repository at this point in the history
Node PR: nodejs#6218 Commit: 98826b3
  • Loading branch information
gibfahn committed Apr 28, 2016
1 parent c68da99 commit 036de2a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 4 additions & 2 deletions deps/v8z/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void i::FatalProcessOutOfMemory(const char* location) {

// When V8 cannot allocated memory FatalProcessOutOfMemory is called.
// The default fatal error handler is called and execution is stopped.
void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
void i::V8::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
i::Isolate* isolate = i::Isolate::Current();
char last_few_messages[Heap::kTraceRingBufferSize + 1];
char js_stacktrace[Heap::kStacktraceBufferSize + 1];
Expand Down Expand Up @@ -288,7 +288,9 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
PrintF("\n<--- Last few GCs --->\n%s\n", first_newline);
PrintF("\n<--- JS stacktrace --->\n%s\n", js_stacktrace);
}
Utils::ApiCheck(false, location, "Allocation failed - process out of memory");
Utils::ApiCheck(false, location, is_heap_oom
? "Allocation failed - JavaScript heap out of memory"
: "Allocation failed - process out of memory");
// If the fatal error handler returns, we stop execution.
FATAL("API fatal error handler returned after process out of memory");
}
Expand Down
8 changes: 3 additions & 5 deletions deps/v8z/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3972,8 +3972,7 @@ AllocationResult Heap::AllocateUninitializedFixedDoubleArray(
AllocationResult Heap::AllocateRawFixedDoubleArray(int length,
PretenureFlag pretenure) {
if (length < 0 || length > FixedDoubleArray::kMaxLength) {
v8::internal::Heap::FatalProcessOutOfMemory("invalid array length",
kDoubleAligned);
v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
}
int size = FixedDoubleArray::SizeFor(length);
AllocationSpace space = SelectSpace(pretenure);
Expand Down Expand Up @@ -5504,9 +5503,8 @@ void Heap::CompactRetainedMaps(ArrayList* retained_maps) {
if (new_length != length) retained_maps->SetLength(new_length);
}


void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot);
void Heap::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
v8::internal::V8::FatalProcessOutOfMemory(location, is_heap_oom);
}

#ifdef DEBUG
Expand Down
2 changes: 1 addition & 1 deletion deps/v8z/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ class Heap {
static inline bool IsOneByte(T t, int chars);

static void FatalProcessOutOfMemory(const char* location,
bool take_snapshot = false);
bool is_heap_oom = false);

static bool RootIsImmortalImmovable(int root_index);

Expand Down
4 changes: 2 additions & 2 deletions deps/v8z/src/heap/mark-compact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,8 @@ class MarkCompactCollector::EvacuateNewSpaceVisitor final
compaction_spaces_->Get(OLD_SPACE)->AllocateRaw(size_in_bytes,
alignment);
if (allocation.IsRetry()) {
FatalProcessOutOfMemory(
"MarkCompactCollector: semi-space copy, fallback in old gen\n");
v8::internal::Heap::FatalProcessOutOfMemory(
"MarkCompactCollector: semi-space copy, fallback in old gen", true);
}
return allocation;
}
Expand Down
2 changes: 1 addition & 1 deletion deps/v8z/src/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class V8 : public AllStatic {
// Report process out of memory. Implementation found in api.cc.
// This function will not return, but will terminate the execution.
static void FatalProcessOutOfMemory(const char* location,
bool take_snapshot = false);
bool is_heap_oom = false);

static void InitializePlatform(v8::Platform* platform);
static void ShutdownPlatform();
Expand Down

0 comments on commit 036de2a

Please sign in to comment.