Commit 0ee0a36e authored by antonm@chromium.org's avatar antonm@chromium.org

Add last OS error into heap stats.

That could allow us to understand why commit of from space sometimes fails.
Another option would be start a separate structure with OS-related info, but
as it's a single field, let's put it into HeapStats, at least for now.

Review URL: http://codereview.chromium.org/3118013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5261 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2399aca8
......@@ -174,6 +174,8 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
heap_stats.objects_per_type = objects_per_type;
int size_per_type[LAST_TYPE + 1] = {0};
heap_stats.size_per_type = size_per_type;
int os_error;
heap_stats.os_error = &os_error;
int end_marker;
heap_stats.end_marker = &end_marker;
i::Heap::RecordStats(&heap_stats, take_snapshot);
......
......@@ -4076,6 +4076,7 @@ void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
*stats->memory_allocator_size = MemoryAllocator::Size();
*stats->memory_allocator_capacity =
MemoryAllocator::Size() + MemoryAllocator::Available();
*stats->os_error = OS::GetLastError();
if (take_snapshot) {
HeapIterator iterator;
for (HeapObject* obj = iterator.next();
......
......@@ -1345,7 +1345,8 @@ class HeapStats {
int* memory_allocator_capacity; // 20
int* objects_per_type; // 21
int* size_per_type; // 22
int* end_marker; // 23
int* os_error; // 23
int* end_marker; // 24
};
......
......@@ -100,6 +100,12 @@ double OS::DaylightSavingsOffset(double time) {
}
int OS::GetLastError() {
UNIMPLEMENTED();
return 0;
}
// Returns the local time offset in milliseconds east of UTC without
// taking daylight savings time into account.
double OS::LocalTimeOffset() {
......
......@@ -108,6 +108,11 @@ double OS::DaylightSavingsOffset(double time) {
}
int OS::GetLastError() {
return errno;
}
// ----------------------------------------------------------------------------
// POSIX stdio support.
//
......
......@@ -651,6 +651,11 @@ double OS::DaylightSavingsOffset(double time) {
}
int OS::GetLastError() {
return ::GetLastError();
}
// ----------------------------------------------------------------------------
// Win32 console output.
//
......
......@@ -165,6 +165,9 @@ class OS {
// Returns the daylight savings offset for the given time.
static double DaylightSavingsOffset(double time);
// Returns last OS error.
static int GetLastError();
static FILE* FOpen(const char* path, const char* mode);
// Log file open mode is platform-dependent due to line ends issues.
......
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