| OLD | NEW |
| 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 7270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7281 MapWord first_word = object->map_word(); | 7281 MapWord first_word = object->map_word(); |
| 7282 if (first_word.IsForwardingAddress()) { | 7282 if (first_word.IsForwardingAddress()) { |
| 7283 list_[i] = first_word.ToForwardingAddress(); | 7283 list_[i] = first_word.ToForwardingAddress(); |
| 7284 } | 7284 } |
| 7285 } | 7285 } |
| 7286 } | 7286 } |
| 7287 | 7287 |
| 7288 | 7288 |
| 7289 // Unforwarded objects in new space are dead and removed from the list. | 7289 // Unforwarded objects in new space are dead and removed from the list. |
| 7290 void ErrorObjectList::UpdateReferencesInNewSpace(Heap* heap) { | 7290 void ErrorObjectList::UpdateReferencesInNewSpace(Heap* heap) { |
| 7291 if (list_.is_empty()) return; |
| 7291 if (!nested_) { | 7292 if (!nested_) { |
| 7292 int write_index = 0; | 7293 int write_index = 0; |
| 7293 for (int i = 0; i < list_.length(); i++) { | 7294 for (int i = 0; i < list_.length(); i++) { |
| 7294 MapWord first_word = HeapObject::cast(list_[i])->map_word(); | 7295 MapWord first_word = HeapObject::cast(list_[i])->map_word(); |
| 7295 if (first_word.IsForwardingAddress()) { | 7296 if (first_word.IsForwardingAddress()) { |
| 7296 list_[write_index++] = first_word.ToForwardingAddress(); | 7297 list_[write_index++] = first_word.ToForwardingAddress(); |
| 7297 } | 7298 } |
| 7298 } | 7299 } |
| 7299 list_.Rewind(write_index); | 7300 list_.Rewind(write_index); |
| 7300 } else { | 7301 } else { |
| 7301 // If a GC is triggered during DeferredFormatStackTrace, we do not move | 7302 // If a GC is triggered during DeferredFormatStackTrace, we do not move |
| 7302 // objects in the list, just remove dead ones, as to not confuse the | 7303 // objects in the list, just remove dead ones, as to not confuse the |
| 7303 // loop in DeferredFormatStackTrace. | 7304 // loop in DeferredFormatStackTrace. |
| 7304 for (int i = 0; i < list_.length(); i++) { | 7305 for (int i = 0; i < list_.length(); i++) { |
| 7305 MapWord first_word = HeapObject::cast(list_[i])->map_word(); | 7306 MapWord first_word = HeapObject::cast(list_[i])->map_word(); |
| 7306 list_[i] = first_word.IsForwardingAddress() | 7307 list_[i] = first_word.IsForwardingAddress() |
| 7307 ? first_word.ToForwardingAddress() | 7308 ? first_word.ToForwardingAddress() |
| 7308 : heap->the_hole_value(); | 7309 : heap->the_hole_value(); |
| 7309 } | 7310 } |
| 7310 } | 7311 } |
| 7311 } | 7312 } |
| 7312 | 7313 |
| 7313 | 7314 |
| 7314 void ErrorObjectList::DeferredFormatStackTrace(Isolate* isolate) { | 7315 void ErrorObjectList::DeferredFormatStackTrace(Isolate* isolate) { |
| 7315 // If formatting the stack trace causes a GC, this method will be | 7316 // If formatting the stack trace causes a GC, this method will be |
| 7316 // recursively called. In that case, skip the recursive call, since | 7317 // recursively called. In that case, skip the recursive call, since |
| 7317 // the loop modifies the list while iterating over it. | 7318 // the loop modifies the list while iterating over it. |
| 7318 if (nested_ || isolate->has_pending_exception()) return; | 7319 if (nested_ || list_.is_empty() || isolate->has_pending_exception()) return; |
| 7319 nested_ = true; | 7320 nested_ = true; |
| 7320 HandleScope scope(isolate); | 7321 HandleScope scope(isolate); |
| 7321 Handle<String> stack_key = isolate->factory()->stack_symbol(); | 7322 Handle<String> stack_key = isolate->factory()->stack_symbol(); |
| 7322 int write_index = 0; | 7323 int write_index = 0; |
| 7323 int budget = kBudgetPerGC; | 7324 int budget = kBudgetPerGC; |
| 7324 for (int i = 0; i < list_.length(); i++) { | 7325 for (int i = 0; i < list_.length(); i++) { |
| 7325 Object* object = list_[i]; | 7326 Object* object = list_[i]; |
| 7326 JSFunction* getter_fun; | 7327 JSFunction* getter_fun; |
| 7327 | 7328 |
| 7328 { AssertNoAllocation assert; | 7329 { AssertNoAllocation assert; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7507 static_cast<int>(object_sizes_last_time_[index])); | 7508 static_cast<int>(object_sizes_last_time_[index])); |
| 7508 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7509 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7509 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7510 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7510 | 7511 |
| 7511 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7512 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7512 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7513 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7513 ClearObjectStats(); | 7514 ClearObjectStats(); |
| 7514 } | 7515 } |
| 7515 | 7516 |
| 7516 } } // namespace v8::internal | 7517 } } // namespace v8::internal |
| OLD | NEW |