summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorMichael Dawson <michael_dawson@ca.ibm.com>2016-04-14 18:34:00 -0400
committerMichael Dawson <michael_dawson@ca.ibm.com>2016-04-18 15:49:55 -0400
commitaf4a380d400129560844eecc3bbd1208af19dfe7 (patch)
tree086d0edf73c1c82371f78b1b84b0c8ed0e3a1427 /deps
parentb7f4b1ba4cca320cf576aa73fae15902fd801190 (diff)
downloadandroid-node-v8-af4a380d400129560844eecc3bbd1208af19dfe7.tar.gz
android-node-v8-af4a380d400129560844eecc3bbd1208af19dfe7.tar.bz2
android-node-v8-af4a380d400129560844eecc3bbd1208af19dfe7.zip
deps: cherry-pick 1ef7487b from v8 upstream
Original commit message: Improved diagnostic message for JS heap out of memory This patch replaces the unused 'take_snapshot' parameter on FatalProcessOutOfMemory() with a 'is_heap_oom' parameter. The parameter is set to true on error paths where the JS heap is out of memory, as distinct from a malloc() failure i.e. process out of memory. The message output to stderr or passed to embedding applications via FatalErrorCallback is 'Javascript heap out of memory' rather than 'process out of memory'. BUG= R=jochen@chromium.org, verwaest@chromium.org, michael_dawson@ca.ibm.com Review URL: https://codereview.chromium.org/1873443002 Cr-Commit-Position: refs/heads/master@{#35431} We'd like this in 6.x to help with diagnosing customer problems. It provides a better message on OOM so that it is easier to be able to tell whether the OOM was due to heap exhaustion or running out of native memory. PR-URL: https://github.com/nodejs/node/pull/6218 Reviewed-By: Ben Noordhuis <ben@strongloop.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r--deps/v8/src/api.cc6
-rw-r--r--deps/v8/src/heap/heap.cc8
-rw-r--r--deps/v8/src/heap/heap.h2
-rw-r--r--deps/v8/src/heap/mark-compact.cc4
-rw-r--r--deps/v8/src/v8.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc
index a71dcfaec3..0247d950a7 100644
--- a/deps/v8/src/api.cc
+++ b/deps/v8/src/api.cc
@@ -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];
@@ -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");
}
diff --git a/deps/v8/src/heap/heap.cc b/deps/v8/src/heap/heap.cc
index ad6c451cbe..dad6ca6ebf 100644
--- a/deps/v8/src/heap/heap.cc
+++ b/deps/v8/src/heap/heap.cc
@@ -3969,8 +3969,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);
@@ -5501,9 +5500,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
diff --git a/deps/v8/src/heap/heap.h b/deps/v8/src/heap/heap.h
index 4a76777ecd..f8467ba8f9 100644
--- a/deps/v8/src/heap/heap.h
+++ b/deps/v8/src/heap/heap.h
@@ -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);
diff --git a/deps/v8/src/heap/mark-compact.cc b/deps/v8/src/heap/mark-compact.cc
index 646e63402a..641ac7d1dc 100644
--- a/deps/v8/src/heap/mark-compact.cc
+++ b/deps/v8/src/heap/mark-compact.cc
@@ -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;
}
diff --git a/deps/v8/src/v8.h b/deps/v8/src/v8.h
index 6016ef1419..a1b18b20d6 100644
--- a/deps/v8/src/v8.h
+++ b/deps/v8/src/v8.h
@@ -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();