Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: test/cctest/heap/test-heap.cc

Issue 2498583002: [heap] Minor MC: Add marking (Closed)
Patch Set: Move to concurrent uncomitting of marking deque Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/heap/test-array-buffer-tracker.cc ('k') | test/cctest/heap/test-page-promotion.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 CHECK(!function->is_compiled() || function->IsOptimized() || 1355 CHECK(!function->is_compiled() || function->IsOptimized() ||
1356 function->IsInterpreted()); 1356 function->IsInterpreted());
1357 // Call foo to get it recompiled. 1357 // Call foo to get it recompiled.
1358 CompileRun("foo()"); 1358 CompileRun("foo()");
1359 CHECK(function->shared()->is_compiled()); 1359 CHECK(function->shared()->is_compiled());
1360 CHECK(function->is_compiled()); 1360 CHECK(function->is_compiled());
1361 } 1361 }
1362 1362
1363 1363
1364 TEST(TestCodeFlushingIncremental) { 1364 TEST(TestCodeFlushingIncremental) {
1365 if (!i::FLAG_incremental_marking) return;
1365 // If we do not flush code this test is invalid. 1366 // If we do not flush code this test is invalid.
1366 if (!FLAG_flush_code) return; 1367 if (!FLAG_flush_code) return;
1367 i::FLAG_allow_natives_syntax = true; 1368 i::FLAG_allow_natives_syntax = true;
1368 i::FLAG_optimize_for_size = false; 1369 i::FLAG_optimize_for_size = false;
1369 CcTest::InitializeVM(); 1370 CcTest::InitializeVM();
1370 Isolate* isolate = CcTest::i_isolate(); 1371 Isolate* isolate = CcTest::i_isolate();
1371 Factory* factory = isolate->factory(); 1372 Factory* factory = isolate->factory();
1372 v8::HandleScope scope(CcTest::isolate()); 1373 v8::HandleScope scope(CcTest::isolate());
1373 const char* source = "function foo() {" 1374 const char* source = "function foo() {"
1374 " var x = 42;" 1375 " var x = 42;"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 } 1428 }
1428 1429
1429 // Simulate one final GC to make sure the candidate queue is sane. 1430 // Simulate one final GC to make sure the candidate queue is sane.
1430 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 1431 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
1431 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); 1432 CHECK(function->shared()->is_compiled() || !function->IsOptimized());
1432 CHECK(function->is_compiled() || !function->IsOptimized()); 1433 CHECK(function->is_compiled() || !function->IsOptimized());
1433 } 1434 }
1434 1435
1435 1436
1436 TEST(TestCodeFlushingIncrementalScavenge) { 1437 TEST(TestCodeFlushingIncrementalScavenge) {
1438 if (!FLAG_incremental_marking) return;
1437 // If we do not flush code this test is invalid. 1439 // If we do not flush code this test is invalid.
1438 if (!FLAG_flush_code) return; 1440 if (!FLAG_flush_code) return;
1439 i::FLAG_allow_natives_syntax = true; 1441 i::FLAG_allow_natives_syntax = true;
1440 i::FLAG_optimize_for_size = false; 1442 i::FLAG_optimize_for_size = false;
1441 CcTest::InitializeVM(); 1443 CcTest::InitializeVM();
1442 Isolate* isolate = CcTest::i_isolate(); 1444 Isolate* isolate = CcTest::i_isolate();
1443 Factory* factory = isolate->factory(); 1445 Factory* factory = isolate->factory();
1444 v8::HandleScope scope(CcTest::isolate()); 1446 v8::HandleScope scope(CcTest::isolate());
1445 const char* source = "var foo = function() {" 1447 const char* source = "var foo = function() {"
1446 " var x = 42;" 1448 " var x = 42;"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 // Simulate one final GC to make sure the candidate queue is sane. 1500 // Simulate one final GC to make sure the candidate queue is sane.
1499 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 1501 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
1500 CHECK(!function->shared()->is_compiled() || function->IsOptimized() || 1502 CHECK(!function->shared()->is_compiled() || function->IsOptimized() ||
1501 function->IsInterpreted()); 1503 function->IsInterpreted());
1502 CHECK(!function->is_compiled() || function->IsOptimized() || 1504 CHECK(!function->is_compiled() || function->IsOptimized() ||
1503 function->IsInterpreted()); 1505 function->IsInterpreted());
1504 } 1506 }
1505 1507
1506 1508
1507 TEST(TestCodeFlushingIncrementalAbort) { 1509 TEST(TestCodeFlushingIncrementalAbort) {
1510 if (!i::FLAG_incremental_marking) return;
1508 // If we do not flush code this test is invalid. 1511 // If we do not flush code this test is invalid.
1509 if (!FLAG_flush_code) return; 1512 if (!FLAG_flush_code) return;
1510 i::FLAG_allow_natives_syntax = true; 1513 i::FLAG_allow_natives_syntax = true;
1511 i::FLAG_optimize_for_size = false; 1514 i::FLAG_optimize_for_size = false;
1512 CcTest::InitializeVM(); 1515 CcTest::InitializeVM();
1513 Isolate* isolate = CcTest::i_isolate(); 1516 Isolate* isolate = CcTest::i_isolate();
1514 Factory* factory = isolate->factory(); 1517 Factory* factory = isolate->factory();
1515 Heap* heap = isolate->heap(); 1518 Heap* heap = isolate->heap();
1516 v8::HandleScope scope(CcTest::isolate()); 1519 v8::HandleScope scope(CcTest::isolate());
1517 const char* source = "function foo() {" 1520 const char* source = "function foo() {"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); 1567 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();");
1565 } 1568 }
1566 1569
1567 // Simulate one final GC to make sure the candidate queue is sane. 1570 // Simulate one final GC to make sure the candidate queue is sane.
1568 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 1571 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
1569 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); 1572 CHECK(function->shared()->is_compiled() || !function->IsOptimized());
1570 CHECK(function->is_compiled() || !function->IsOptimized()); 1573 CHECK(function->is_compiled() || !function->IsOptimized());
1571 } 1574 }
1572 1575
1573 TEST(TestUseOfIncrementalBarrierOnCompileLazy) { 1576 TEST(TestUseOfIncrementalBarrierOnCompileLazy) {
1577 if (!i::FLAG_incremental_marking) return;
1574 // Turn off always_opt because it interferes with running the built-in for 1578 // Turn off always_opt because it interferes with running the built-in for
1575 // the last call to g(). 1579 // the last call to g().
1576 i::FLAG_always_opt = false; 1580 i::FLAG_always_opt = false;
1577 i::FLAG_allow_natives_syntax = true; 1581 i::FLAG_allow_natives_syntax = true;
1578 CcTest::InitializeVM(); 1582 CcTest::InitializeVM();
1579 Isolate* isolate = CcTest::i_isolate(); 1583 Isolate* isolate = CcTest::i_isolate();
1580 Factory* factory = isolate->factory(); 1584 Factory* factory = isolate->factory();
1581 Heap* heap = isolate->heap(); 1585 Heap* heap = isolate->heap();
1582 v8::HandleScope scope(CcTest::isolate()); 1586 v8::HandleScope scope(CcTest::isolate());
1583 1587
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 } 2605 }
2602 CcTest::CollectAllAvailableGarbage(); 2606 CcTest::CollectAllAvailableGarbage();
2603 CHECK_EQ(1, NumberOfGlobalObjects()); 2607 CHECK_EQ(1, NumberOfGlobalObjects());
2604 ctx2p.Reset(); 2608 ctx2p.Reset();
2605 CcTest::CollectAllAvailableGarbage(); 2609 CcTest::CollectAllAvailableGarbage();
2606 CHECK_EQ(0, NumberOfGlobalObjects()); 2610 CHECK_EQ(0, NumberOfGlobalObjects());
2607 } 2611 }
2608 2612
2609 2613
2610 TEST(InstanceOfStubWriteBarrier) { 2614 TEST(InstanceOfStubWriteBarrier) {
2615 if (!i::FLAG_incremental_marking) return;
2611 i::FLAG_allow_natives_syntax = true; 2616 i::FLAG_allow_natives_syntax = true;
2612 #ifdef VERIFY_HEAP 2617 #ifdef VERIFY_HEAP
2613 i::FLAG_verify_heap = true; 2618 i::FLAG_verify_heap = true;
2614 #endif 2619 #endif
2615 2620
2616 CcTest::InitializeVM(); 2621 CcTest::InitializeVM();
2617 if (!CcTest::i_isolate()->use_crankshaft()) return; 2622 if (!CcTest::i_isolate()->use_crankshaft()) return;
2618 if (i::FLAG_force_marking_deque_overflows) return; 2623 if (i::FLAG_force_marking_deque_overflows) return;
2619 v8::HandleScope outer_scope(CcTest::isolate()); 2624 v8::HandleScope outer_scope(CcTest::isolate());
2620 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 2625 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 namespace { 2672 namespace {
2668 2673
2669 int GetProfilerTicks(SharedFunctionInfo* shared) { 2674 int GetProfilerTicks(SharedFunctionInfo* shared) {
2670 return FLAG_ignition || FLAG_turbo ? shared->profiler_ticks() 2675 return FLAG_ignition || FLAG_turbo ? shared->profiler_ticks()
2671 : shared->code()->profiler_ticks(); 2676 : shared->code()->profiler_ticks();
2672 } 2677 }
2673 2678
2674 } // namespace 2679 } // namespace
2675 2680
2676 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { 2681 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
2682 if (!i::FLAG_incremental_marking) return;
2677 i::FLAG_stress_compaction = false; 2683 i::FLAG_stress_compaction = false;
2678 i::FLAG_allow_natives_syntax = true; 2684 i::FLAG_allow_natives_syntax = true;
2679 #ifdef VERIFY_HEAP 2685 #ifdef VERIFY_HEAP
2680 i::FLAG_verify_heap = true; 2686 i::FLAG_verify_heap = true;
2681 #endif 2687 #endif
2682 2688
2683 CcTest::InitializeVM(); 2689 CcTest::InitializeVM();
2684 if (!CcTest::i_isolate()->use_crankshaft()) return; 2690 if (!CcTest::i_isolate()->use_crankshaft()) return;
2685 v8::HandleScope outer_scope(CcTest::isolate()); 2691 v8::HandleScope outer_scope(CcTest::isolate());
2686 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 2692 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 CcTest::isolate()->ContextDisposedNotification(); 2764 CcTest::isolate()->ContextDisposedNotification();
2759 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 2765 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
2760 2766
2761 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); 2767 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
2762 CHECK_EQ(0, f->shared()->opt_count()); 2768 CHECK_EQ(0, f->shared()->opt_count());
2763 CHECK_EQ(0, GetProfilerTicks(f->shared())); 2769 CHECK_EQ(0, GetProfilerTicks(f->shared()));
2764 } 2770 }
2765 2771
2766 2772
2767 HEAP_TEST(GCFlags) { 2773 HEAP_TEST(GCFlags) {
2774 if (!i::FLAG_incremental_marking) return;
2768 CcTest::InitializeVM(); 2775 CcTest::InitializeVM();
2769 Heap* heap = CcTest::heap(); 2776 Heap* heap = CcTest::heap();
2770 2777
2771 heap->set_current_gc_flags(Heap::kNoGCFlags); 2778 heap->set_current_gc_flags(Heap::kNoGCFlags);
2772 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); 2779 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_);
2773 2780
2774 // Set the flags to check whether we appropriately resets them after the GC. 2781 // Set the flags to check whether we appropriately resets them after the GC.
2775 heap->set_current_gc_flags(Heap::kAbortIncrementalMarkingMask); 2782 heap->set_current_gc_flags(Heap::kAbortIncrementalMarkingMask);
2776 CcTest::CollectAllGarbage(Heap::kReduceMemoryFootprintMask); 2783 CcTest::CollectAllGarbage(Heap::kReduceMemoryFootprintMask);
2777 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); 2784 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_);
(...skipping 12 matching lines...) Expand all
2790 CcTest::CollectGarbage(NEW_SPACE); 2797 CcTest::CollectGarbage(NEW_SPACE);
2791 // NewSpace scavenges should not overwrite the flags. 2798 // NewSpace scavenges should not overwrite the flags.
2792 CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask); 2799 CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask);
2793 2800
2794 CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 2801 CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
2795 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); 2802 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_);
2796 } 2803 }
2797 2804
2798 2805
2799 TEST(IdleNotificationFinishMarking) { 2806 TEST(IdleNotificationFinishMarking) {
2807 if (!i::FLAG_incremental_marking) return;
2800 i::FLAG_allow_natives_syntax = true; 2808 i::FLAG_allow_natives_syntax = true;
2801 CcTest::InitializeVM(); 2809 CcTest::InitializeVM();
2802 const int initial_gc_count = CcTest::heap()->gc_count(); 2810 const int initial_gc_count = CcTest::heap()->gc_count();
2803 heap::SimulateFullSpace(CcTest::heap()->old_space()); 2811 heap::SimulateFullSpace(CcTest::heap()->old_space());
2804 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 2812 IncrementalMarking* marking = CcTest::heap()->incremental_marking();
2805 marking->Stop(); 2813 marking->Stop();
2806 CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags, 2814 CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags,
2807 i::GarbageCollectionReason::kTesting); 2815 i::GarbageCollectionReason::kTesting);
2808 2816
2809 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); 2817 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count);
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
3289 3297
3290 3298
3291 static int CountMapTransitions(Map* map) { 3299 static int CountMapTransitions(Map* map) {
3292 return TransitionArray::NumberOfTransitions(map->raw_transitions()); 3300 return TransitionArray::NumberOfTransitions(map->raw_transitions());
3293 } 3301 }
3294 3302
3295 3303
3296 // Test that map transitions are cleared and maps are collected with 3304 // Test that map transitions are cleared and maps are collected with
3297 // incremental marking as well. 3305 // incremental marking as well.
3298 TEST(Regress1465) { 3306 TEST(Regress1465) {
3307 if (!i::FLAG_incremental_marking) return;
3299 i::FLAG_stress_compaction = false; 3308 i::FLAG_stress_compaction = false;
3300 i::FLAG_allow_natives_syntax = true; 3309 i::FLAG_allow_natives_syntax = true;
3301 i::FLAG_trace_incremental_marking = true; 3310 i::FLAG_trace_incremental_marking = true;
3302 i::FLAG_retain_maps_for_n_gc = 0; 3311 i::FLAG_retain_maps_for_n_gc = 0;
3303 CcTest::InitializeVM(); 3312 CcTest::InitializeVM();
3304 v8::HandleScope scope(CcTest::isolate()); 3313 v8::HandleScope scope(CcTest::isolate());
3305 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 3314 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
3306 static const int transitions_count = 256; 3315 static const int transitions_count = 256;
3307 3316
3308 CompileRun("function F() {}"); 3317 CompileRun("function F() {}");
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 CcTest::global()->Get(ctx, v8_str("g")).ToLocalChecked()))); 3673 CcTest::global()->Get(ctx, v8_str("g")).ToLocalChecked())));
3665 3674
3666 OFStream os(stdout); 3675 OFStream os(stdout);
3667 g->shared()->Print(os); 3676 g->shared()->Print(os);
3668 os << std::endl; 3677 os << std::endl;
3669 } 3678 }
3670 #endif // OBJECT_PRINT 3679 #endif // OBJECT_PRINT
3671 3680
3672 3681
3673 TEST(IncrementalMarkingPreservesMonomorphicCallIC) { 3682 TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
3683 if (!FLAG_incremental_marking) return;
3674 if (i::FLAG_always_opt) return; 3684 if (i::FLAG_always_opt) return;
3675 CcTest::InitializeVM(); 3685 CcTest::InitializeVM();
3676 v8::HandleScope scope(CcTest::isolate()); 3686 v8::HandleScope scope(CcTest::isolate());
3677 v8::Local<v8::Value> fun1, fun2; 3687 v8::Local<v8::Value> fun1, fun2;
3678 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 3688 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
3679 { 3689 {
3680 CompileRun("function fun() {};"); 3690 CompileRun("function fun() {};");
3681 fun1 = CcTest::global()->Get(ctx, v8_str("fun")).ToLocalChecked(); 3691 fun1 = CcTest::global()->Get(ctx, v8_str("fun")).ToLocalChecked();
3682 } 3692 }
3683 3693
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 LoadICNexus nexus(vector, slot); 3749 LoadICNexus nexus(vector, slot);
3740 CHECK(nexus.StateFromFeedback() == desired_state); 3750 CHECK(nexus.StateFromFeedback() == desired_state);
3741 } else { 3751 } else {
3742 CHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot)); 3752 CHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot));
3743 KeyedLoadICNexus nexus(vector, slot); 3753 KeyedLoadICNexus nexus(vector, slot);
3744 CHECK(nexus.StateFromFeedback() == desired_state); 3754 CHECK(nexus.StateFromFeedback() == desired_state);
3745 } 3755 }
3746 } 3756 }
3747 3757
3748 TEST(IncrementalMarkingPreservesMonomorphicConstructor) { 3758 TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
3759 if (!i::FLAG_incremental_marking) return;
3749 if (i::FLAG_always_opt) return; 3760 if (i::FLAG_always_opt) return;
3750 CcTest::InitializeVM(); 3761 CcTest::InitializeVM();
3751 v8::HandleScope scope(CcTest::isolate()); 3762 v8::HandleScope scope(CcTest::isolate());
3752 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 3763 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
3753 // Prepare function f that contains a monomorphic IC for object 3764 // Prepare function f that contains a monomorphic IC for object
3754 // originating from the same native context. 3765 // originating from the same native context.
3755 CompileRun( 3766 CompileRun(
3756 "function fun() { this.x = 1; };" 3767 "function fun() { this.x = 1; };"
3757 "function f(o) { return new o(); } f(fun); f(fun);"); 3768 "function f(o) { return new o(); } f(fun); f(fun);");
3758 Handle<JSFunction> f = Handle<JSFunction>::cast( 3769 Handle<JSFunction> f = Handle<JSFunction>::cast(
3759 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( 3770 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
3760 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); 3771 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
3761 3772
3762 Handle<TypeFeedbackVector> vector(f->feedback_vector()); 3773 Handle<TypeFeedbackVector> vector(f->feedback_vector());
3763 CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); 3774 CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell());
3764 3775
3765 heap::SimulateIncrementalMarking(CcTest::heap()); 3776 heap::SimulateIncrementalMarking(CcTest::heap());
3766 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 3777 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
3767 3778
3768 CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); 3779 CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell());
3769 } 3780 }
3770 3781
3771 TEST(IncrementalMarkingPreservesMonomorphicIC) { 3782 TEST(IncrementalMarkingPreservesMonomorphicIC) {
3783 if (!i::FLAG_incremental_marking) return;
3772 if (i::FLAG_always_opt) return; 3784 if (i::FLAG_always_opt) return;
3773 CcTest::InitializeVM(); 3785 CcTest::InitializeVM();
3774 v8::HandleScope scope(CcTest::isolate()); 3786 v8::HandleScope scope(CcTest::isolate());
3775 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 3787 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
3776 // Prepare function f that contains a monomorphic IC for object 3788 // Prepare function f that contains a monomorphic IC for object
3777 // originating from the same native context. 3789 // originating from the same native context.
3778 CompileRun("function fun() { this.x = 1; }; var obj = new fun();" 3790 CompileRun("function fun() { this.x = 1; }; var obj = new fun();"
3779 "function f(o) { return o.x; } f(obj); f(obj);"); 3791 "function f(o) { return o.x; } f(obj); f(obj);");
3780 Handle<JSFunction> f = Handle<JSFunction>::cast( 3792 Handle<JSFunction> f = Handle<JSFunction>::cast(
3781 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( 3793 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
3782 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); 3794 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
3783 3795
3784 CheckVectorIC(f, 0, MONOMORPHIC); 3796 CheckVectorIC(f, 0, MONOMORPHIC);
3785 3797
3786 heap::SimulateIncrementalMarking(CcTest::heap()); 3798 heap::SimulateIncrementalMarking(CcTest::heap());
3787 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 3799 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
3788 3800
3789 CheckVectorIC(f, 0, MONOMORPHIC); 3801 CheckVectorIC(f, 0, MONOMORPHIC);
3790 } 3802 }
3791 3803
3792 TEST(IncrementalMarkingPreservesPolymorphicIC) { 3804 TEST(IncrementalMarkingPreservesPolymorphicIC) {
3805 if (!i::FLAG_incremental_marking) return;
3793 if (i::FLAG_always_opt) return; 3806 if (i::FLAG_always_opt) return;
3794 CcTest::InitializeVM(); 3807 CcTest::InitializeVM();
3795 v8::HandleScope scope(CcTest::isolate()); 3808 v8::HandleScope scope(CcTest::isolate());
3796 v8::Local<v8::Value> obj1, obj2; 3809 v8::Local<v8::Value> obj1, obj2;
3797 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 3810 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
3798 3811
3799 { 3812 {
3800 LocalContext env; 3813 LocalContext env;
3801 CompileRun("function fun() { this.x = 1; }; var obj = new fun();"); 3814 CompileRun("function fun() { this.x = 1; }; var obj = new fun();");
3802 obj1 = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked(); 3815 obj1 = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
(...skipping 17 matching lines...) Expand all
3820 CheckVectorIC(f, 0, POLYMORPHIC); 3833 CheckVectorIC(f, 0, POLYMORPHIC);
3821 3834
3822 // Fire context dispose notification. 3835 // Fire context dispose notification.
3823 heap::SimulateIncrementalMarking(CcTest::heap()); 3836 heap::SimulateIncrementalMarking(CcTest::heap());
3824 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 3837 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
3825 3838
3826 CheckVectorIC(f, 0, POLYMORPHIC); 3839 CheckVectorIC(f, 0, POLYMORPHIC);
3827 } 3840 }
3828 3841
3829 TEST(ContextDisposeDoesntClearPolymorphicIC) { 3842 TEST(ContextDisposeDoesntClearPolymorphicIC) {
3843 if (!i::FLAG_incremental_marking) return;
3830 if (i::FLAG_always_opt) return; 3844 if (i::FLAG_always_opt) return;
3831 CcTest::InitializeVM(); 3845 CcTest::InitializeVM();
3832 v8::HandleScope scope(CcTest::isolate()); 3846 v8::HandleScope scope(CcTest::isolate());
3833 v8::Local<v8::Value> obj1, obj2; 3847 v8::Local<v8::Value> obj1, obj2;
3834 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); 3848 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
3835 3849
3836 { 3850 {
3837 LocalContext env; 3851 LocalContext env;
3838 CompileRun("function fun() { this.x = 1; }; var obj = new fun();"); 3852 CompileRun("function fun() { this.x = 1; }; var obj = new fun();");
3839 obj1 = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked(); 3853 obj1 = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 ReleaseStackTraceDataTest(isolate, source1, getter); 3989 ReleaseStackTraceDataTest(isolate, source1, getter);
3976 ReleaseStackTraceDataTest(isolate, source2, getter); 3990 ReleaseStackTraceDataTest(isolate, source2, getter);
3977 ReleaseStackTraceDataTest(isolate, source3, getter); 3991 ReleaseStackTraceDataTest(isolate, source3, getter);
3978 ReleaseStackTraceDataTest(isolate, source4, getter); 3992 ReleaseStackTraceDataTest(isolate, source4, getter);
3979 } 3993 }
3980 isolate->Dispose(); 3994 isolate->Dispose();
3981 } 3995 }
3982 3996
3983 3997
3984 TEST(Regress159140) { 3998 TEST(Regress159140) {
3999 if (!i::FLAG_incremental_marking) return;
3985 i::FLAG_allow_natives_syntax = true; 4000 i::FLAG_allow_natives_syntax = true;
3986 CcTest::InitializeVM(); 4001 CcTest::InitializeVM();
3987 Isolate* isolate = CcTest::i_isolate(); 4002 Isolate* isolate = CcTest::i_isolate();
3988 LocalContext env; 4003 LocalContext env;
3989 Heap* heap = isolate->heap(); 4004 Heap* heap = isolate->heap();
3990 HandleScope scope(isolate); 4005 HandleScope scope(isolate);
3991 4006
3992 // Perform one initial GC to enable code flushing. 4007 // Perform one initial GC to enable code flushing.
3993 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 4008 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
3994 4009
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 heap::SimulateIncrementalMarking(heap); 4050 heap::SimulateIncrementalMarking(heap);
4036 CompileRun("%OptimizeFunctionOnNextCall(g); g(3);"); 4051 CompileRun("%OptimizeFunctionOnNextCall(g); g(3);");
4037 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 4052 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
4038 4053
4039 // Unoptimized code is missing and the deoptimizer will go ballistic. 4054 // Unoptimized code is missing and the deoptimizer will go ballistic.
4040 CompileRun("g('bozo');"); 4055 CompileRun("g('bozo');");
4041 } 4056 }
4042 4057
4043 4058
4044 TEST(Regress165495) { 4059 TEST(Regress165495) {
4060 if (!i::FLAG_incremental_marking) return;
4045 i::FLAG_allow_natives_syntax = true; 4061 i::FLAG_allow_natives_syntax = true;
4046 CcTest::InitializeVM(); 4062 CcTest::InitializeVM();
4047 Isolate* isolate = CcTest::i_isolate(); 4063 Isolate* isolate = CcTest::i_isolate();
4048 Heap* heap = isolate->heap(); 4064 Heap* heap = isolate->heap();
4049 HandleScope scope(isolate); 4065 HandleScope scope(isolate);
4050 4066
4051 // Perform one initial GC to enable code flushing. 4067 // Perform one initial GC to enable code flushing.
4052 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 4068 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
4053 4069
4054 // Prepare an optimized closure that the optimized code map will get 4070 // Prepare an optimized closure that the optimized code map will get
(...skipping 26 matching lines...) Expand all
4081 heap::SimulateIncrementalMarking(heap); 4097 heap::SimulateIncrementalMarking(heap);
4082 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 4098 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
4083 4099
4084 // Make a new closure that will get code installed from the code map. 4100 // Make a new closure that will get code installed from the code map.
4085 // Unoptimized code is missing and the deoptimizer will go ballistic. 4101 // Unoptimized code is missing and the deoptimizer will go ballistic.
4086 CompileRun("var g = mkClosure(); g('bozo');"); 4102 CompileRun("var g = mkClosure(); g('bozo');");
4087 } 4103 }
4088 4104
4089 4105
4090 TEST(Regress169209) { 4106 TEST(Regress169209) {
4107 if (!i::FLAG_incremental_marking) return;
4091 i::FLAG_always_opt = false; 4108 i::FLAG_always_opt = false;
4092 i::FLAG_stress_compaction = false; 4109 i::FLAG_stress_compaction = false;
4093 i::FLAG_allow_natives_syntax = true; 4110 i::FLAG_allow_natives_syntax = true;
4094 4111
4095 CcTest::InitializeVM(); 4112 CcTest::InitializeVM();
4096 Isolate* isolate = CcTest::i_isolate(); 4113 Isolate* isolate = CcTest::i_isolate();
4097 Heap* heap = isolate->heap(); 4114 Heap* heap = isolate->heap();
4098 HandleScope scope(isolate); 4115 HandleScope scope(isolate);
4099 4116
4100 // Perform one initial GC to enable code flushing. 4117 // Perform one initial GC to enable code flushing.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 FLAG_gc_interval = 1000; 4314 FLAG_gc_interval = 1000;
4298 for (int i = 0; i < 10; ++i) { 4315 for (int i = 0; i < 10; ++i) {
4299 BailoutId id = BailoutId(i); 4316 BailoutId id = BailoutId(i);
4300 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); 4317 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
4301 } 4318 }
4302 } 4319 }
4303 #endif // DEBUG 4320 #endif // DEBUG
4304 4321
4305 4322
4306 TEST(Regress514122) { 4323 TEST(Regress514122) {
4324 if (!i::FLAG_incremental_marking) return;
4307 i::FLAG_flush_optimized_code_cache = false; 4325 i::FLAG_flush_optimized_code_cache = false;
4308 i::FLAG_allow_natives_syntax = true; 4326 i::FLAG_allow_natives_syntax = true;
4309 CcTest::InitializeVM(); 4327 CcTest::InitializeVM();
4310 Isolate* isolate = CcTest::i_isolate(); 4328 Isolate* isolate = CcTest::i_isolate();
4311 LocalContext env; 4329 LocalContext env;
4312 Heap* heap = isolate->heap(); 4330 Heap* heap = isolate->heap();
4313 HandleScope scope(isolate); 4331 HandleScope scope(isolate);
4314 4332
4315 // Perfrom one initial GC to enable code flushing. 4333 // Perfrom one initial GC to enable code flushing.
4316 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 4334 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
4558 // though the optimized code for 'f' is reachable via the optimized code map. 4576 // though the optimized code for 'f' is reachable via the optimized code map.
4559 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 4577 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
4560 4578
4561 // Make a new closure that will get code installed from the code map. 4579 // Make a new closure that will get code installed from the code map.
4562 // Unoptimized code is missing and the deoptimizer will go ballistic. 4580 // Unoptimized code is missing and the deoptimizer will go ballistic.
4563 CompileRun("var h = mkClosure(); h('bozo');"); 4581 CompileRun("var h = mkClosure(); h('bozo');");
4564 } 4582 }
4565 4583
4566 4584
4567 TEST(LargeObjectSlotRecording) { 4585 TEST(LargeObjectSlotRecording) {
4586 if (!i::FLAG_incremental_marking) return;
4568 FLAG_manual_evacuation_candidates_selection = true; 4587 FLAG_manual_evacuation_candidates_selection = true;
4569 CcTest::InitializeVM(); 4588 CcTest::InitializeVM();
4570 Isolate* isolate = CcTest::i_isolate(); 4589 Isolate* isolate = CcTest::i_isolate();
4571 Heap* heap = isolate->heap(); 4590 Heap* heap = isolate->heap();
4572 HandleScope scope(isolate); 4591 HandleScope scope(isolate);
4573 4592
4574 // Create an object on an evacuation candidate. 4593 // Create an object on an evacuation candidate.
4575 heap::SimulateFullSpace(heap->old_space()); 4594 heap::SimulateFullSpace(heap->old_space());
4576 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); 4595 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED);
4577 Page* evac_page = Page::FromAddress(lit->address()); 4596 Page* evac_page = Page::FromAddress(lit->address());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
4630 CHECK(data->next == data->limit); 4649 CHECK(data->next == data->limit);
4631 4650
4632 DeferredHandleScope deferred(isolate); 4651 DeferredHandleScope deferred(isolate);
4633 DummyVisitor visitor; 4652 DummyVisitor visitor;
4634 isolate->handle_scope_implementer()->Iterate(&visitor); 4653 isolate->handle_scope_implementer()->Iterate(&visitor);
4635 delete deferred.Detach(); 4654 delete deferred.Detach();
4636 } 4655 }
4637 4656
4638 4657
4639 TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) { 4658 TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
4659 if (!FLAG_incremental_marking) return;
4640 CcTest::InitializeVM(); 4660 CcTest::InitializeVM();
4641 v8::HandleScope scope(CcTest::isolate()); 4661 v8::HandleScope scope(CcTest::isolate());
4642 CompileRun("function f(n) {" 4662 CompileRun("function f(n) {"
4643 " var a = new Array(n);" 4663 " var a = new Array(n);"
4644 " for (var i = 0; i < n; i += 100) a[i] = i;" 4664 " for (var i = 0; i < n; i += 100) a[i] = i;"
4645 "};" 4665 "};"
4646 "f(10 * 1024 * 1024);"); 4666 "f(10 * 1024 * 1024);");
4647 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 4667 IncrementalMarking* marking = CcTest::heap()->incremental_marking();
4648 if (marking->IsStopped()) { 4668 if (marking->IsStopped()) {
4649 CcTest::heap()->StartIncrementalMarking( 4669 CcTest::heap()->StartIncrementalMarking(
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 CcTest::CollectGarbage(NEW_SPACE); 5461 CcTest::CollectGarbage(NEW_SPACE);
5442 CHECK(weak_cell1->value()->IsFixedArray()); 5462 CHECK(weak_cell1->value()->IsFixedArray());
5443 CHECK_EQ(*survivor, weak_cell2->value()); 5463 CHECK_EQ(*survivor, weak_cell2->value());
5444 CcTest::CollectAllAvailableGarbage(); 5464 CcTest::CollectAllAvailableGarbage();
5445 CHECK(weak_cell1->cleared()); 5465 CHECK(weak_cell1->cleared());
5446 CHECK_EQ(*survivor, weak_cell2->value()); 5466 CHECK_EQ(*survivor, weak_cell2->value());
5447 } 5467 }
5448 5468
5449 5469
5450 TEST(WeakCellsWithIncrementalMarking) { 5470 TEST(WeakCellsWithIncrementalMarking) {
5471 if (!FLAG_incremental_marking) return;
5451 CcTest::InitializeVM(); 5472 CcTest::InitializeVM();
5452 Isolate* isolate = CcTest::i_isolate(); 5473 Isolate* isolate = CcTest::i_isolate();
5453 v8::internal::Heap* heap = CcTest::heap(); 5474 v8::internal::Heap* heap = CcTest::heap();
5454 v8::internal::Factory* factory = isolate->factory(); 5475 v8::internal::Factory* factory = isolate->factory();
5455 5476
5456 const int N = 16; 5477 const int N = 16;
5457 HandleScope outer_scope(isolate); 5478 HandleScope outer_scope(isolate);
5458 Handle<FixedArray> survivor = factory->NewFixedArray(1, NOT_TENURED); 5479 Handle<FixedArray> survivor = factory->NewFixedArray(1, NOT_TENURED);
5459 Handle<WeakCell> weak_cells[N]; 5480 Handle<WeakCell> weak_cells[N];
5460 5481
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
5712 5733
5713 // This scavenge will corrupt memory if the promotion queue is not 5734 // This scavenge will corrupt memory if the promotion queue is not
5714 // evacuated. 5735 // evacuated.
5715 heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); 5736 heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
5716 } 5737 }
5717 isolate->Dispose(); 5738 isolate->Dispose();
5718 } 5739 }
5719 5740
5720 5741
5721 TEST(Regress388880) { 5742 TEST(Regress388880) {
5743 if (!FLAG_incremental_marking) return;
5722 i::FLAG_expose_gc = true; 5744 i::FLAG_expose_gc = true;
5723 CcTest::InitializeVM(); 5745 CcTest::InitializeVM();
5724 v8::HandleScope scope(CcTest::isolate()); 5746 v8::HandleScope scope(CcTest::isolate());
5725 Isolate* isolate = CcTest::i_isolate(); 5747 Isolate* isolate = CcTest::i_isolate();
5726 Factory* factory = isolate->factory(); 5748 Factory* factory = isolate->factory();
5727 Heap* heap = isolate->heap(); 5749 Heap* heap = isolate->heap();
5728 5750
5729 Handle<Map> map1 = Map::Create(isolate, 1); 5751 Handle<Map> map1 = Map::Create(isolate, 1);
5730 Handle<String> name = factory->NewStringFromStaticChars("foo"); 5752 Handle<String> name = factory->NewStringFromStaticChars("foo");
5731 name = factory->InternalizeString(name); 5753 name = factory->InternalizeString(name);
(...skipping 27 matching lines...) Expand all
5759 i::GarbageCollectionReason::kTesting); 5781 i::GarbageCollectionReason::kTesting);
5760 CHECK(marking->IsMarking()); 5782 CHECK(marking->IsMarking());
5761 5783
5762 // Now everything is set up for crashing in JSObject::MigrateFastToFast() 5784 // Now everything is set up for crashing in JSObject::MigrateFastToFast()
5763 // when it calls heap->AdjustLiveBytes(...). 5785 // when it calls heap->AdjustLiveBytes(...).
5764 JSObject::MigrateToMap(o, map2); 5786 JSObject::MigrateToMap(o, map2);
5765 } 5787 }
5766 5788
5767 5789
5768 TEST(Regress3631) { 5790 TEST(Regress3631) {
5791 if (!FLAG_incremental_marking) return;
5769 i::FLAG_expose_gc = true; 5792 i::FLAG_expose_gc = true;
5770 CcTest::InitializeVM(); 5793 CcTest::InitializeVM();
5771 v8::HandleScope scope(CcTest::isolate()); 5794 v8::HandleScope scope(CcTest::isolate());
5772 Isolate* isolate = CcTest::i_isolate(); 5795 Isolate* isolate = CcTest::i_isolate();
5773 Heap* heap = isolate->heap(); 5796 Heap* heap = isolate->heap();
5774 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 5797 IncrementalMarking* marking = CcTest::heap()->incremental_marking();
5775 v8::Local<v8::Value> result = CompileRun( 5798 v8::Local<v8::Value> result = CompileRun(
5776 "var weak_map = new WeakMap();" 5799 "var weak_map = new WeakMap();"
5777 "var future_keys = [];" 5800 "var future_keys = [];"
5778 "for (var i = 0; i < 50; i++) {" 5801 "for (var i = 0; i < 50; i++) {"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5892 CcTest::CollectGarbage(OLD_SPACE); 5915 CcTest::CollectGarbage(OLD_SPACE);
5893 } 5916 }
5894 CHECK(!weak_cell->cleared()); 5917 CHECK(!weak_cell->cleared());
5895 heap::SimulateIncrementalMarking(heap); 5918 heap::SimulateIncrementalMarking(heap);
5896 CcTest::CollectGarbage(OLD_SPACE); 5919 CcTest::CollectGarbage(OLD_SPACE);
5897 CHECK(weak_cell->cleared()); 5920 CHECK(weak_cell->cleared());
5898 } 5921 }
5899 5922
5900 5923
5901 TEST(MapRetaining) { 5924 TEST(MapRetaining) {
5925 if (!FLAG_incremental_marking) return;
5902 CcTest::InitializeVM(); 5926 CcTest::InitializeVM();
5903 v8::HandleScope scope(CcTest::isolate()); 5927 v8::HandleScope scope(CcTest::isolate());
5904 CheckMapRetainingFor(FLAG_retain_maps_for_n_gc); 5928 CheckMapRetainingFor(FLAG_retain_maps_for_n_gc);
5905 CheckMapRetainingFor(0); 5929 CheckMapRetainingFor(0);
5906 CheckMapRetainingFor(1); 5930 CheckMapRetainingFor(1);
5907 CheckMapRetainingFor(7); 5931 CheckMapRetainingFor(7);
5908 } 5932 }
5909 5933
5910 5934
5911 TEST(RegressArrayListGC) { 5935 TEST(RegressArrayListGC) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
6392 } 6416 }
6393 6417
6394 6418
6395 template <typename T> 6419 template <typename T>
6396 static UniqueId MakeUniqueId(const Persistent<T>& p) { 6420 static UniqueId MakeUniqueId(const Persistent<T>& p) {
6397 return UniqueId(reinterpret_cast<uintptr_t>(*v8::Utils::OpenPersistent(p))); 6421 return UniqueId(reinterpret_cast<uintptr_t>(*v8::Utils::OpenPersistent(p)));
6398 } 6422 }
6399 6423
6400 6424
6401 TEST(Regress519319) { 6425 TEST(Regress519319) {
6426 if (!FLAG_incremental_marking) return;
6402 CcTest::InitializeVM(); 6427 CcTest::InitializeVM();
6403 v8::Isolate* isolate = CcTest::isolate(); 6428 v8::Isolate* isolate = CcTest::isolate();
6404 v8::HandleScope scope(isolate); 6429 v8::HandleScope scope(isolate);
6405 Heap* heap = CcTest::heap(); 6430 Heap* heap = CcTest::heap();
6406 LocalContext context; 6431 LocalContext context;
6407 6432
6408 v8::Persistent<Value> parent; 6433 v8::Persistent<Value> parent;
6409 v8::Persistent<Value> child; 6434 v8::Persistent<Value> child;
6410 6435
6411 parent.Reset(isolate, v8::Object::New(isolate)); 6436 parent.Reset(isolate, v8::Object::New(isolate));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
6460 for (int j = 0; j < M; j++) { 6485 for (int j = 0; j < M; j++) {
6461 byte_array->set(j, 0x31); 6486 byte_array->set(j, 0x31);
6462 } 6487 }
6463 } 6488 }
6464 // Re-enable old space expansion to avoid OOM crash. 6489 // Re-enable old space expansion to avoid OOM crash.
6465 heap->set_force_oom(false); 6490 heap->set_force_oom(false);
6466 CcTest::CollectGarbage(NEW_SPACE); 6491 CcTest::CollectGarbage(NEW_SPACE);
6467 } 6492 }
6468 6493
6469 HEAP_TEST(Regress589413) { 6494 HEAP_TEST(Regress589413) {
6495 if (!FLAG_incremental_marking) return;
6470 FLAG_stress_compaction = true; 6496 FLAG_stress_compaction = true;
6471 FLAG_manual_evacuation_candidates_selection = true; 6497 FLAG_manual_evacuation_candidates_selection = true;
6472 FLAG_parallel_compaction = false; 6498 FLAG_parallel_compaction = false;
6473 FLAG_concurrent_sweeping = false; 6499 FLAG_concurrent_sweeping = false;
6474 CcTest::InitializeVM(); 6500 CcTest::InitializeVM();
6475 v8::HandleScope scope(CcTest::isolate()); 6501 v8::HandleScope scope(CcTest::isolate());
6476 Heap* heap = CcTest::heap(); 6502 Heap* heap = CcTest::heap();
6477 // Get the heap in clean state. 6503 // Get the heap in clean state.
6478 CcTest::CollectGarbage(OLD_SPACE); 6504 CcTest::CollectGarbage(OLD_SPACE);
6479 CcTest::CollectGarbage(OLD_SPACE); 6505 CcTest::CollectGarbage(OLD_SPACE);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
6535 for (size_t j = 0; j < arrays.size(); j++) { 6561 for (size_t j = 0; j < arrays.size(); j++) {
6536 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); 6562 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1);
6537 } 6563 }
6538 } 6564 }
6539 // Force allocation from the free list. 6565 // Force allocation from the free list.
6540 heap->set_force_oom(true); 6566 heap->set_force_oom(true);
6541 CcTest::CollectGarbage(OLD_SPACE); 6567 CcTest::CollectGarbage(OLD_SPACE);
6542 } 6568 }
6543 6569
6544 TEST(Regress598319) { 6570 TEST(Regress598319) {
6571 if (!FLAG_incremental_marking) return;
6545 // This test ensures that no white objects can cross the progress bar of large 6572 // This test ensures that no white objects can cross the progress bar of large
6546 // objects during incremental marking. It checks this by using Shift() during 6573 // objects during incremental marking. It checks this by using Shift() during
6547 // incremental marking. 6574 // incremental marking.
6548 CcTest::InitializeVM(); 6575 CcTest::InitializeVM();
6549 v8::HandleScope scope(CcTest::isolate()); 6576 v8::HandleScope scope(CcTest::isolate());
6550 Heap* heap = CcTest::heap(); 6577 Heap* heap = CcTest::heap();
6551 Isolate* isolate = heap->isolate(); 6578 Isolate* isolate = heap->isolate();
6552 6579
6553 const int kNumberOfObjects = kMaxRegularHeapObjectSize / kPointerSize; 6580 const int kNumberOfObjects = kMaxRegularHeapObjectSize / kPointerSize;
6554 6581
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
6651 Isolate* isolate = heap->isolate(); 6678 Isolate* isolate = heap->isolate();
6652 6679
6653 intptr_t size_before = heap->SizeOfObjects(); 6680 intptr_t size_before = heap->SizeOfObjects();
6654 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); 6681 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000);
6655 array->Shrink(1); 6682 array->Shrink(1);
6656 intptr_t size_after = heap->SizeOfObjects(); 6683 intptr_t size_after = heap->SizeOfObjects();
6657 CHECK_EQ(size_after, size_before + array->Size()); 6684 CHECK_EQ(size_after, size_before + array->Size());
6658 } 6685 }
6659 6686
6660 TEST(Regress615489) { 6687 TEST(Regress615489) {
6688 if (!i::FLAG_incremental_marking) return;
6661 FLAG_black_allocation = true; 6689 FLAG_black_allocation = true;
6662 CcTest::InitializeVM(); 6690 CcTest::InitializeVM();
6663 v8::HandleScope scope(CcTest::isolate()); 6691 v8::HandleScope scope(CcTest::isolate());
6664 Heap* heap = CcTest::heap(); 6692 Heap* heap = CcTest::heap();
6665 Isolate* isolate = heap->isolate(); 6693 Isolate* isolate = heap->isolate();
6666 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 6694 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
6667 6695
6668 i::MarkCompactCollector* collector = heap->mark_compact_collector(); 6696 i::MarkCompactCollector* collector = heap->mark_compact_collector();
6669 i::IncrementalMarking* marking = heap->incremental_marking(); 6697 i::IncrementalMarking* marking = heap->incremental_marking();
6670 if (collector->sweeping_in_progress()) { 6698 if (collector->sweeping_in_progress()) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6705 6733
6706 const char* data() const { return data_; } 6734 const char* data() const { return data_; }
6707 6735
6708 size_t length() const { return strlen(data_); } 6736 size_t length() const { return strlen(data_); }
6709 6737
6710 private: 6738 private:
6711 const char* data_; 6739 const char* data_;
6712 }; 6740 };
6713 6741
6714 TEST(Regress631969) { 6742 TEST(Regress631969) {
6743 if (!FLAG_incremental_marking) return;
6715 FLAG_manual_evacuation_candidates_selection = true; 6744 FLAG_manual_evacuation_candidates_selection = true;
6716 FLAG_parallel_compaction = false; 6745 FLAG_parallel_compaction = false;
6717 FLAG_concurrent_sweeping = false; 6746 FLAG_concurrent_sweeping = false;
6718 CcTest::InitializeVM(); 6747 CcTest::InitializeVM();
6719 v8::HandleScope scope(CcTest::isolate()); 6748 v8::HandleScope scope(CcTest::isolate());
6720 Heap* heap = CcTest::heap(); 6749 Heap* heap = CcTest::heap();
6721 // Get the heap in clean state. 6750 // Get the heap in clean state.
6722 CcTest::CollectGarbage(OLD_SPACE); 6751 CcTest::CollectGarbage(OLD_SPACE);
6723 CcTest::CollectGarbage(OLD_SPACE); 6752 CcTest::CollectGarbage(OLD_SPACE);
6724 Isolate* isolate = CcTest::i_isolate(); 6753 Isolate* isolate = CcTest::i_isolate();
(...skipping 25 matching lines...) Expand all
6750 } 6779 }
6751 6780
6752 { 6781 {
6753 StaticOneByteResource external_string("12345678901234"); 6782 StaticOneByteResource external_string("12345678901234");
6754 s3->MakeExternal(&external_string); 6783 s3->MakeExternal(&external_string);
6755 CcTest::CollectGarbage(OLD_SPACE); 6784 CcTest::CollectGarbage(OLD_SPACE);
6756 } 6785 }
6757 } 6786 }
6758 6787
6759 TEST(LeftTrimFixedArrayInBlackArea) { 6788 TEST(LeftTrimFixedArrayInBlackArea) {
6789 if (!i::FLAG_incremental_marking) return;
6760 FLAG_black_allocation = true; 6790 FLAG_black_allocation = true;
6761 CcTest::InitializeVM(); 6791 CcTest::InitializeVM();
6762 v8::HandleScope scope(CcTest::isolate()); 6792 v8::HandleScope scope(CcTest::isolate());
6763 Heap* heap = CcTest::heap(); 6793 Heap* heap = CcTest::heap();
6764 Isolate* isolate = heap->isolate(); 6794 Isolate* isolate = heap->isolate();
6765 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 6795 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
6766 6796
6767 i::MarkCompactCollector* collector = heap->mark_compact_collector(); 6797 i::MarkCompactCollector* collector = heap->mark_compact_collector();
6768 i::IncrementalMarking* marking = heap->incremental_marking(); 6798 i::IncrementalMarking* marking = heap->incremental_marking();
6769 if (collector->sweeping_in_progress()) { 6799 if (collector->sweeping_in_progress()) {
(...skipping 18 matching lines...) Expand all
6788 // Now left trim the allocated black area. A filler has to be installed 6818 // Now left trim the allocated black area. A filler has to be installed
6789 // for the trimmed area and all mark bits of the trimmed area have to be 6819 // for the trimmed area and all mark bits of the trimmed area have to be
6790 // cleared. 6820 // cleared.
6791 FixedArrayBase* trimmed = heap->LeftTrimFixedArray(*array, 10); 6821 FixedArrayBase* trimmed = heap->LeftTrimFixedArray(*array, 10);
6792 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed))); 6822 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed)));
6793 6823
6794 heap::GcAndSweep(heap, OLD_SPACE); 6824 heap::GcAndSweep(heap, OLD_SPACE);
6795 } 6825 }
6796 6826
6797 TEST(ContinuousLeftTrimFixedArrayInBlackArea) { 6827 TEST(ContinuousLeftTrimFixedArrayInBlackArea) {
6828 if (!i::FLAG_incremental_marking) return;
6798 FLAG_black_allocation = true; 6829 FLAG_black_allocation = true;
6799 CcTest::InitializeVM(); 6830 CcTest::InitializeVM();
6800 v8::HandleScope scope(CcTest::isolate()); 6831 v8::HandleScope scope(CcTest::isolate());
6801 Heap* heap = CcTest::heap(); 6832 Heap* heap = CcTest::heap();
6802 Isolate* isolate = heap->isolate(); 6833 Isolate* isolate = heap->isolate();
6803 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 6834 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
6804 6835
6805 i::MarkCompactCollector* collector = heap->mark_compact_collector(); 6836 i::MarkCompactCollector* collector = heap->mark_compact_collector();
6806 i::IncrementalMarking* marking = heap->incremental_marking(); 6837 i::IncrementalMarking* marking = heap->incremental_marking();
6807 if (collector->sweeping_in_progress()) { 6838 if (collector->sweeping_in_progress()) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
6853 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed))); 6884 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed)));
6854 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); 6885 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous)));
6855 previous = trimmed; 6886 previous = trimmed;
6856 } 6887 }
6857 } 6888 }
6858 6889
6859 heap::GcAndSweep(heap, OLD_SPACE); 6890 heap::GcAndSweep(heap, OLD_SPACE);
6860 } 6891 }
6861 6892
6862 TEST(ContinuousRightTrimFixedArrayInBlackArea) { 6893 TEST(ContinuousRightTrimFixedArrayInBlackArea) {
6894 if (!i::FLAG_incremental_marking) return;
6863 FLAG_black_allocation = true; 6895 FLAG_black_allocation = true;
6864 CcTest::InitializeVM(); 6896 CcTest::InitializeVM();
6865 v8::HandleScope scope(CcTest::isolate()); 6897 v8::HandleScope scope(CcTest::isolate());
6866 Heap* heap = CcTest::heap(); 6898 Heap* heap = CcTest::heap();
6867 Isolate* isolate = heap->isolate(); 6899 Isolate* isolate = heap->isolate();
6868 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 6900 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
6869 6901
6870 i::MarkCompactCollector* collector = heap->mark_compact_collector(); 6902 i::MarkCompactCollector* collector = heap->mark_compact_collector();
6871 i::IncrementalMarking* marking = heap->incremental_marking(); 6903 i::IncrementalMarking* marking = heap->incremental_marking();
6872 if (collector->sweeping_in_progress()) { 6904 if (collector->sweeping_in_progress()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
6911 HeapObject* filler = HeapObject::FromAddress(previous); 6943 HeapObject* filler = HeapObject::FromAddress(previous);
6912 CHECK(filler->IsFiller()); 6944 CHECK(filler->IsFiller());
6913 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); 6945 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous)));
6914 } 6946 }
6915 } 6947 }
6916 6948
6917 heap::GcAndSweep(heap, OLD_SPACE); 6949 heap::GcAndSweep(heap, OLD_SPACE);
6918 } 6950 }
6919 6951
6920 TEST(Regress618958) { 6952 TEST(Regress618958) {
6953 if (!i::FLAG_incremental_marking) return;
6921 CcTest::InitializeVM(); 6954 CcTest::InitializeVM();
6922 v8::HandleScope scope(CcTest::isolate()); 6955 v8::HandleScope scope(CcTest::isolate());
6923 Heap* heap = CcTest::heap(); 6956 Heap* heap = CcTest::heap();
6924 bool isolate_is_locked = true; 6957 bool isolate_is_locked = true;
6925 heap->update_external_memory(100 * MB); 6958 heap->update_external_memory(100 * MB);
6926 int mark_sweep_count_before = heap->ms_count(); 6959 int mark_sweep_count_before = heap->ms_count();
6927 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, 6960 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical,
6928 isolate_is_locked); 6961 isolate_is_locked);
6929 int mark_sweep_count_after = heap->ms_count(); 6962 int mark_sweep_count_after = heap->ms_count();
6930 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; 6963 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
7020 SlotSet::FREE_EMPTY_BUCKETS); 7053 SlotSet::FREE_EMPTY_BUCKETS);
7021 slots[chunk->area_end() - kPointerSize] = false; 7054 slots[chunk->area_end() - kPointerSize] = false;
7022 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { 7055 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
7023 CHECK(slots[addr]); 7056 CHECK(slots[addr]);
7024 return KEEP_SLOT; 7057 return KEEP_SLOT;
7025 }); 7058 });
7026 } 7059 }
7027 7060
7028 } // namespace internal 7061 } // namespace internal
7029 } // namespace v8 7062 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/heap/test-array-buffer-tracker.cc ('k') | test/cctest/heap/test-page-promotion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698