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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 objs[next_objs_index++] = factory->NewJSArray(10); | 1247 objs[next_objs_index++] = factory->NewJSArray(10); |
1248 objs[next_objs_index++] = | 1248 objs[next_objs_index++] = |
1249 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, TENURED); | 1249 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, TENURED); |
1250 | 1250 |
1251 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE | 1251 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE |
1252 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); | 1252 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); |
1253 objs[next_objs_index++] = | 1253 objs[next_objs_index++] = |
1254 factory->NewStringFromStaticChars("abcdefghij", TENURED); | 1254 factory->NewStringFromStaticChars("abcdefghij", TENURED); |
1255 | 1255 |
1256 // Allocate a large string (for large object space). | 1256 // Allocate a large string (for large object space). |
1257 int large_size = Page::kMaxRegularHeapObjectSize + 1; | 1257 int large_size = kMaxRegularHeapObjectSize + 1; |
1258 char* str = new char[large_size]; | 1258 char* str = new char[large_size]; |
1259 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; | 1259 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; |
1260 str[large_size - 1] = '\0'; | 1260 str[large_size - 1] = '\0'; |
1261 objs[next_objs_index++] = factory->NewStringFromAsciiChecked(str, TENURED); | 1261 objs[next_objs_index++] = factory->NewStringFromAsciiChecked(str, TENURED); |
1262 delete[] str; | 1262 delete[] str; |
1263 | 1263 |
1264 // Add a Map object to look for. | 1264 // Add a Map object to look for. |
1265 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 1265 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
1266 | 1266 |
1267 CHECK_EQ(objs_count, next_objs_index); | 1267 CHECK_EQ(objs_count, next_objs_index); |
(...skipping 3330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 HandleScope scope(isolate); | 4598 HandleScope scope(isolate); |
4599 | 4599 |
4600 // Create an object on an evacuation candidate. | 4600 // Create an object on an evacuation candidate. |
4601 heap::SimulateFullSpace(heap->old_space()); | 4601 heap::SimulateFullSpace(heap->old_space()); |
4602 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); | 4602 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); |
4603 Page* evac_page = Page::FromAddress(lit->address()); | 4603 Page* evac_page = Page::FromAddress(lit->address()); |
4604 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 4604 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
4605 FixedArray* old_location = *lit; | 4605 FixedArray* old_location = *lit; |
4606 | 4606 |
4607 // Allocate a large object. | 4607 // Allocate a large object. |
4608 int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); | 4608 int size = Max(1000000, kMaxRegularHeapObjectSize + KB); |
4609 CHECK(size > Page::kMaxRegularHeapObjectSize); | 4609 CHECK(size > kMaxRegularHeapObjectSize); |
4610 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); | 4610 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); |
4611 CHECK(heap->lo_space()->Contains(*lo)); | 4611 CHECK(heap->lo_space()->Contains(*lo)); |
4612 | 4612 |
4613 // Start incremental marking to active write barrier. | 4613 // Start incremental marking to active write barrier. |
4614 heap::SimulateIncrementalMarking(heap, false); | 4614 heap::SimulateIncrementalMarking(heap, false); |
4615 heap->incremental_marking()->AdvanceIncrementalMarking( | 4615 heap->incremental_marking()->AdvanceIncrementalMarking( |
4616 10000000, IncrementalMarking::IdleStepActions()); | 4616 10000000, IncrementalMarking::IdleStepActions()); |
4617 | 4617 |
4618 // Create references from the large object to the object on the evacuation | 4618 // Create references from the large object to the object on the evacuation |
4619 // candidate. | 4619 // candidate. |
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6476 HEAP_TEST(Regress587004) { | 6476 HEAP_TEST(Regress587004) { |
6477 FLAG_concurrent_sweeping = false; | 6477 FLAG_concurrent_sweeping = false; |
6478 #ifdef VERIFY_HEAP | 6478 #ifdef VERIFY_HEAP |
6479 FLAG_verify_heap = false; | 6479 FLAG_verify_heap = false; |
6480 #endif | 6480 #endif |
6481 CcTest::InitializeVM(); | 6481 CcTest::InitializeVM(); |
6482 v8::HandleScope scope(CcTest::isolate()); | 6482 v8::HandleScope scope(CcTest::isolate()); |
6483 Heap* heap = CcTest::heap(); | 6483 Heap* heap = CcTest::heap(); |
6484 Isolate* isolate = CcTest::i_isolate(); | 6484 Isolate* isolate = CcTest::i_isolate(); |
6485 Factory* factory = isolate->factory(); | 6485 Factory* factory = isolate->factory(); |
6486 const int N = (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / | 6486 const int N = |
6487 kPointerSize; | 6487 (kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / kPointerSize; |
6488 Handle<FixedArray> array = factory->NewFixedArray(N, TENURED); | 6488 Handle<FixedArray> array = factory->NewFixedArray(N, TENURED); |
6489 CHECK(heap->old_space()->Contains(*array)); | 6489 CHECK(heap->old_space()->Contains(*array)); |
6490 Handle<Object> number = factory->NewHeapNumber(1.0); | 6490 Handle<Object> number = factory->NewHeapNumber(1.0); |
6491 CHECK(heap->InNewSpace(*number)); | 6491 CHECK(heap->InNewSpace(*number)); |
6492 for (int i = 0; i < N; i++) { | 6492 for (int i = 0; i < N; i++) { |
6493 array->set(i, *number); | 6493 array->set(i, *number); |
6494 } | 6494 } |
6495 heap->CollectGarbage(OLD_SPACE); | 6495 heap->CollectGarbage(OLD_SPACE); |
6496 heap::SimulateFullSpace(heap->old_space()); | 6496 heap::SimulateFullSpace(heap->old_space()); |
6497 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1); | 6497 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6588 | 6588 |
6589 TEST(Regress598319) { | 6589 TEST(Regress598319) { |
6590 // This test ensures that no white objects can cross the progress bar of large | 6590 // This test ensures that no white objects can cross the progress bar of large |
6591 // objects during incremental marking. It checks this by using Shift() during | 6591 // objects during incremental marking. It checks this by using Shift() during |
6592 // incremental marking. | 6592 // incremental marking. |
6593 CcTest::InitializeVM(); | 6593 CcTest::InitializeVM(); |
6594 v8::HandleScope scope(CcTest::isolate()); | 6594 v8::HandleScope scope(CcTest::isolate()); |
6595 Heap* heap = CcTest::heap(); | 6595 Heap* heap = CcTest::heap(); |
6596 Isolate* isolate = heap->isolate(); | 6596 Isolate* isolate = heap->isolate(); |
6597 | 6597 |
6598 const int kNumberOfObjects = Page::kMaxRegularHeapObjectSize / kPointerSize; | 6598 const int kNumberOfObjects = kMaxRegularHeapObjectSize / kPointerSize; |
6599 | 6599 |
6600 struct Arr { | 6600 struct Arr { |
6601 Arr(Isolate* isolate, int number_of_objects) { | 6601 Arr(Isolate* isolate, int number_of_objects) { |
6602 root = isolate->factory()->NewFixedArray(1, TENURED); | 6602 root = isolate->factory()->NewFixedArray(1, TENURED); |
6603 { | 6603 { |
6604 // Temporary scope to avoid getting any other objects into the root set. | 6604 // Temporary scope to avoid getting any other objects into the root set. |
6605 v8::HandleScope scope(CcTest::isolate()); | 6605 v8::HandleScope scope(CcTest::isolate()); |
6606 Handle<FixedArray> tmp = | 6606 Handle<FixedArray> tmp = |
6607 isolate->factory()->NewFixedArray(number_of_objects); | 6607 isolate->factory()->NewFixedArray(number_of_objects); |
6608 root->set(0, *tmp); | 6608 root->set(0, *tmp); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7095 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7095 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
7096 slots[chunk->area_end() - kPointerSize] = false; | 7096 slots[chunk->area_end() - kPointerSize] = false; |
7097 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7097 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7098 CHECK(slots[addr]); | 7098 CHECK(slots[addr]); |
7099 return KEEP_SLOT; | 7099 return KEEP_SLOT; |
7100 }); | 7100 }); |
7101 } | 7101 } |
7102 | 7102 |
7103 } // namespace internal | 7103 } // namespace internal |
7104 } // namespace v8 | 7104 } // namespace v8 |
OLD | NEW |