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

Side by Side Diff: src/api.cc

Issue 460069: Changed recording of heap stats on OOM to store data directly in local (Closed)
Patch Set: Review fixes Created 11 years 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/global-handles.cc » ('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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (exception_behavior == NULL) { 118 if (exception_behavior == NULL) {
119 exception_behavior = DefaultFatalErrorHandler; 119 exception_behavior = DefaultFatalErrorHandler;
120 } 120 }
121 return exception_behavior; 121 return exception_behavior;
122 } 122 }
123 123
124 124
125 125
126 // When V8 cannot allocated memory FatalProcessOutOfMemory is called. 126 // When V8 cannot allocated memory FatalProcessOutOfMemory is called.
127 // The default fatal error handler is called and execution is stopped. 127 // The default fatal error handler is called and execution is stopped.
128 static void ExecuteFatalProcessOutOfMemory(const char* location, 128 void i::V8::FatalProcessOutOfMemory(const char* location) {
129 i::HeapStats* heap_stats) { 129 i::HeapStats heap_stats;
130 int start_marker;
131 heap_stats.start_marker = &start_marker;
132 int new_space_size;
133 heap_stats.new_space_size = &new_space_size;
134 int new_space_capacity;
135 heap_stats.new_space_capacity = &new_space_capacity;
136 int old_pointer_space_size;
137 heap_stats.old_pointer_space_size = &old_pointer_space_size;
138 int old_pointer_space_capacity;
139 heap_stats.old_pointer_space_capacity = &old_pointer_space_capacity;
140 int old_data_space_size;
141 heap_stats.old_data_space_size = &old_data_space_size;
142 int old_data_space_capacity;
143 heap_stats.old_data_space_capacity = &old_data_space_capacity;
144 int code_space_size;
145 heap_stats.code_space_size = &code_space_size;
146 int code_space_capacity;
147 heap_stats.code_space_capacity = &code_space_capacity;
148 int map_space_size;
149 heap_stats.map_space_size = &map_space_size;
150 int map_space_capacity;
151 heap_stats.map_space_capacity = &map_space_capacity;
152 int cell_space_size;
153 heap_stats.cell_space_size = &cell_space_size;
154 int cell_space_capacity;
155 heap_stats.cell_space_capacity = &cell_space_capacity;
156 int lo_space_size;
157 heap_stats.lo_space_size = &lo_space_size;
158 int global_handle_count;
159 heap_stats.global_handle_count = &global_handle_count;
160 int weak_global_handle_count;
161 heap_stats.weak_global_handle_count = &weak_global_handle_count;
162 int pending_global_handle_count;
163 heap_stats.pending_global_handle_count = &pending_global_handle_count;
164 int near_death_global_handle_count;
165 heap_stats.near_death_global_handle_count = &near_death_global_handle_count;
166 int destroyed_global_handle_count;
167 heap_stats.destroyed_global_handle_count = &destroyed_global_handle_count;
168 int end_marker;
169 heap_stats.end_marker = &end_marker;
170 i::Heap::RecordStats(&heap_stats);
130 i::V8::SetFatalError(); 171 i::V8::SetFatalError();
131 FatalErrorCallback callback = GetFatalErrorHandler(); 172 FatalErrorCallback callback = GetFatalErrorHandler();
132 { 173 {
133 LEAVE_V8; 174 LEAVE_V8;
134 callback(location, "Allocation failed - process out of memory"); 175 callback(location, "Allocation failed - process out of memory");
135 } 176 }
136 // If the callback returns, we stop execution. 177 // If the callback returns, we stop execution.
137 UNREACHABLE(); 178 UNREACHABLE();
138 } 179 }
139 180
140 181
141 void i::V8::FatalProcessOutOfMemory(const char* location) {
142 i::HeapStats heap_stats;
143 i::Heap::RecordStats(&heap_stats);
144 ExecuteFatalProcessOutOfMemory(location, &heap_stats);
145 }
146
147
148 void V8::SetFatalErrorHandler(FatalErrorCallback that) { 182 void V8::SetFatalErrorHandler(FatalErrorCallback that) {
149 exception_behavior = that; 183 exception_behavior = that;
150 } 184 }
151 185
152 186
153 bool Utils::ReportApiFailure(const char* location, const char* message) { 187 bool Utils::ReportApiFailure(const char* location, const char* message) {
154 FatalErrorCallback callback = GetFatalErrorHandler(); 188 FatalErrorCallback callback = GetFatalErrorHandler();
155 callback(location, message); 189 callback(location, message);
156 i::V8::SetFatalError(); 190 i::V8::SetFatalError();
157 return false; 191 return false;
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3874 3908
3875 3909
3876 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 3910 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3877 HandleScopeImplementer* thread_local = 3911 HandleScopeImplementer* thread_local =
3878 reinterpret_cast<HandleScopeImplementer*>(storage); 3912 reinterpret_cast<HandleScopeImplementer*>(storage);
3879 thread_local->IterateThis(v); 3913 thread_local->IterateThis(v);
3880 return storage + ArchiveSpacePerThread(); 3914 return storage + ArchiveSpacePerThread();
3881 } 3915 }
3882 3916
3883 } } // namespace v8::internal 3917 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698