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 2983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2994 CHECK_EQ(1, old_pointer_space->CountTotalPages()); | 2994 CHECK_EQ(1, old_pointer_space->CountTotalPages()); |
2995 for (int i = 0; i < number_of_test_pages; i++) { | 2995 for (int i = 0; i < number_of_test_pages; i++) { |
2996 AlwaysAllocateScope always_allocate(isolate); | 2996 AlwaysAllocateScope always_allocate(isolate); |
2997 SimulateFullSpace(old_pointer_space); | 2997 SimulateFullSpace(old_pointer_space); |
2998 factory->NewFixedArray(1, TENURED); | 2998 factory->NewFixedArray(1, TENURED); |
2999 } | 2999 } |
3000 CHECK_EQ(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 3000 CHECK_EQ(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
3001 | 3001 |
3002 // Triggering one GC will cause a lot of garbage to be discovered but | 3002 // Triggering one GC will cause a lot of garbage to be discovered but |
3003 // even spread across all allocated pages. | 3003 // even spread across all allocated pages. |
3004 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation"); | 3004 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask, |
| 3005 "triggered for preparation"); |
3005 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 3006 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
3006 | 3007 |
3007 // Triggering subsequent GCs should cause at least half of the pages | 3008 // Triggering subsequent GCs should cause at least half of the pages |
3008 // to be released to the OS after at most two cycles. | 3009 // to be released to the OS after at most two cycles. |
3009 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); | 3010 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); |
3010 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 3011 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
3011 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); | 3012 heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); |
3012 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); | 3013 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); |
3013 | 3014 |
3014 // Triggering a last-resort GC should cause all pages to be released to the | 3015 // 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... |
4477 #ifdef DEBUG | 4478 #ifdef DEBUG |
4478 TEST(PathTracer) { | 4479 TEST(PathTracer) { |
4479 CcTest::InitializeVM(); | 4480 CcTest::InitializeVM(); |
4480 v8::HandleScope scope(CcTest::isolate()); | 4481 v8::HandleScope scope(CcTest::isolate()); |
4481 | 4482 |
4482 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4483 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4483 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4484 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4484 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4485 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4485 } | 4486 } |
4486 #endif // DEBUG | 4487 #endif // DEBUG |
OLD | NEW |