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

Side by Side Diff: src/heap.cc

Issue 11971015: Skip stack trace formatting in case the global object is already dead. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 7273 matching lines...) Expand 10 before | Expand all | Expand 10 after
7284 MapWord first_word = object->map_word(); 7284 MapWord first_word = object->map_word();
7285 if (first_word.IsForwardingAddress()) { 7285 if (first_word.IsForwardingAddress()) {
7286 list_[i] = first_word.ToForwardingAddress(); 7286 list_[i] = first_word.ToForwardingAddress();
7287 } 7287 }
7288 } 7288 }
7289 } 7289 }
7290 7290
7291 7291
7292 // Unforwarded objects in new space are dead and removed from the list. 7292 // Unforwarded objects in new space are dead and removed from the list.
7293 void ErrorObjectList::UpdateReferencesInNewSpace(Heap* heap) { 7293 void ErrorObjectList::UpdateReferencesInNewSpace(Heap* heap) {
7294 if (list_.is_empty()) return;
7294 if (!nested_) { 7295 if (!nested_) {
7295 int write_index = 0; 7296 int write_index = 0;
7296 for (int i = 0; i < list_.length(); i++) { 7297 for (int i = 0; i < list_.length(); i++) {
7297 MapWord first_word = HeapObject::cast(list_[i])->map_word(); 7298 MapWord first_word = HeapObject::cast(list_[i])->map_word();
7298 if (first_word.IsForwardingAddress()) { 7299 if (first_word.IsForwardingAddress()) {
7299 list_[write_index++] = first_word.ToForwardingAddress(); 7300 list_[write_index++] = first_word.ToForwardingAddress();
7300 } 7301 }
7301 } 7302 }
7302 list_.Rewind(write_index); 7303 list_.Rewind(write_index);
7303 } else { 7304 } else {
7304 // If a GC is triggered during DeferredFormatStackTrace, we do not move 7305 // If a GC is triggered during DeferredFormatStackTrace, we do not move
7305 // objects in the list, just remove dead ones, as to not confuse the 7306 // objects in the list, just remove dead ones, as to not confuse the
7306 // loop in DeferredFormatStackTrace. 7307 // loop in DeferredFormatStackTrace.
7307 for (int i = 0; i < list_.length(); i++) { 7308 for (int i = 0; i < list_.length(); i++) {
7308 MapWord first_word = HeapObject::cast(list_[i])->map_word(); 7309 MapWord first_word = HeapObject::cast(list_[i])->map_word();
7309 list_[i] = first_word.IsForwardingAddress() 7310 list_[i] = first_word.IsForwardingAddress()
7310 ? first_word.ToForwardingAddress() 7311 ? first_word.ToForwardingAddress()
7311 : heap->the_hole_value(); 7312 : heap->the_hole_value();
7312 } 7313 }
7313 } 7314 }
7314 } 7315 }
7315 7316
7316 7317
7317 void ErrorObjectList::DeferredFormatStackTrace(Isolate* isolate) { 7318 void ErrorObjectList::DeferredFormatStackTrace(Isolate* isolate) {
7318 // If formatting the stack trace causes a GC, this method will be 7319 // If formatting the stack trace causes a GC, this method will be
7319 // recursively called. In that case, skip the recursive call, since 7320 // recursively called. In that case, skip the recursive call, since
7320 // the loop modifies the list while iterating over it. 7321 // the loop modifies the list while iterating over it.
7321 if (nested_ || isolate->has_pending_exception()) return; 7322 if (nested_ || list_.is_empty() || isolate->has_pending_exception()) return;
7323 // In rare cases some error objects are still alive even though the global
7324 // object provided by the embedder (WebKit) has already been collected.
7325 // Those error objects are going to die soon afterwards. Stop right here.
7326 if (isolate->context() == NULL) return;
7327 if (!isolate->global_proxy()->GetPrototype()->IsJSGlobalProxy()) return;
Michael Starzinger 2013/01/16 13:35:53 That is quite a hack that is going on here. I thin
7328
7322 nested_ = true; 7329 nested_ = true;
7323 HandleScope scope(isolate); 7330 HandleScope scope(isolate);
7324 Handle<String> stack_key = isolate->factory()->stack_symbol(); 7331 Handle<String> stack_key = isolate->factory()->stack_symbol();
7325 int write_index = 0; 7332 int write_index = 0;
7326 int budget = kBudgetPerGC; 7333 int budget = kBudgetPerGC;
7327 for (int i = 0; i < list_.length(); i++) { 7334 for (int i = 0; i < list_.length(); i++) {
7328 Object* object = list_[i]; 7335 Object* object = list_[i];
7329 JSFunction* getter_fun; 7336 JSFunction* getter_fun;
7330 7337
7331 { AssertNoAllocation assert; 7338 { AssertNoAllocation assert;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
7510 static_cast<int>(object_sizes_last_time_[index])); 7517 static_cast<int>(object_sizes_last_time_[index]));
7511 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7518 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7512 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7519 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7513 7520
7514 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7521 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7515 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7522 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7516 ClearObjectStats(); 7523 ClearObjectStats();
7517 } 7524 }
7518 7525
7519 } } // namespace v8::internal 7526 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698