OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2466 private: | 2466 private: |
2467 List<Handle<JSGlobalObject> > objects_; | 2467 List<Handle<JSGlobalObject> > objects_; |
2468 }; | 2468 }; |
2469 | 2469 |
2470 | 2470 |
2471 // Modifies heap. Must not be run during heap traversal. | 2471 // Modifies heap. Must not be run during heap traversal. |
2472 void V8HeapExplorer::TagGlobalObjects() { | 2472 void V8HeapExplorer::TagGlobalObjects() { |
2473 Isolate* isolate = Isolate::Current(); | 2473 Isolate* isolate = Isolate::Current(); |
2474 GlobalObjectsEnumerator enumerator; | 2474 GlobalObjectsEnumerator enumerator; |
2475 isolate->global_handles()->IterateAllRoots(&enumerator); | 2475 isolate->global_handles()->IterateAllRoots(&enumerator); |
2476 HandleScope scope; | |
Erik Corry
2011/11/14 23:02:50
Perhaps better to have this in the loop. As it is
mnaganov (inactive)
2011/11/15 09:58:27
The number of global objects is usually limited. B
Vitaly Repeshko
2011/11/15 18:55:59
This is too late. Global object handles have alrea
mnaganov (inactive)
2011/11/15 19:56:18
A good catch! %)
| |
2476 Handle<String> document_string = | 2477 Handle<String> document_string = |
2477 isolate->factory()->NewStringFromAscii(CStrVector("document")); | 2478 isolate->factory()->NewStringFromAscii(CStrVector("document")); |
2478 Handle<String> url_string = | 2479 Handle<String> url_string = |
2479 isolate->factory()->NewStringFromAscii(CStrVector("URL")); | 2480 isolate->factory()->NewStringFromAscii(CStrVector("URL")); |
2480 const char** urls = NewArray<const char*>(enumerator.count()); | 2481 const char** urls = NewArray<const char*>(enumerator.count()); |
2481 for (int i = 0, l = enumerator.count(); i < l; ++i) { | 2482 for (int i = 0, l = enumerator.count(); i < l; ++i) { |
2482 urls[i] = NULL; | 2483 urls[i] = NULL; |
2483 Handle<JSGlobalObject> global_obj = enumerator.at(i); | 2484 Handle<JSGlobalObject> global_obj = enumerator.at(i); |
2484 Object* obj_document; | 2485 Object* obj_document; |
2485 if (global_obj->GetProperty(*document_string)->ToObject(&obj_document) && | 2486 if (global_obj->GetProperty(*document_string)->ToObject(&obj_document) && |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3441 | 3442 |
3442 | 3443 |
3443 void HeapSnapshotJSONSerializer::SortHashMap( | 3444 void HeapSnapshotJSONSerializer::SortHashMap( |
3444 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3445 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3445 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3446 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3446 sorted_entries->Add(p); | 3447 sorted_entries->Add(p); |
3447 sorted_entries->Sort(SortUsingEntryValue); | 3448 sorted_entries->Sort(SortUsingEntryValue); |
3448 } | 3449 } |
3449 | 3450 |
3450 } } // namespace v8::internal | 3451 } } // namespace v8::internal |
OLD | NEW |