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

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

Issue 1465223009: [heap] pause observers during mark-compact (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use a scope for pausing/resuming inline allocation observers Created 5 years 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 | « src/heap/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 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 CHECK_EQ(observer1.count(), 20); 865 CHECK_EQ(observer1.count(), 20);
866 CHECK_EQ(observer2.count(), 2); 866 CHECK_EQ(observer2.count(), 2);
867 867
868 // Callback should stop getting called after an observer is removed. 868 // Callback should stop getting called after an observer is removed.
869 new_space->RemoveInlineAllocationObserver(&observer1); 869 new_space->RemoveInlineAllocationObserver(&observer1);
870 870
871 AllocateUnaligned(new_space, 384); 871 AllocateUnaligned(new_space, 384);
872 CHECK_EQ(observer1.count(), 20); // no more notifications. 872 CHECK_EQ(observer1.count(), 20); // no more notifications.
873 CHECK_EQ(observer2.count(), 3); // this one is still active. 873 CHECK_EQ(observer2.count(), 3); // this one is still active.
874 874
875 // Ensure that Pause/ResumeInlineAllocationObservers work correctly. 875 // Ensure that PauseInlineAllocationObserversScope work correctly.
876 AllocateUnaligned(new_space, 48); 876 AllocateUnaligned(new_space, 48);
877 CHECK_EQ(observer2.count(), 3); 877 CHECK_EQ(observer2.count(), 3);
878 new_space->PauseInlineAllocationObservers(); 878 {
879 CHECK_EQ(observer2.count(), 3); 879 PauseInlineAllocationObserversScope pause_observers(new_space);
880 AllocateUnaligned(new_space, 384); 880 CHECK_EQ(observer2.count(), 3);
881 CHECK_EQ(observer2.count(), 3); 881 AllocateUnaligned(new_space, 384);
882 new_space->ResumeInlineAllocationObservers(); 882 CHECK_EQ(observer2.count(), 3);
883 }
883 CHECK_EQ(observer2.count(), 3); 884 CHECK_EQ(observer2.count(), 3);
884 // Coupled with the 48 bytes allocated before the pause, another 48 bytes 885 // Coupled with the 48 bytes allocated before the pause, another 48 bytes
885 // allocated here should trigger a notification. 886 // allocated here should trigger a notification.
886 AllocateUnaligned(new_space, 48); 887 AllocateUnaligned(new_space, 48);
887 CHECK_EQ(observer2.count(), 4); 888 CHECK_EQ(observer2.count(), 4);
888 889
889 new_space->RemoveInlineAllocationObserver(&observer2); 890 new_space->RemoveInlineAllocationObserver(&observer2);
890 AllocateUnaligned(new_space, 384); 891 AllocateUnaligned(new_space, 384);
891 CHECK_EQ(observer1.count(), 20); 892 CHECK_EQ(observer1.count(), 20);
892 CHECK_EQ(observer2.count(), 4); 893 CHECK_EQ(observer2.count(), 4);
(...skipping 28 matching lines...) Expand all
921 new_space->RemoveInlineAllocationObserver(&observer2); 922 new_space->RemoveInlineAllocationObserver(&observer2);
922 923
923 CHECK_EQ(observer1.count(), 32); 924 CHECK_EQ(observer1.count(), 32);
924 CHECK_EQ(observer2.count(), 28); 925 CHECK_EQ(observer2.count(), 28);
925 } 926 }
926 isolate->Dispose(); 927 isolate->Dispose();
927 } 928 }
928 929
929 } // namespace internal 930 } // namespace internal
930 } // namespace v8 931 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698