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

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

Issue 382793002: Remove sequential sweeping mode and perform lazy sweeping when no sweeper threads are active. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 #include "src/macro-assembler.h" 37 #include "src/macro-assembler.h"
38 #include "src/stub-cache.h" 38 #include "src/stub-cache.h"
39 #include "test/cctest/cctest.h" 39 #include "test/cctest/cctest.h"
40 40
41 using namespace v8::internal; 41 using namespace v8::internal;
42 42
43 // Go through all incremental marking steps in one swoop. 43 // Go through all incremental marking steps in one swoop.
44 static void SimulateIncrementalMarking() { 44 static void SimulateIncrementalMarking() {
45 MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector(); 45 MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
46 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 46 IncrementalMarking* marking = CcTest::heap()->incremental_marking();
47 if (collector->IsConcurrentSweepingInProgress()) { 47 if (collector->sweeping_in_progress()) {
48 collector->WaitUntilSweepingCompleted(); 48 collector->EnsureSweepingCompleted();
49 } 49 }
50 CHECK(marking->IsMarking() || marking->IsStopped()); 50 CHECK(marking->IsMarking() || marking->IsStopped());
51 if (marking->IsStopped()) { 51 if (marking->IsStopped()) {
52 marking->Start(); 52 marking->Start();
53 } 53 }
54 CHECK(marking->IsMarking()); 54 CHECK(marking->IsMarking());
55 while (!marking->IsComplete()) { 55 while (!marking->IsComplete()) {
56 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 56 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
57 } 57 }
58 CHECK(marking->IsComplete()); 58 CHECK(marking->IsComplete());
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 v8::V8::Initialize(); 1588 v8::V8::Initialize();
1589 1589
1590 // Get initial heap size after several full GCs, which will stabilize 1590 // Get initial heap size after several full GCs, which will stabilize
1591 // the heap size and return with sweeping finished completely. 1591 // the heap size and return with sweeping finished completely.
1592 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1592 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1593 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1593 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1594 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1594 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1595 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1595 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1596 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1596 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1597 MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector(); 1597 MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
1598 if (collector->IsConcurrentSweepingInProgress()) { 1598 if (collector->sweeping_in_progress()) {
1599 collector->WaitUntilSweepingCompleted(); 1599 collector->EnsureSweepingCompleted();
1600 } 1600 }
1601 int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects()); 1601 int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects());
1602 1602
1603 { 1603 {
1604 // Allocate objects on several different old-space pages so that 1604 // Allocate objects on several different old-space pages so that
1605 // concurrent sweeper threads will be busy sweeping the old space on 1605 // concurrent sweeper threads will be busy sweeping the old space on
1606 // subsequent GC runs. 1606 // subsequent GC runs.
1607 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); 1607 AlwaysAllocateScope always_allocate(CcTest::i_isolate());
1608 int filler_size = static_cast<int>(FixedArray::SizeFor(8192)); 1608 int filler_size = static_cast<int>(FixedArray::SizeFor(8192));
1609 for (int i = 1; i <= 100; i++) { 1609 for (int i = 1; i <= 100; i++) {
1610 CcTest::test_heap()->AllocateFixedArray(8192, TENURED).ToObjectChecked(); 1610 CcTest::test_heap()->AllocateFixedArray(8192, TENURED).ToObjectChecked();
1611 CHECK_EQ(initial_size + i * filler_size, 1611 CHECK_EQ(initial_size + i * filler_size,
1612 static_cast<int>(CcTest::heap()->SizeOfObjects())); 1612 static_cast<int>(CcTest::heap()->SizeOfObjects()));
1613 } 1613 }
1614 } 1614 }
1615 1615
1616 // The heap size should go back to initial size after a full GC, even 1616 // The heap size should go back to initial size after a full GC, even
1617 // though sweeping didn't finish yet. 1617 // though sweeping didn't finish yet.
1618 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1618 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1619 1619
1620 // Normally sweeping would not be complete here, but no guarantees. 1620 // Normally sweeping would not be complete here, but no guarantees.
1621 1621
1622 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); 1622 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
1623 1623
1624 // Waiting for sweeper threads should not change heap size. 1624 // Waiting for sweeper threads should not change heap size.
1625 if (collector->IsConcurrentSweepingInProgress()) { 1625 if (collector->sweeping_in_progress()) {
1626 collector->WaitUntilSweepingCompleted(); 1626 collector->EnsureSweepingCompleted();
1627 } 1627 }
1628 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); 1628 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
1629 } 1629 }
1630 1630
1631 1631
1632 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { 1632 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
1633 CcTest::InitializeVM(); 1633 CcTest::InitializeVM();
1634 HeapIterator iterator(CcTest::heap()); 1634 HeapIterator iterator(CcTest::heap());
1635 intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects(); 1635 intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects();
1636 intptr_t size_of_objects_2 = 0; 1636 intptr_t size_of_objects_2 = 0;
(...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after
4409 #ifdef DEBUG 4409 #ifdef DEBUG
4410 TEST(PathTracer) { 4410 TEST(PathTracer) {
4411 CcTest::InitializeVM(); 4411 CcTest::InitializeVM();
4412 v8::HandleScope scope(CcTest::isolate()); 4412 v8::HandleScope scope(CcTest::isolate());
4413 4413
4414 v8::Local<v8::Value> result = CompileRun("'abc'"); 4414 v8::Local<v8::Value> result = CompileRun("'abc'");
4415 Handle<Object> o = v8::Utils::OpenHandle(*result); 4415 Handle<Object> o = v8::Utils::OpenHandle(*result);
4416 CcTest::i_isolate()->heap()->TracePathToObject(*o); 4416 CcTest::i_isolate()->heap()->TracePathToObject(*o);
4417 } 4417 }
4418 #endif // DEBUG 4418 #endif // DEBUG
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698