| 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 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 "function foo () { }" | 2577 "function foo () { }" |
| 2578 "function mkbar () { return new (new Function(\"\")) (); }" | 2578 "function mkbar () { return new (new Function(\"\")) (); }" |
| 2579 "function f (x) { return (x instanceof foo); }" | 2579 "function f (x) { return (x instanceof foo); }" |
| 2580 "function g () { f(mkbar()); }" | 2580 "function g () { f(mkbar()); }" |
| 2581 "f(new foo()); f(new foo());" | 2581 "f(new foo()); f(new foo());" |
| 2582 "%OptimizeFunctionOnNextCall(f);" | 2582 "%OptimizeFunctionOnNextCall(f);" |
| 2583 "f(new foo()); g();"); | 2583 "f(new foo()); g();"); |
| 2584 } | 2584 } |
| 2585 | 2585 |
| 2586 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 2586 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
| 2587 marking->Abort(); | 2587 marking->Stop(); |
| 2588 marking->Start(Heap::kNoGCFlags); | 2588 marking->Start(Heap::kNoGCFlags); |
| 2589 | 2589 |
| 2590 Handle<JSFunction> f = | 2590 Handle<JSFunction> f = |
| 2591 v8::Utils::OpenHandle( | 2591 v8::Utils::OpenHandle( |
| 2592 *v8::Handle<v8::Function>::Cast( | 2592 *v8::Handle<v8::Function>::Cast( |
| 2593 CcTest::global()->Get(v8_str("f")))); | 2593 CcTest::global()->Get(v8_str("f")))); |
| 2594 | 2594 |
| 2595 CHECK(f->IsOptimized()); | 2595 CHECK(f->IsOptimized()); |
| 2596 | 2596 |
| 2597 while (!Marking::IsBlack(Marking::MarkBitFrom(f->code())) && | 2597 while (!Marking::IsBlack(Marking::MarkBitFrom(f->code())) && |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 "%OptimizeFunctionOnNextCall(f);" | 2705 "%OptimizeFunctionOnNextCall(f);" |
| 2706 "f();"); | 2706 "f();"); |
| 2707 } | 2707 } |
| 2708 Handle<JSFunction> f = | 2708 Handle<JSFunction> f = |
| 2709 v8::Utils::OpenHandle( | 2709 v8::Utils::OpenHandle( |
| 2710 *v8::Handle<v8::Function>::Cast( | 2710 *v8::Handle<v8::Function>::Cast( |
| 2711 CcTest::global()->Get(v8_str("f")))); | 2711 CcTest::global()->Get(v8_str("f")))); |
| 2712 CHECK(f->IsOptimized()); | 2712 CHECK(f->IsOptimized()); |
| 2713 | 2713 |
| 2714 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 2714 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
| 2715 marking->Abort(); | 2715 marking->Stop(); |
| 2716 marking->Start(Heap::kNoGCFlags); | 2716 marking->Start(Heap::kNoGCFlags); |
| 2717 // The following calls will increment CcTest::heap()->global_ic_age(). | 2717 // The following calls will increment CcTest::heap()->global_ic_age(). |
| 2718 CcTest::isolate()->ContextDisposedNotification(); | 2718 CcTest::isolate()->ContextDisposedNotification(); |
| 2719 SimulateIncrementalMarking(CcTest::heap()); | 2719 SimulateIncrementalMarking(CcTest::heap()); |
| 2720 CcTest::heap()->CollectAllGarbage(); | 2720 CcTest::heap()->CollectAllGarbage(); |
| 2721 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); | 2721 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); |
| 2722 CHECK_EQ(0, f->shared()->opt_count()); | 2722 CHECK_EQ(0, f->shared()->opt_count()); |
| 2723 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2723 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
| 2724 } | 2724 } |
| 2725 | 2725 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2746 "f(); f();" | 2746 "f(); f();" |
| 2747 "%OptimizeFunctionOnNextCall(f);" | 2747 "%OptimizeFunctionOnNextCall(f);" |
| 2748 "f();"); | 2748 "f();"); |
| 2749 } | 2749 } |
| 2750 Handle<JSFunction> f = | 2750 Handle<JSFunction> f = |
| 2751 v8::Utils::OpenHandle( | 2751 v8::Utils::OpenHandle( |
| 2752 *v8::Handle<v8::Function>::Cast( | 2752 *v8::Handle<v8::Function>::Cast( |
| 2753 CcTest::global()->Get(v8_str("f")))); | 2753 CcTest::global()->Get(v8_str("f")))); |
| 2754 CHECK(f->IsOptimized()); | 2754 CHECK(f->IsOptimized()); |
| 2755 | 2755 |
| 2756 CcTest::heap()->incremental_marking()->Abort(); | 2756 CcTest::heap()->incremental_marking()->Stop(); |
| 2757 | 2757 |
| 2758 // The following two calls will increment CcTest::heap()->global_ic_age(). | 2758 // The following two calls will increment CcTest::heap()->global_ic_age(). |
| 2759 CcTest::isolate()->ContextDisposedNotification(); | 2759 CcTest::isolate()->ContextDisposedNotification(); |
| 2760 CcTest::heap()->CollectAllGarbage(); | 2760 CcTest::heap()->CollectAllGarbage(); |
| 2761 | 2761 |
| 2762 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); | 2762 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); |
| 2763 CHECK_EQ(0, f->shared()->opt_count()); | 2763 CHECK_EQ(0, f->shared()->opt_count()); |
| 2764 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2764 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
| 2765 } | 2765 } |
| 2766 | 2766 |
| 2767 | 2767 |
| 2768 TEST(IdleNotificationFinishMarking) { | 2768 TEST(IdleNotificationFinishMarking) { |
| 2769 i::FLAG_allow_natives_syntax = true; | 2769 i::FLAG_allow_natives_syntax = true; |
| 2770 CcTest::InitializeVM(); | 2770 CcTest::InitializeVM(); |
| 2771 SimulateFullSpace(CcTest::heap()->old_space()); | 2771 SimulateFullSpace(CcTest::heap()->old_space()); |
| 2772 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 2772 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
| 2773 marking->Abort(); | 2773 marking->Stop(); |
| 2774 marking->Start(Heap::kNoGCFlags); | 2774 marking->Start(Heap::kNoGCFlags); |
| 2775 | 2775 |
| 2776 CHECK_EQ(CcTest::heap()->gc_count(), 0); | 2776 CHECK_EQ(CcTest::heap()->gc_count(), 0); |
| 2777 | 2777 |
| 2778 // TODO(hpayer): We cannot write proper unit test right now for heap. | 2778 // TODO(hpayer): We cannot write proper unit test right now for heap. |
| 2779 // The ideal test would call kMaxIdleMarkingDelayCounter to test the | 2779 // The ideal test would call kMaxIdleMarkingDelayCounter to test the |
| 2780 // marking delay counter. | 2780 // marking delay counter. |
| 2781 | 2781 |
| 2782 // Perform a huge incremental marking step but don't complete marking. | 2782 // Perform a huge incremental marking step but don't complete marking. |
| 2783 intptr_t bytes_processed = 0; | 2783 intptr_t bytes_processed = 0; |
| (...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5694 | 5694 |
| 5695 // Ensure that the object allocated where we need it. | 5695 // Ensure that the object allocated where we need it. |
| 5696 Page* page = Page::FromAddress(o->address()); | 5696 Page* page = Page::FromAddress(o->address()); |
| 5697 CHECK_EQ(desired_offset, page->Offset(o->address())); | 5697 CHECK_EQ(desired_offset, page->Offset(o->address())); |
| 5698 | 5698 |
| 5699 // Now we have an object right at the end of the page. | 5699 // Now we have an object right at the end of the page. |
| 5700 | 5700 |
| 5701 // Enable incremental marking to trigger actions in Heap::AdjustLiveBytes() | 5701 // Enable incremental marking to trigger actions in Heap::AdjustLiveBytes() |
| 5702 // that would cause crash. | 5702 // that would cause crash. |
| 5703 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 5703 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
| 5704 marking->Abort(); | 5704 marking->Stop(); |
| 5705 marking->Start(Heap::kNoGCFlags); | 5705 marking->Start(Heap::kNoGCFlags); |
| 5706 CHECK(marking->IsMarking()); | 5706 CHECK(marking->IsMarking()); |
| 5707 | 5707 |
| 5708 // Now everything is set up for crashing in JSObject::MigrateFastToFast() | 5708 // Now everything is set up for crashing in JSObject::MigrateFastToFast() |
| 5709 // when it calls heap->AdjustLiveBytes(...). | 5709 // when it calls heap->AdjustLiveBytes(...). |
| 5710 JSObject::MigrateToMap(o, map2); | 5710 JSObject::MigrateToMap(o, map2); |
| 5711 } | 5711 } |
| 5712 | 5712 |
| 5713 | 5713 |
| 5714 TEST(Regress3631) { | 5714 TEST(Regress3631) { |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6377 | 6377 |
| 6378 PrintF("Context size : %d bytes\n", measure.Size()); | 6378 PrintF("Context size : %d bytes\n", measure.Size()); |
| 6379 PrintF("Context object count: %d\n", measure.Count()); | 6379 PrintF("Context object count: %d\n", measure.Count()); |
| 6380 | 6380 |
| 6381 CHECK_LE(1000, measure.Count()); | 6381 CHECK_LE(1000, measure.Count()); |
| 6382 CHECK_LE(50000, measure.Size()); | 6382 CHECK_LE(50000, measure.Size()); |
| 6383 | 6383 |
| 6384 CHECK_LE(measure.Count(), count_upper_limit); | 6384 CHECK_LE(measure.Count(), count_upper_limit); |
| 6385 CHECK_LE(measure.Size(), size_upper_limit); | 6385 CHECK_LE(measure.Size(), size_upper_limit); |
| 6386 } | 6386 } |
| OLD | NEW |