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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 v8::Local<v8::Object> global = CcTest::global(); | 2651 v8::Local<v8::Object> global = CcTest::global(); |
2652 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( | 2652 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( |
2653 global->Get(ctx, v8_str("g")).ToLocalChecked()); | 2653 global->Get(ctx, v8_str("g")).ToLocalChecked()); |
2654 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); | 2654 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); |
2655 } | 2655 } |
2656 | 2656 |
2657 CcTest::heap()->incremental_marking()->set_should_hurry(true); | 2657 CcTest::heap()->incremental_marking()->set_should_hurry(true); |
2658 CcTest::heap()->CollectGarbage(OLD_SPACE); | 2658 CcTest::heap()->CollectGarbage(OLD_SPACE); |
2659 } | 2659 } |
2660 | 2660 |
| 2661 namespace { |
| 2662 |
| 2663 int GetProfilerTicks(SharedFunctionInfo* shared) { |
| 2664 return FLAG_ignition ? shared->profiler_ticks() |
| 2665 : shared->code()->profiler_ticks(); |
| 2666 } |
| 2667 |
| 2668 } // namespace |
2661 | 2669 |
2662 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { | 2670 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { |
2663 i::FLAG_stress_compaction = false; | 2671 i::FLAG_stress_compaction = false; |
2664 i::FLAG_allow_natives_syntax = true; | 2672 i::FLAG_allow_natives_syntax = true; |
2665 #ifdef VERIFY_HEAP | 2673 #ifdef VERIFY_HEAP |
2666 i::FLAG_verify_heap = true; | 2674 i::FLAG_verify_heap = true; |
2667 #endif | 2675 #endif |
2668 | 2676 |
2669 CcTest::InitializeVM(); | 2677 CcTest::InitializeVM(); |
2670 if (!CcTest::i_isolate()->use_crankshaft()) return; | 2678 if (!CcTest::i_isolate()->use_crankshaft()) return; |
(...skipping 10 matching lines...) Expand all Loading... |
2681 "}" | 2689 "}" |
2682 "f(); f();" | 2690 "f(); f();" |
2683 "%OptimizeFunctionOnNextCall(f);" | 2691 "%OptimizeFunctionOnNextCall(f);" |
2684 "f();"); | 2692 "f();"); |
2685 } | 2693 } |
2686 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( | 2694 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( |
2687 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 2695 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
2688 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); | 2696 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); |
2689 CHECK(f->IsOptimized()); | 2697 CHECK(f->IsOptimized()); |
2690 | 2698 |
2691 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 2699 // Make sure incremental marking it not running. |
2692 marking->Stop(); | 2700 CcTest::heap()->incremental_marking()->Stop(); |
| 2701 |
2693 CcTest::heap()->StartIncrementalMarking(); | 2702 CcTest::heap()->StartIncrementalMarking(); |
2694 // The following calls will increment CcTest::heap()->global_ic_age(). | 2703 // The following calls will increment CcTest::heap()->global_ic_age(). |
2695 CcTest::isolate()->ContextDisposedNotification(); | 2704 CcTest::isolate()->ContextDisposedNotification(); |
2696 SimulateIncrementalMarking(CcTest::heap()); | 2705 SimulateIncrementalMarking(CcTest::heap()); |
2697 CcTest::heap()->CollectAllGarbage(); | 2706 CcTest::heap()->CollectAllGarbage(); |
| 2707 |
2698 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); | 2708 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); |
2699 CHECK_EQ(0, f->shared()->opt_count()); | 2709 CHECK_EQ(0, f->shared()->opt_count()); |
2700 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2710 CHECK_EQ(0, GetProfilerTicks(f->shared())); |
2701 } | 2711 } |
2702 | 2712 |
2703 | 2713 |
2704 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { | 2714 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { |
2705 i::FLAG_stress_compaction = false; | 2715 i::FLAG_stress_compaction = false; |
2706 i::FLAG_allow_natives_syntax = true; | 2716 i::FLAG_allow_natives_syntax = true; |
2707 #ifdef VERIFY_HEAP | 2717 #ifdef VERIFY_HEAP |
2708 i::FLAG_verify_heap = true; | 2718 i::FLAG_verify_heap = true; |
2709 #endif | 2719 #endif |
2710 | 2720 |
(...skipping 10 matching lines...) Expand all Loading... |
2721 " for (var i = 0; i < 100; i++) s += i;" | 2731 " for (var i = 0; i < 100; i++) s += i;" |
2722 " return s;" | 2732 " return s;" |
2723 "}" | 2733 "}" |
2724 "f(); f();" | 2734 "f(); f();" |
2725 "%OptimizeFunctionOnNextCall(f);" | 2735 "%OptimizeFunctionOnNextCall(f);" |
2726 "f();"); | 2736 "f();"); |
2727 } | 2737 } |
2728 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( | 2738 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( |
2729 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 2739 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
2730 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); | 2740 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); |
2731 | |
2732 CHECK(f->IsOptimized()); | 2741 CHECK(f->IsOptimized()); |
2733 | 2742 |
| 2743 // Make sure incremental marking it not running. |
2734 CcTest::heap()->incremental_marking()->Stop(); | 2744 CcTest::heap()->incremental_marking()->Stop(); |
2735 | 2745 |
2736 // The following two calls will increment CcTest::heap()->global_ic_age(). | 2746 // The following two calls will increment CcTest::heap()->global_ic_age(). |
2737 CcTest::isolate()->ContextDisposedNotification(); | 2747 CcTest::isolate()->ContextDisposedNotification(); |
2738 CcTest::heap()->CollectAllGarbage(); | 2748 CcTest::heap()->CollectAllGarbage(); |
2739 | 2749 |
2740 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); | 2750 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); |
2741 CHECK_EQ(0, f->shared()->opt_count()); | 2751 CHECK_EQ(0, f->shared()->opt_count()); |
2742 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2752 CHECK_EQ(0, GetProfilerTicks(f->shared())); |
2743 } | 2753 } |
2744 | 2754 |
2745 | 2755 |
2746 HEAP_TEST(GCFlags) { | 2756 HEAP_TEST(GCFlags) { |
2747 CcTest::InitializeVM(); | 2757 CcTest::InitializeVM(); |
2748 Heap* heap = CcTest::heap(); | 2758 Heap* heap = CcTest::heap(); |
2749 | 2759 |
2750 heap->set_current_gc_flags(Heap::kNoGCFlags); | 2760 heap->set_current_gc_flags(Heap::kNoGCFlags); |
2751 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); | 2761 CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); |
2752 | 2762 |
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6602 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); | 6612 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); |
6603 } | 6613 } |
6604 } | 6614 } |
6605 // Force allocation from the free list. | 6615 // Force allocation from the free list. |
6606 heap->set_force_oom(true); | 6616 heap->set_force_oom(true); |
6607 heap->CollectGarbage(OLD_SPACE); | 6617 heap->CollectGarbage(OLD_SPACE); |
6608 } | 6618 } |
6609 | 6619 |
6610 } // namespace internal | 6620 } // namespace internal |
6611 } // namespace v8 | 6621 } // namespace v8 |
OLD | NEW |