| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 snapshots_uids_.Remove(reinterpret_cast<void*>(uid), | 630 snapshots_uids_.Remove(reinterpret_cast<void*>(uid), |
| 631 static_cast<uint32_t>(uid)); | 631 static_cast<uint32_t>(uid)); |
| 632 } | 632 } |
| 633 | 633 |
| 634 | 634 |
| 635 Handle<HeapObject> HeapSnapshotsCollection::FindHeapObjectById( | 635 Handle<HeapObject> HeapSnapshotsCollection::FindHeapObjectById( |
| 636 SnapshotObjectId id) { | 636 SnapshotObjectId id) { |
| 637 // First perform a full GC in order to avoid dead objects. | 637 // First perform a full GC in order to avoid dead objects. |
| 638 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 638 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 639 "HeapSnapshotsCollection::FindHeapObjectById"); | 639 "HeapSnapshotsCollection::FindHeapObjectById"); |
| 640 AssertNoAllocation no_allocation; | 640 DisallowHeapAllocation no_allocation; |
| 641 HeapObject* object = NULL; | 641 HeapObject* object = NULL; |
| 642 HeapIterator iterator(heap(), HeapIterator::kFilterUnreachable); | 642 HeapIterator iterator(heap(), HeapIterator::kFilterUnreachable); |
| 643 // Make sure that object with the given id is still reachable. | 643 // Make sure that object with the given id is still reachable. |
| 644 for (HeapObject* obj = iterator.next(); | 644 for (HeapObject* obj = iterator.next(); |
| 645 obj != NULL; | 645 obj != NULL; |
| 646 obj = iterator.next()) { | 646 obj = iterator.next()) { |
| 647 if (ids_.FindEntry(obj->address()) == id) { | 647 if (ids_.FindEntry(obj->address()) == id) { |
| 648 ASSERT(object == NULL); | 648 ASSERT(object == NULL); |
| 649 object = obj; | 649 object = obj; |
| 650 // Can't break -- kFilterUnreachable requires full heap traversal. | 650 // Can't break -- kFilterUnreachable requires full heap traversal. |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 if (global_object_name_resolver_) { | 1820 if (global_object_name_resolver_) { |
| 1821 HandleScope scope(isolate); | 1821 HandleScope scope(isolate); |
| 1822 Handle<JSGlobalObject> global_obj = enumerator.at(i); | 1822 Handle<JSGlobalObject> global_obj = enumerator.at(i); |
| 1823 urls[i] = global_object_name_resolver_->GetName( | 1823 urls[i] = global_object_name_resolver_->GetName( |
| 1824 Utils::ToLocal(Handle<JSObject>::cast(global_obj))); | 1824 Utils::ToLocal(Handle<JSObject>::cast(global_obj))); |
| 1825 } else { | 1825 } else { |
| 1826 urls[i] = NULL; | 1826 urls[i] = NULL; |
| 1827 } | 1827 } |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 AssertNoAllocation no_allocation; | 1830 DisallowHeapAllocation no_allocation; |
| 1831 for (int i = 0, l = enumerator.count(); i < l; ++i) { | 1831 for (int i = 0, l = enumerator.count(); i < l; ++i) { |
| 1832 objects_tags_.SetTag(*enumerator.at(i), urls[i]); | 1832 objects_tags_.SetTag(*enumerator.at(i), urls[i]); |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 DeleteArray(urls); | 1835 DeleteArray(urls); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| 1838 | 1838 |
| 1839 class GlobalHandlesExtractor : public ObjectVisitor { | 1839 class GlobalHandlesExtractor : public ObjectVisitor { |
| 1840 public: | 1840 public: |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 Heap* debug_heap = Isolate::Current()->heap(); | 2212 Heap* debug_heap = Isolate::Current()->heap(); |
| 2213 CHECK(!debug_heap->old_data_space()->was_swept_conservatively()); | 2213 CHECK(!debug_heap->old_data_space()->was_swept_conservatively()); |
| 2214 CHECK(!debug_heap->old_pointer_space()->was_swept_conservatively()); | 2214 CHECK(!debug_heap->old_pointer_space()->was_swept_conservatively()); |
| 2215 CHECK(!debug_heap->code_space()->was_swept_conservatively()); | 2215 CHECK(!debug_heap->code_space()->was_swept_conservatively()); |
| 2216 CHECK(!debug_heap->cell_space()->was_swept_conservatively()); | 2216 CHECK(!debug_heap->cell_space()->was_swept_conservatively()); |
| 2217 CHECK(!debug_heap->map_space()->was_swept_conservatively()); | 2217 CHECK(!debug_heap->map_space()->was_swept_conservatively()); |
| 2218 #endif | 2218 #endif |
| 2219 | 2219 |
| 2220 // The following code uses heap iterators, so we want the heap to be | 2220 // The following code uses heap iterators, so we want the heap to be |
| 2221 // stable. It should follow TagGlobalObjects as that can allocate. | 2221 // stable. It should follow TagGlobalObjects as that can allocate. |
| 2222 AssertNoAllocation no_alloc; | 2222 DisallowHeapAllocation no_alloc; |
| 2223 | 2223 |
| 2224 #ifdef VERIFY_HEAP | 2224 #ifdef VERIFY_HEAP |
| 2225 debug_heap->Verify(); | 2225 debug_heap->Verify(); |
| 2226 #endif | 2226 #endif |
| 2227 | 2227 |
| 2228 SetProgressTotal(1); // 1 pass. | 2228 SetProgressTotal(1); // 1 pass. |
| 2229 | 2229 |
| 2230 #ifdef VERIFY_HEAP | 2230 #ifdef VERIFY_HEAP |
| 2231 debug_heap->Verify(); | 2231 debug_heap->Verify(); |
| 2232 #endif | 2232 #endif |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 | 2658 |
| 2659 | 2659 |
| 2660 void HeapSnapshotJSONSerializer::SortHashMap( | 2660 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2661 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2661 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2662 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2662 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2663 sorted_entries->Add(p); | 2663 sorted_entries->Add(p); |
| 2664 sorted_entries->Sort(SortUsingEntryValue); | 2664 sorted_entries->Sort(SortUsingEntryValue); |
| 2665 } | 2665 } |
| 2666 | 2666 |
| 2667 } } // namespace v8::internal | 2667 } } // namespace v8::internal |
| OLD | NEW |