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 4630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4641 BailoutId id = BailoutId(i); | 4641 BailoutId id = BailoutId(i); |
4642 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); | 4642 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); |
4643 } | 4643 } |
4644 | 4644 |
4645 // Trigger a GC to flush out the bug. | 4645 // Trigger a GC to flush out the bug. |
4646 heap->CollectGarbage(i::OLD_SPACE, "fire in the hole"); | 4646 heap->CollectGarbage(i::OLD_SPACE, "fire in the hole"); |
4647 boomer->Print(); | 4647 boomer->Print(); |
4648 } | 4648 } |
4649 | 4649 |
4650 | 4650 |
4651 TEST(LargeObjectSlotRecording) { | |
4652 CcTest::InitializeVM(); | |
4653 Isolate* isolate = CcTest::i_isolate(); | |
4654 Heap* heap = isolate->heap(); | |
4655 HandleScope scope(isolate); | |
4656 | |
4657 // Create an object on an evacuation candidate. | |
4658 SimulateFullSpace(heap->old_space()); | |
4659 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); | |
4660 Page* evac_page = Page::FromAddress(lit->address()); | |
4661 FLAG_manual_evacuation_candidates_selection = true; | |
Michael Lippautz
2015/08/20 11:14:39
nit: Can we set this before VM initialization?
Hannes Payer (out of office)
2015/08/20 11:39:17
Done.
| |
4662 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | |
4663 FixedArray* old_location = *lit; | |
4664 | |
4665 // Allocate a large object. | |
4666 const int kSize = 1000000; | |
4667 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(kSize, TENURED); | |
4668 CHECK(heap->lo_space()->Contains(*lo)); | |
4669 | |
4670 // Start incremental marking to active write barrier. | |
4671 SimulateIncrementalMarking(heap, false); | |
4672 heap->AdvanceIncrementalMarking(10000000, 10000000, | |
4673 IncrementalMarking::IdleStepActions()); | |
4674 | |
4675 // Create references from the large object to the object on the evacuation | |
4676 // candidate. | |
4677 const int kStep = kSize / 10; | |
4678 for (int i = 0; i < kSize; i += kStep) { | |
4679 lo->set(i, *lit); | |
4680 CHECK(lo->get(i) == old_location); | |
4681 } | |
4682 | |
4683 // Move the evaucation candidate object. | |
4684 CcTest::heap()->CollectAllGarbage(); | |
4685 | |
4686 // Verify that the pointers in the large object got updated. | |
4687 for (int i = 0; i < kSize; i += kStep) { | |
4688 CHECK_EQ(lo->get(i), *lit); | |
4689 CHECK(lo->get(i) != old_location); | |
4690 } | |
4691 } | |
4692 | |
4693 | |
4651 class DummyVisitor : public ObjectVisitor { | 4694 class DummyVisitor : public ObjectVisitor { |
4652 public: | 4695 public: |
4653 void VisitPointers(Object** start, Object** end) { } | 4696 void VisitPointers(Object** start, Object** end) { } |
4654 }; | 4697 }; |
4655 | 4698 |
4656 | 4699 |
4657 TEST(DeferredHandles) { | 4700 TEST(DeferredHandles) { |
4658 CcTest::InitializeVM(); | 4701 CcTest::InitializeVM(); |
4659 Isolate* isolate = CcTest::i_isolate(); | 4702 Isolate* isolate = CcTest::i_isolate(); |
4660 Heap* heap = isolate->heap(); | 4703 Heap* heap = isolate->heap(); |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6380 | 6423 |
6381 PrintF("Context size : %d bytes\n", measure.Size()); | 6424 PrintF("Context size : %d bytes\n", measure.Size()); |
6382 PrintF("Context object count: %d\n", measure.Count()); | 6425 PrintF("Context object count: %d\n", measure.Count()); |
6383 | 6426 |
6384 CHECK_LE(1000, measure.Count()); | 6427 CHECK_LE(1000, measure.Count()); |
6385 CHECK_LE(50000, measure.Size()); | 6428 CHECK_LE(50000, measure.Size()); |
6386 | 6429 |
6387 CHECK_LE(measure.Count(), count_upper_limit); | 6430 CHECK_LE(measure.Count(), count_upper_limit); |
6388 CHECK_LE(measure.Size(), size_upper_limit); | 6431 CHECK_LE(measure.Size(), size_upper_limit); |
6389 } | 6432 } |
OLD | NEW |