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 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4569 HandleScope scope(isolate); | 4569 HandleScope scope(isolate); |
4570 | 4570 |
4571 // Create an object on an evacuation candidate. | 4571 // Create an object on an evacuation candidate. |
4572 SimulateFullSpace(heap->old_space()); | 4572 SimulateFullSpace(heap->old_space()); |
4573 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); | 4573 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); |
4574 Page* evac_page = Page::FromAddress(lit->address()); | 4574 Page* evac_page = Page::FromAddress(lit->address()); |
4575 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 4575 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
4576 FixedArray* old_location = *lit; | 4576 FixedArray* old_location = *lit; |
4577 | 4577 |
4578 // Allocate a large object. | 4578 // Allocate a large object. |
4579 const int kSize = 1000000; | 4579 int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); |
4580 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(kSize, TENURED); | 4580 CHECK(size > Page::kMaxRegularHeapObjectSize); |
| 4581 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); |
4581 CHECK(heap->lo_space()->Contains(*lo)); | 4582 CHECK(heap->lo_space()->Contains(*lo)); |
4582 | 4583 |
4583 // Start incremental marking to active write barrier. | 4584 // Start incremental marking to active write barrier. |
4584 SimulateIncrementalMarking(heap, false); | 4585 SimulateIncrementalMarking(heap, false); |
4585 heap->incremental_marking()->AdvanceIncrementalMarking( | 4586 heap->incremental_marking()->AdvanceIncrementalMarking( |
4586 10000000, 10000000, IncrementalMarking::IdleStepActions()); | 4587 10000000, 10000000, IncrementalMarking::IdleStepActions()); |
4587 | 4588 |
4588 // Create references from the large object to the object on the evacuation | 4589 // Create references from the large object to the object on the evacuation |
4589 // candidate. | 4590 // candidate. |
4590 const int kStep = kSize / 10; | 4591 const int kStep = size / 10; |
4591 for (int i = 0; i < kSize; i += kStep) { | 4592 for (int i = 0; i < size; i += kStep) { |
4592 lo->set(i, *lit); | 4593 lo->set(i, *lit); |
4593 CHECK(lo->get(i) == old_location); | 4594 CHECK(lo->get(i) == old_location); |
4594 } | 4595 } |
4595 | 4596 |
4596 // Move the evaucation candidate object. | 4597 // Move the evaucation candidate object. |
4597 CcTest::heap()->CollectAllGarbage(); | 4598 CcTest::heap()->CollectAllGarbage(); |
4598 | 4599 |
4599 // Verify that the pointers in the large object got updated. | 4600 // Verify that the pointers in the large object got updated. |
4600 for (int i = 0; i < kSize; i += kStep) { | 4601 for (int i = 0; i < size; i += kStep) { |
4601 CHECK_EQ(lo->get(i), *lit); | 4602 CHECK_EQ(lo->get(i), *lit); |
4602 CHECK(lo->get(i) != old_location); | 4603 CHECK(lo->get(i) != old_location); |
4603 } | 4604 } |
4604 } | 4605 } |
4605 | 4606 |
4606 | 4607 |
4607 class DummyVisitor : public ObjectVisitor { | 4608 class DummyVisitor : public ObjectVisitor { |
4608 public: | 4609 public: |
4609 void VisitPointers(Object** start, Object** end) override {} | 4610 void VisitPointers(Object** start, Object** end) override {} |
4610 }; | 4611 }; |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6449 isolate->IncrementJsCallsFromApiCounter(); | 6450 isolate->IncrementJsCallsFromApiCounter(); |
6450 isolate->IncrementJsCallsFromApiCounter(); | 6451 isolate->IncrementJsCallsFromApiCounter(); |
6451 isolate->IncrementJsCallsFromApiCounter(); | 6452 isolate->IncrementJsCallsFromApiCounter(); |
6452 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6453 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
6453 CheckDoubleEquals(2, calls_per_ms); | 6454 CheckDoubleEquals(2, calls_per_ms); |
6454 } | 6455 } |
6455 | 6456 |
6456 | 6457 |
6457 } // namespace internal | 6458 } // namespace internal |
6458 } // namespace v8 | 6459 } // namespace v8 |
OLD | NEW |