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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 CHECK_EQ(1, old_pointer_space->CountTotalPages()); | 3013 CHECK_EQ(1, old_pointer_space->CountTotalPages()); |
3014 for (int i = 0; i < number_of_test_pages; i++) { | 3014 for (int i = 0; i < number_of_test_pages; i++) { |
3015 AlwaysAllocateScope always_allocate(isolate); | 3015 AlwaysAllocateScope always_allocate(isolate); |
3016 SimulateFullSpace(old_pointer_space); | 3016 SimulateFullSpace(old_pointer_space); |
3017 factory->NewFixedArray(1, TENURED); | 3017 factory->NewFixedArray(1, TENURED); |
3018 } | 3018 } |
3019 CHECK_EQ(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 3019 CHECK_EQ(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
3020 | 3020 |
3021 // Triggering one GC will cause a lot of garbage to be discovered but | 3021 // Triggering one GC will cause a lot of garbage to be discovered but |
3022 // even spread across all allocated pages. | 3022 // even spread across all allocated pages. |
3023 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation"); | 3023 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask, |
| 3024 "triggered for preparation"); |
3024 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 3025 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
3025 | 3026 |
3026 // Triggering subsequent GCs should cause at least half of the pages | 3027 // Triggering subsequent GCs should cause at least half of the pages |
3027 // to be released to the OS after at most two cycles. | 3028 // to be released to the OS after at most two cycles. |
3028 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); | 3029 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); |
3029 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 3030 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
3030 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); | 3031 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); |
3031 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); | 3032 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); |
3032 | 3033 |
3033 // Triggering a last-resort GC should cause all pages to be released to the | 3034 // Triggering a last-resort GC should cause all pages to be released to the |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4496 #ifdef DEBUG | 4497 #ifdef DEBUG |
4497 TEST(PathTracer) { | 4498 TEST(PathTracer) { |
4498 CcTest::InitializeVM(); | 4499 CcTest::InitializeVM(); |
4499 v8::HandleScope scope(CcTest::isolate()); | 4500 v8::HandleScope scope(CcTest::isolate()); |
4500 | 4501 |
4501 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4502 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4502 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4503 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4503 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4504 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4504 } | 4505 } |
4505 #endif // DEBUG | 4506 #endif // DEBUG |
OLD | NEW |