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

Side by Side Diff: Source/platform/heap/HeapTest.cpp

Issue 383743002: Oilpan: GC profiling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 { 1917 {
1918 HeapStats initialHeapSize; 1918 HeapStats initialHeapSize;
1919 clearOutOldGarbage(&initialHeapSize); 1919 clearOutOldGarbage(&initialHeapSize);
1920 IntWrapper::s_destructorCalls = 0; 1920 IntWrapper::s_destructorCalls = 0;
1921 LargeObject::s_destructorCalls = 0; 1921 LargeObject::s_destructorCalls = 0;
1922 { 1922 {
1923 int slack = 8; // LargeObject points to an IntWrapper that is also alloc ated. 1923 int slack = 8; // LargeObject points to an IntWrapper that is also alloc ated.
1924 Persistent<LargeObject> object = LargeObject::create(); 1924 Persistent<LargeObject> object = LargeObject::create();
1925 EXPECT_TRUE(ThreadState::current()->contains(object)); 1925 EXPECT_TRUE(ThreadState::current()->contains(object));
1926 EXPECT_TRUE(ThreadState::current()->contains(reinterpret_cast<char*>(obj ect.get()) + sizeof(LargeObject) - 1)); 1926 EXPECT_TRUE(ThreadState::current()->contains(reinterpret_cast<char*>(obj ect.get()) + sizeof(LargeObject) - 1));
1927 #if ENABLE(GC_TRACING) 1927 #if GC_PROFILE_MARKING
1928 const GCInfo* info = ThreadState::current()->findGCInfo(reinterpret_cast <Address>(object.get())); 1928 const GCInfo* info = ThreadState::current()->findGCInfo(reinterpret_cast <Address>(object.get()));
1929 EXPECT_NE(reinterpret_cast<const GCInfo*>(0), info); 1929 EXPECT_NE(reinterpret_cast<const GCInfo*>(0), info);
1930 EXPECT_EQ(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr ess>(object.get()) + sizeof(LargeObject) - 1)); 1930 EXPECT_EQ(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr ess>(object.get()) + sizeof(LargeObject) - 1));
1931 EXPECT_NE(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr ess>(object.get()) + sizeof(LargeObject))); 1931 EXPECT_NE(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr ess>(object.get()) + sizeof(LargeObject)));
1932 EXPECT_NE(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr ess>(object.get()) - 1)); 1932 EXPECT_NE(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr ess>(object.get()) - 1));
1933 #endif 1933 #endif
1934 HeapStats afterAllocation; 1934 HeapStats afterAllocation;
1935 clearOutOldGarbage(&afterAllocation); 1935 clearOutOldGarbage(&afterAllocation);
1936 { 1936 {
1937 object->set(0, 'a'); 1937 object->set(0, 'a');
(...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
4578 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 4578 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
4579 EXPECT_EQ(1u, map->size()); 4579 EXPECT_EQ(1u, map->size());
4580 EXPECT_EQ(lifeObject, map->get(lifeObject)->link()); 4580 EXPECT_EQ(lifeObject, map->get(lifeObject)->link());
4581 lifeObject.clear(); // Despite its name. 4581 lifeObject.clear(); // Despite its name.
4582 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 4582 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
4583 EXPECT_EQ(0u, map->size()); 4583 EXPECT_EQ(0u, map->size());
4584 } 4584 }
4585 4585
4586 4586
4587 } // WebCore namespace 4587 } // WebCore namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698