| 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 6582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6593 v8::Isolate::Scope isolate_scope(isolate); | 6593 v8::Isolate::Scope isolate_scope(isolate); |
| 6594 v8::HandleScope handle_scope(isolate); | 6594 v8::HandleScope handle_scope(isolate); |
| 6595 v8::Context::New(isolate)->Enter(); | 6595 v8::Context::New(isolate)->Enter(); |
| 6596 Heap* heap = i_isolate->heap(); | 6596 Heap* heap = i_isolate->heap(); |
| 6597 std::vector<Handle<FixedArray>> handles; | 6597 std::vector<Handle<FixedArray>> handles; |
| 6598 SimulateFullSpace(heap->new_space(), &handles); | 6598 SimulateFullSpace(heap->new_space(), &handles); |
| 6599 heap->CollectGarbage(NEW_SPACE); | 6599 heap->CollectGarbage(NEW_SPACE); |
| 6600 CHECK_GT(handles.size(), 0u); | 6600 CHECK_GT(handles.size(), 0u); |
| 6601 // First object in handle should be on the first page. | 6601 // First object in handle should be on the first page. |
| 6602 Handle<FixedArray> first_object = handles.front(); | 6602 Handle<FixedArray> first_object = handles.front(); |
| 6603 NewSpacePage* first_page = | 6603 Page* first_page = Page::FromAddress(first_object->address()); |
| 6604 NewSpacePage::FromAddress(first_object->address()); | |
| 6605 // The age mark should not be on the first page. | 6604 // The age mark should not be on the first page. |
| 6606 CHECK(!first_page->ContainsLimit(heap->new_space()->age_mark())); | 6605 CHECK(!first_page->ContainsLimit(heap->new_space()->age_mark())); |
| 6607 // To perform a sanity check on live bytes we need to mark the heap. | 6606 // To perform a sanity check on live bytes we need to mark the heap. |
| 6608 SimulateIncrementalMarking(heap, true); | 6607 SimulateIncrementalMarking(heap, true); |
| 6609 // Sanity check that the page meets the requirements for promotion. | 6608 // Sanity check that the page meets the requirements for promotion. |
| 6610 const int threshold_bytes = | 6609 const int threshold_bytes = |
| 6611 FLAG_page_promotion_threshold * NewSpacePage::kAllocatableMemory / 100; | 6610 FLAG_page_promotion_threshold * Page::kAllocatableMemory / 100; |
| 6612 CHECK_GE(first_page->LiveBytes(), threshold_bytes); | 6611 CHECK_GE(first_page->LiveBytes(), threshold_bytes); |
| 6613 | 6612 |
| 6614 // Actual checks: The page is in new space first, but is moved to old space | 6613 // Actual checks: The page is in new space first, but is moved to old space |
| 6615 // during a full GC. | 6614 // during a full GC. |
| 6616 CHECK(heap->new_space()->ContainsSlow(first_page->address())); | 6615 CHECK(heap->new_space()->ContainsSlow(first_page->address())); |
| 6617 CHECK(!heap->old_space()->ContainsSlow(first_page->address())); | 6616 CHECK(!heap->old_space()->ContainsSlow(first_page->address())); |
| 6618 heap->CollectGarbage(OLD_SPACE); | 6617 heap->CollectGarbage(OLD_SPACE); |
| 6619 CHECK(!heap->new_space()->ContainsSlow(first_page->address())); | 6618 CHECK(!heap->new_space()->ContainsSlow(first_page->address())); |
| 6620 CHECK(heap->old_space()->ContainsSlow(first_page->address())); | 6619 CHECK(heap->old_space()->ContainsSlow(first_page->address())); |
| 6621 } | 6620 } |
| 6622 } | 6621 } |
| 6623 | 6622 |
| 6624 } // namespace internal | 6623 } // namespace internal |
| 6625 } // namespace v8 | 6624 } // namespace v8 |
| OLD | NEW |