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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 1992913004: [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-log.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 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 const v8::HeapSnapshot* snapshot1 = heap_profiler->TakeHeapSnapshot(); 698 const v8::HeapSnapshot* snapshot1 = heap_profiler->TakeHeapSnapshot();
699 CHECK(ValidateSnapshot(snapshot1)); 699 CHECK(ValidateSnapshot(snapshot1));
700 v8::SnapshotObjectId maxId1 = snapshot1->GetMaxSnapshotJSObjectId(); 700 v8::SnapshotObjectId maxId1 = snapshot1->GetMaxSnapshotJSObjectId();
701 701
702 CompileRun( 702 CompileRun(
703 "for (var i = 0; i < 10000; ++i)\n" 703 "for (var i = 0; i < 10000; ++i)\n"
704 " a[i] = new A();\n"); 704 " a[i] = new A();\n");
705 CcTest::heap()->CollectAllGarbage(); 705 CcTest::heap()->CollectAllGarbage();
706 706
707 const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot(); 707 const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot();
708 CHECK(ValidateSnapshot(snapshot2));
709 const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2); 708 const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2);
710 709
711 const v8::HeapGraphNode* array_node = 710 const v8::HeapGraphNode* array_node =
712 GetProperty(global2, v8::HeapGraphEdge::kProperty, "a"); 711 GetProperty(global2, v8::HeapGraphEdge::kProperty, "a");
713 CHECK(array_node); 712 CHECK(array_node);
714 int wrong_count = 0; 713 int wrong_count = 0;
715 for (int i = 0, count = array_node->GetChildrenCount(); i < count; ++i) { 714 for (int i = 0, count = array_node->GetChildrenCount(); i < count; ++i) {
716 const v8::HeapGraphEdge* prop = array_node->GetChild(i); 715 const v8::HeapGraphEdge* prop = array_node->GetChild(i);
717 if (prop->GetType() != v8::HeapGraphEdge::kElement) 716 if (prop->GetType() != v8::HeapGraphEdge::kElement)
718 continue; 717 continue;
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 " a[i] = i;\n" 3048 " a[i] = i;\n"
3050 " for (var i = 0; i < 3; ++i)\n" 3049 " for (var i = 0; i < 3; ++i)\n"
3051 " a.shift();\n" 3050 " a.shift();\n"
3052 "}\n"); 3051 "}\n");
3053 3052
3054 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); 3053 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
3055 // Should not crash. 3054 // Should not crash.
3056 3055
3057 heap_profiler->StopSamplingHeapProfiler(); 3056 heap_profiler->StopSamplingHeapProfiler();
3058 } 3057 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698