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

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: fix leaks in the setter. 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 | « src/heap.h ('k') | src/isolate.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 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 7295 matching lines...) Expand 10 before | Expand all | Expand 10 after
7306 MapWord first_word = object->map_word(); 7306 MapWord first_word = object->map_word();
7307 if (first_word.IsForwardingAddress()) { 7307 if (first_word.IsForwardingAddress()) {
7308 list_[i] = first_word.ToForwardingAddress(); 7308 list_[i] = first_word.ToForwardingAddress();
7309 } 7309 }
7310 } 7310 }
7311 } 7311 }
7312 7312
7313 7313
7314 // Unforwarded objects in new space are dead and removed from the list. 7314 // Unforwarded objects in new space are dead and removed from the list.
7315 void ErrorObjectList::UpdateReferencesInNewSpace(Heap* heap) { 7315 void ErrorObjectList::UpdateReferencesInNewSpace(Heap* heap) {
7316 if (list_.is_empty()) return;
7316 if (!nested_) { 7317 if (!nested_) {
7317 int write_index = 0; 7318 int write_index = 0;
7318 for (int i = 0; i < list_.length(); i++) { 7319 for (int i = 0; i < list_.length(); i++) {
7319 MapWord first_word = HeapObject::cast(list_[i])->map_word(); 7320 MapWord first_word = HeapObject::cast(list_[i])->map_word();
7320 if (first_word.IsForwardingAddress()) { 7321 if (first_word.IsForwardingAddress()) {
7321 list_[write_index++] = first_word.ToForwardingAddress(); 7322 list_[write_index++] = first_word.ToForwardingAddress();
7322 } 7323 }
7323 } 7324 }
7324 list_.Rewind(write_index); 7325 list_.Rewind(write_index);
7325 } else { 7326 } else {
7326 // If a GC is triggered during DeferredFormatStackTrace, we do not move 7327 // If a GC is triggered during DeferredFormatStackTrace, we do not move
7327 // objects in the list, just remove dead ones, as to not confuse the 7328 // objects in the list, just remove dead ones, as to not confuse the
7328 // loop in DeferredFormatStackTrace. 7329 // loop in DeferredFormatStackTrace.
7329 for (int i = 0; i < list_.length(); i++) { 7330 for (int i = 0; i < list_.length(); i++) {
7330 MapWord first_word = HeapObject::cast(list_[i])->map_word(); 7331 MapWord first_word = HeapObject::cast(list_[i])->map_word();
7331 list_[i] = first_word.IsForwardingAddress() 7332 list_[i] = first_word.IsForwardingAddress()
7332 ? first_word.ToForwardingAddress() 7333 ? first_word.ToForwardingAddress()
7333 : heap->the_hole_value(); 7334 : heap->the_hole_value();
7334 } 7335 }
7335 } 7336 }
7336 } 7337 }
7337 7338
7338 7339
7339 void ErrorObjectList::DeferredFormatStackTrace(Isolate* isolate) { 7340 void ErrorObjectList::DeferredFormatStackTrace(Isolate* isolate) {
7340 // If formatting the stack trace causes a GC, this method will be 7341 // If formatting the stack trace causes a GC, this method will be
7341 // recursively called. In that case, skip the recursive call, since 7342 // recursively called. In that case, skip the recursive call, since
7342 // the loop modifies the list while iterating over it. 7343 // the loop modifies the list while iterating over it.
7343 if (nested_ || isolate->has_pending_exception()) return; 7344 if (nested_ || list_.is_empty() || isolate->has_pending_exception()) return;
7344 nested_ = true; 7345 nested_ = true;
7345 HandleScope scope(isolate); 7346 HandleScope scope(isolate);
7346 Handle<String> stack_key = isolate->factory()->stack_symbol(); 7347 Handle<String> stack_key = isolate->factory()->stack_symbol();
7347 int write_index = 0; 7348 int write_index = 0;
7348 int budget = kBudgetPerGC; 7349 int budget = kBudgetPerGC;
7349 for (int i = 0; i < list_.length(); i++) { 7350 for (int i = 0; i < list_.length(); i++) {
7350 Object* object = list_[i]; 7351 Object* object = list_[i];
7351 JSFunction* getter_fun; 7352 JSFunction* getter_fun;
7352 7353
7353 { AssertNoAllocation assert; 7354 { AssertNoAllocation assert;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
7532 static_cast<int>(object_sizes_last_time_[index])); 7533 static_cast<int>(object_sizes_last_time_[index]));
7533 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7534 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7534 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7535 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7535 7536
7536 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7537 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7537 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7538 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7538 ClearObjectStats(); 7539 ClearObjectStats();
7539 } 7540 }
7540 7541
7541 } } // namespace v8::internal 7542 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698