| 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("CheckSurvivingGlobalObjectsCount", | 686 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); |
| 687 i::Heap::kMakeHeapIterableMask); | |
| 688 int count = GetGlobalObjectsCount(); | 687 int count = GetGlobalObjectsCount(); |
| 689 #ifdef DEBUG | 688 #ifdef DEBUG |
| 690 if (count != expected) CcTest::heap()->TracePathToGlobal(); | 689 if (count != expected) CcTest::heap()->TracePathToGlobal(); |
| 691 #endif | 690 #endif |
| 692 CHECK_EQ(expected, count); | 691 CHECK_EQ(expected, count); |
| 693 } | 692 } |
| 694 | 693 |
| 695 | 694 |
| 696 TEST(DontLeakContextOnObserve) { | 695 TEST(DontLeakContextOnObserve) { |
| 697 HandleScope scope(CcTest::isolate()); | 696 HandleScope scope(CcTest::isolate()); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 i::Isolate* isolate = CcTest::i_isolate(); | 878 i::Isolate* isolate = CcTest::i_isolate(); |
| 880 i::HandleScope scope(isolate); | 879 i::HandleScope scope(isolate); |
| 881 LocalContext env; | 880 LocalContext env; |
| 882 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; | 881 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; |
| 883 global_use_counts = use_counts; | 882 global_use_counts = use_counts; |
| 884 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | 883 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); |
| 885 CompileRun("var obj = {}"); | 884 CompileRun("var obj = {}"); |
| 886 CompileRun("Object.getNotifier(obj)"); | 885 CompileRun("Object.getNotifier(obj)"); |
| 887 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); | 886 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); |
| 888 } | 887 } |
| OLD | NEW |