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 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 int count() { return objects_.length(); } | 2463 int count() { return objects_.length(); } |
2464 Handle<JSGlobalObject>& at(int i) { return objects_[i]; } | 2464 Handle<JSGlobalObject>& at(int i) { return objects_[i]; } |
2465 | 2465 |
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 HandleScope scope; |
2473 Isolate* isolate = Isolate::Current(); | 2474 Isolate* isolate = Isolate::Current(); |
2474 GlobalObjectsEnumerator enumerator; | 2475 GlobalObjectsEnumerator enumerator; |
2475 isolate->global_handles()->IterateAllRoots(&enumerator); | 2476 isolate->global_handles()->IterateAllRoots(&enumerator); |
2476 HandleScope scope; | |
2477 Handle<String> document_string = | 2477 Handle<String> document_string = |
2478 isolate->factory()->NewStringFromAscii(CStrVector("document")); | 2478 isolate->factory()->NewStringFromAscii(CStrVector("document")); |
2479 Handle<String> url_string = | 2479 Handle<String> url_string = |
2480 isolate->factory()->NewStringFromAscii(CStrVector("URL")); | 2480 isolate->factory()->NewStringFromAscii(CStrVector("URL")); |
2481 const char** urls = NewArray<const char*>(enumerator.count()); | 2481 const char** urls = NewArray<const char*>(enumerator.count()); |
2482 for (int i = 0, l = enumerator.count(); i < l; ++i) { | 2482 for (int i = 0, l = enumerator.count(); i < l; ++i) { |
2483 urls[i] = NULL; | 2483 urls[i] = NULL; |
2484 HandleScope scope; | 2484 HandleScope scope; |
2485 Handle<JSGlobalObject> global_obj = enumerator.at(i); | 2485 Handle<JSGlobalObject> global_obj = enumerator.at(i); |
2486 Object* obj_document; | 2486 Object* obj_document; |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 | 3443 |
3444 | 3444 |
3445 void HeapSnapshotJSONSerializer::SortHashMap( | 3445 void HeapSnapshotJSONSerializer::SortHashMap( |
3446 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3446 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3447 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3447 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3448 sorted_entries->Add(p); | 3448 sorted_entries->Add(p); |
3449 sorted_entries->Sort(SortUsingEntryValue); | 3449 sorted_entries->Sort(SortUsingEntryValue); |
3450 } | 3450 } |
3451 | 3451 |
3452 } } // namespace v8::internal | 3452 } } // namespace v8::internal |
OLD | NEW |