Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: src/api.cc

Issue 3046049: Add information about memory allocator's size and capacity and heap snapshot into heap stats. (Closed)
Patch Set: Slava's variant of wording Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (exception_behavior == NULL) { 119 if (exception_behavior == NULL) {
120 exception_behavior = DefaultFatalErrorHandler; 120 exception_behavior = DefaultFatalErrorHandler;
121 } 121 }
122 return exception_behavior; 122 return exception_behavior;
123 } 123 }
124 124
125 125
126 126
127 // When V8 cannot allocated memory FatalProcessOutOfMemory is called. 127 // When V8 cannot allocated memory FatalProcessOutOfMemory is called.
128 // The default fatal error handler is called and execution is stopped. 128 // The default fatal error handler is called and execution is stopped.
129 void i::V8::FatalProcessOutOfMemory(const char* location) { 129 void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
130 i::HeapStats heap_stats; 130 i::HeapStats heap_stats;
131 int start_marker; 131 int start_marker;
132 heap_stats.start_marker = &start_marker; 132 heap_stats.start_marker = &start_marker;
133 int new_space_size; 133 int new_space_size;
134 heap_stats.new_space_size = &new_space_size; 134 heap_stats.new_space_size = &new_space_size;
135 int new_space_capacity; 135 int new_space_capacity;
136 heap_stats.new_space_capacity = &new_space_capacity; 136 heap_stats.new_space_capacity = &new_space_capacity;
137 int old_pointer_space_size; 137 int old_pointer_space_size;
138 heap_stats.old_pointer_space_size = &old_pointer_space_size; 138 heap_stats.old_pointer_space_size = &old_pointer_space_size;
139 int old_pointer_space_capacity; 139 int old_pointer_space_capacity;
(...skipping 19 matching lines...) Expand all
159 int global_handle_count; 159 int global_handle_count;
160 heap_stats.global_handle_count = &global_handle_count; 160 heap_stats.global_handle_count = &global_handle_count;
161 int weak_global_handle_count; 161 int weak_global_handle_count;
162 heap_stats.weak_global_handle_count = &weak_global_handle_count; 162 heap_stats.weak_global_handle_count = &weak_global_handle_count;
163 int pending_global_handle_count; 163 int pending_global_handle_count;
164 heap_stats.pending_global_handle_count = &pending_global_handle_count; 164 heap_stats.pending_global_handle_count = &pending_global_handle_count;
165 int near_death_global_handle_count; 165 int near_death_global_handle_count;
166 heap_stats.near_death_global_handle_count = &near_death_global_handle_count; 166 heap_stats.near_death_global_handle_count = &near_death_global_handle_count;
167 int destroyed_global_handle_count; 167 int destroyed_global_handle_count;
168 heap_stats.destroyed_global_handle_count = &destroyed_global_handle_count; 168 heap_stats.destroyed_global_handle_count = &destroyed_global_handle_count;
169 int memory_allocator_size;
170 heap_stats.memory_allocator_size = &memory_allocator_size;
171 int memory_allocator_capacity;
172 heap_stats.memory_allocator_capacity = &memory_allocator_capacity;
173 int objects_per_type[LAST_TYPE + 1] = {0};
174 heap_stats.objects_per_type = objects_per_type;
175 int size_per_type[LAST_TYPE + 1] = {0};
176 heap_stats.size_per_type = size_per_type;
169 int end_marker; 177 int end_marker;
170 heap_stats.end_marker = &end_marker; 178 heap_stats.end_marker = &end_marker;
171 i::Heap::RecordStats(&heap_stats); 179 i::Heap::RecordStats(&heap_stats, take_snapshot);
172 i::V8::SetFatalError(); 180 i::V8::SetFatalError();
173 FatalErrorCallback callback = GetFatalErrorHandler(); 181 FatalErrorCallback callback = GetFatalErrorHandler();
174 { 182 {
175 LEAVE_V8; 183 LEAVE_V8;
176 callback(location, "Allocation failed - process out of memory"); 184 callback(location, "Allocation failed - process out of memory");
177 } 185 }
178 // If the callback returns, we stop execution. 186 // If the callback returns, we stop execution.
179 UNREACHABLE(); 187 UNREACHABLE();
180 } 188 }
181 189
(...skipping 4604 matching lines...) Expand 10 before | Expand all | Expand 10 after
4786 4794
4787 4795
4788 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 4796 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
4789 HandleScopeImplementer* thread_local = 4797 HandleScopeImplementer* thread_local =
4790 reinterpret_cast<HandleScopeImplementer*>(storage); 4798 reinterpret_cast<HandleScopeImplementer*>(storage);
4791 thread_local->IterateThis(v); 4799 thread_local->IterateThis(v);
4792 return storage + ArchiveSpacePerThread(); 4800 return storage + ArchiveSpacePerThread();
4793 } 4801 }
4794 4802
4795 } } // namespace v8::internal 4803 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698