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 5553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5564 // way the filler object shares the mark bits with the following live object. | 5564 // way the filler object shares the mark bits with the following live object. |
5565 o1->Shrink(kFixedArrayLen - 1); | 5565 o1->Shrink(kFixedArrayLen - 1); |
5566 | 5566 |
5567 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { | 5567 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { |
5568 // Let's not optimize the loop away. | 5568 // Let's not optimize the loop away. |
5569 CHECK(obj->address() != nullptr); | 5569 CHECK(obj->address() != nullptr); |
5570 } | 5570 } |
5571 } | 5571 } |
5572 | 5572 |
5573 | 5573 |
5574 TEST(ArrayShiftSweeping) { | |
5575 i::FLAG_expose_gc = true; | |
5576 CcTest::InitializeVM(); | |
5577 v8::HandleScope scope(CcTest::isolate()); | |
5578 Isolate* isolate = CcTest::i_isolate(); | |
5579 Heap* heap = isolate->heap(); | |
5580 | |
5581 v8::Local<v8::Value> result = CompileRun( | |
5582 "var array = new Array(400);" | |
5583 "var tmp = new Array(1000);" | |
5584 "array[0] = 10;" | |
5585 "gc();" | |
5586 "gc();" | |
5587 "array.shift();" | |
5588 "array;"); | |
5589 | |
5590 Handle<JSObject> o = Handle<JSObject>::cast( | |
5591 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result))); | |
5592 CHECK(heap->InOldSpace(o->elements())); | |
5593 CHECK(heap->InOldSpace(*o)); | |
5594 Page* page = Page::FromAddress(o->elements()->address()); | |
5595 CHECK(page->parallel_sweeping_state().Value() <= | |
5596 MemoryChunk::kSweepingFinalize || | |
5597 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | |
5598 } | |
5599 | |
5600 | |
5601 UNINITIALIZED_TEST(PromotionQueue) { | 5574 UNINITIALIZED_TEST(PromotionQueue) { |
5602 i::FLAG_expose_gc = true; | 5575 i::FLAG_expose_gc = true; |
5603 i::FLAG_max_semi_space_size = 2 * (Page::kPageSize / MB); | 5576 i::FLAG_max_semi_space_size = 2 * (Page::kPageSize / MB); |
5604 i::FLAG_min_semi_space_size = i::FLAG_max_semi_space_size; | 5577 i::FLAG_min_semi_space_size = i::FLAG_max_semi_space_size; |
5605 v8::Isolate::CreateParams create_params; | 5578 v8::Isolate::CreateParams create_params; |
5606 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 5579 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
5607 v8::Isolate* isolate = v8::Isolate::New(create_params); | 5580 v8::Isolate* isolate = v8::Isolate::New(create_params); |
5608 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5581 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5609 { | 5582 { |
5610 v8::Isolate::Scope isolate_scope(isolate); | 5583 v8::Isolate::Scope isolate_scope(isolate); |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6466 isolate->IncrementJsCallsFromApiCounter(); | 6439 isolate->IncrementJsCallsFromApiCounter(); |
6467 isolate->IncrementJsCallsFromApiCounter(); | 6440 isolate->IncrementJsCallsFromApiCounter(); |
6468 isolate->IncrementJsCallsFromApiCounter(); | 6441 isolate->IncrementJsCallsFromApiCounter(); |
6469 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6442 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
6470 CheckDoubleEquals(2, calls_per_ms); | 6443 CheckDoubleEquals(2, calls_per_ms); |
6471 } | 6444 } |
6472 | 6445 |
6473 | 6446 |
6474 } // namespace internal | 6447 } // namespace internal |
6475 } // namespace v8 | 6448 } // namespace v8 |
OLD | NEW |