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 } | 676 } |
677 | 677 |
678 | 678 |
679 static void CheckSurvivingGlobalObjectsCount(int expected) { | 679 static void CheckSurvivingGlobalObjectsCount(int expected) { |
680 // We need to collect all garbage twice to be sure that everything | 680 // We need to collect all garbage twice to be sure that everything |
681 // has been collected. This is because inline caches are cleared in | 681 // has been collected. This is because inline caches are cleared in |
682 // the first garbage collection but some of the maps have already | 682 // the first garbage collection but some of the maps have already |
683 // been marked at that point. Therefore some of the maps are not | 683 // been marked at that point. Therefore some of the maps are not |
684 // collected until the second garbage collection. | 684 // collected until the second garbage collection. |
685 CcTest::heap()->CollectAllGarbage(); | 685 CcTest::heap()->CollectAllGarbage(); |
686 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); | 686 CcTest::heap()->CollectAllGarbage("CheckSurvivingGlobalObjectsCount", |
| 687 i::Heap::kMakeHeapIterableMask); |
687 int count = GetGlobalObjectsCount(); | 688 int count = GetGlobalObjectsCount(); |
688 #ifdef DEBUG | 689 #ifdef DEBUG |
689 if (count != expected) CcTest::heap()->TracePathToGlobal(); | 690 if (count != expected) CcTest::heap()->TracePathToGlobal(); |
690 #endif | 691 #endif |
691 CHECK_EQ(expected, count); | 692 CHECK_EQ(expected, count); |
692 } | 693 } |
693 | 694 |
694 | 695 |
695 TEST(DontLeakContextOnObserve) { | 696 TEST(DontLeakContextOnObserve) { |
696 HandleScope scope(CcTest::isolate()); | 697 HandleScope scope(CcTest::isolate()); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 i::Isolate* isolate = CcTest::i_isolate(); | 879 i::Isolate* isolate = CcTest::i_isolate(); |
879 i::HandleScope scope(isolate); | 880 i::HandleScope scope(isolate); |
880 LocalContext env; | 881 LocalContext env; |
881 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; | 882 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; |
882 global_use_counts = use_counts; | 883 global_use_counts = use_counts; |
883 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | 884 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); |
884 CompileRun("var obj = {}"); | 885 CompileRun("var obj = {}"); |
885 CompileRun("Object.getNotifier(obj)"); | 886 CompileRun("Object.getNotifier(obj)"); |
886 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); | 887 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); |
887 } | 888 } |
OLD | NEW |