| OLD | NEW |
| 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 return count; | 676 return count; |
| 677 } | 677 } |
| 678 | 678 |
| 679 | 679 |
| 680 static void CheckSurvivingGlobalObjectsCount(int expected) { | 680 static void CheckSurvivingGlobalObjectsCount(int expected) { |
| 681 // We need to collect all garbage twice to be sure that everything | 681 // We need to collect all garbage twice to be sure that everything |
| 682 // has been collected. This is because inline caches are cleared in | 682 // has been collected. This is because inline caches are cleared in |
| 683 // the first garbage collection but some of the maps have already | 683 // the first garbage collection but some of the maps have already |
| 684 // been marked at that point. Therefore some of the maps are not | 684 // been marked at that point. Therefore some of the maps are not |
| 685 // collected until the second garbage collection. | 685 // collected until the second garbage collection. |
| 686 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 686 CcTest::heap()->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); |
| 687 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); | 687 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); |
| 688 int count = GetGlobalObjectsCount(); | 688 int count = GetGlobalObjectsCount(); |
| 689 #ifdef DEBUG | 689 #ifdef DEBUG |
| 690 if (count != expected) CcTest::heap()->TracePathToGlobal(); | 690 if (count != expected) CcTest::heap()->TracePathToGlobal(); |
| 691 #endif | 691 #endif |
| 692 CHECK_EQ(expected, count); | 692 CHECK_EQ(expected, count); |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 TEST(DontLeakContextOnObserve) { | 696 TEST(DontLeakContextOnObserve) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 notifier); | 755 notifier); |
| 756 CompileRun("var obj2 = {};" | 756 CompileRun("var obj2 = {};" |
| 757 "var notifier2 = Object.getNotifier(obj2);" | 757 "var notifier2 = Object.getNotifier(obj2);" |
| 758 "notifier2.performChange.call(" | 758 "notifier2.performChange.call(" |
| 759 "notifier, 'foo', function(){})"); | 759 "notifier, 'foo', function(){})"); |
| 760 } | 760 } |
| 761 | 761 |
| 762 CcTest::isolate()->ContextDisposedNotification(); | 762 CcTest::isolate()->ContextDisposedNotification(); |
| 763 CheckSurvivingGlobalObjectsCount(1); | 763 CheckSurvivingGlobalObjectsCount(1); |
| 764 } | 764 } |
| OLD | NEW |