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 5905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 } | 5916 } |
5917 | 5917 |
5918 | 5918 |
5919 void CheckMapRetainingFor(int n) { | 5919 void CheckMapRetainingFor(int n) { |
5920 FLAG_retain_maps_for_n_gc = n; | 5920 FLAG_retain_maps_for_n_gc = n; |
5921 Isolate* isolate = CcTest::i_isolate(); | 5921 Isolate* isolate = CcTest::i_isolate(); |
5922 Heap* heap = isolate->heap(); | 5922 Heap* heap = isolate->heap(); |
5923 Handle<WeakCell> weak_cell = AddRetainedMap(isolate, heap); | 5923 Handle<WeakCell> weak_cell = AddRetainedMap(isolate, heap); |
5924 CHECK(!weak_cell->cleared()); | 5924 CHECK(!weak_cell->cleared()); |
5925 for (int i = 0; i < n; i++) { | 5925 for (int i = 0; i < n; i++) { |
| 5926 SimulateIncrementalMarking(heap); |
5926 heap->CollectGarbage(OLD_SPACE); | 5927 heap->CollectGarbage(OLD_SPACE); |
5927 } | 5928 } |
5928 CHECK(!weak_cell->cleared()); | 5929 CHECK(!weak_cell->cleared()); |
| 5930 SimulateIncrementalMarking(heap); |
5929 heap->CollectGarbage(OLD_SPACE); | 5931 heap->CollectGarbage(OLD_SPACE); |
5930 CHECK(weak_cell->cleared()); | 5932 CHECK(weak_cell->cleared()); |
5931 } | 5933 } |
5932 | 5934 |
5933 | 5935 |
5934 TEST(MapRetaining) { | 5936 TEST(MapRetaining) { |
5935 CcTest::InitializeVM(); | 5937 CcTest::InitializeVM(); |
5936 v8::HandleScope scope(CcTest::isolate()); | 5938 v8::HandleScope scope(CcTest::isolate()); |
5937 CheckMapRetainingFor(FLAG_retain_maps_for_n_gc); | 5939 CheckMapRetainingFor(FLAG_retain_maps_for_n_gc); |
5938 CheckMapRetainingFor(0); | 5940 CheckMapRetainingFor(0); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6548 isolate->IncrementJsCallsFromApiCounter(); | 6550 isolate->IncrementJsCallsFromApiCounter(); |
6549 isolate->IncrementJsCallsFromApiCounter(); | 6551 isolate->IncrementJsCallsFromApiCounter(); |
6550 isolate->IncrementJsCallsFromApiCounter(); | 6552 isolate->IncrementJsCallsFromApiCounter(); |
6551 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6553 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
6552 CheckDoubleEquals(2, calls_per_ms); | 6554 CheckDoubleEquals(2, calls_per_ms); |
6553 } | 6555 } |
6554 | 6556 |
6555 | 6557 |
6556 } // namespace internal | 6558 } // namespace internal |
6557 } // namespace v8 | 6559 } // namespace v8 |
OLD | NEW |