| 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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1396 |
| 1397 // This compile will compile the function again. | 1397 // This compile will compile the function again. |
| 1398 { v8::HandleScope scope(CcTest::isolate()); | 1398 { v8::HandleScope scope(CcTest::isolate()); |
| 1399 CompileRun("foo();"); | 1399 CompileRun("foo();"); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 // Simulate several GCs that use incremental marking but make sure | 1402 // Simulate several GCs that use incremental marking but make sure |
| 1403 // the loop breaks once the function is enqueued as a candidate. | 1403 // the loop breaks once the function is enqueued as a candidate. |
| 1404 for (int i = 0; i < kAgingThreshold; i++) { | 1404 for (int i = 0; i < kAgingThreshold; i++) { |
| 1405 heap::SimulateIncrementalMarking(CcTest::heap()); | 1405 heap::SimulateIncrementalMarking(CcTest::heap()); |
| 1406 if (!function->next_function_link()->IsUndefined()) break; | 1406 if (!function->next_function_link()->IsUndefined(CcTest::i_isolate())) |
| 1407 break; |
| 1407 CcTest::heap()->CollectAllGarbage(); | 1408 CcTest::heap()->CollectAllGarbage(); |
| 1408 } | 1409 } |
| 1409 | 1410 |
| 1410 // Force optimization while incremental marking is active and while | 1411 // Force optimization while incremental marking is active and while |
| 1411 // the function is enqueued as a candidate. | 1412 // the function is enqueued as a candidate. |
| 1412 { v8::HandleScope scope(CcTest::isolate()); | 1413 { v8::HandleScope scope(CcTest::isolate()); |
| 1413 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); | 1414 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); |
| 1414 } | 1415 } |
| 1415 | 1416 |
| 1416 // Simulate one final GC to make sure the candidate queue is sane. | 1417 // Simulate one final GC to make sure the candidate queue is sane. |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 "%s();", | 1676 "%s();", |
| 1676 name, name, name, name, name); | 1677 name, name, name, name, name); |
| 1677 CompileRun(source.start()); | 1678 CompileRun(source.start()); |
| 1678 } | 1679 } |
| 1679 | 1680 |
| 1680 | 1681 |
| 1681 // Count the number of native contexts in the weak list of native contexts. | 1682 // Count the number of native contexts in the weak list of native contexts. |
| 1682 int CountNativeContexts() { | 1683 int CountNativeContexts() { |
| 1683 int count = 0; | 1684 int count = 0; |
| 1684 Object* object = CcTest::heap()->native_contexts_list(); | 1685 Object* object = CcTest::heap()->native_contexts_list(); |
| 1685 while (!object->IsUndefined()) { | 1686 while (!object->IsUndefined(CcTest::i_isolate())) { |
| 1686 count++; | 1687 count++; |
| 1687 object = Context::cast(object)->next_context_link(); | 1688 object = Context::cast(object)->next_context_link(); |
| 1688 } | 1689 } |
| 1689 return count; | 1690 return count; |
| 1690 } | 1691 } |
| 1691 | 1692 |
| 1692 | 1693 |
| 1693 // Count the number of user functions in the weak list of optimized | 1694 // Count the number of user functions in the weak list of optimized |
| 1694 // functions attached to a native context. | 1695 // functions attached to a native context. |
| 1695 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { | 1696 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 CHECK_EQ(0, CountNativeContexts()); | 1812 CHECK_EQ(0, CountNativeContexts()); |
| 1812 } | 1813 } |
| 1813 | 1814 |
| 1814 | 1815 |
| 1815 // Count the number of native contexts in the weak list of native contexts | 1816 // Count the number of native contexts in the weak list of native contexts |
| 1816 // causing a GC after the specified number of elements. | 1817 // causing a GC after the specified number of elements. |
| 1817 static int CountNativeContextsWithGC(Isolate* isolate, int n) { | 1818 static int CountNativeContextsWithGC(Isolate* isolate, int n) { |
| 1818 Heap* heap = isolate->heap(); | 1819 Heap* heap = isolate->heap(); |
| 1819 int count = 0; | 1820 int count = 0; |
| 1820 Handle<Object> object(heap->native_contexts_list(), isolate); | 1821 Handle<Object> object(heap->native_contexts_list(), isolate); |
| 1821 while (!object->IsUndefined()) { | 1822 while (!object->IsUndefined(isolate)) { |
| 1822 count++; | 1823 count++; |
| 1823 if (count == n) heap->CollectAllGarbage(); | 1824 if (count == n) heap->CollectAllGarbage(); |
| 1824 object = | 1825 object = |
| 1825 Handle<Object>(Context::cast(*object)->next_context_link(), isolate); | 1826 Handle<Object>(Context::cast(*object)->next_context_link(), isolate); |
| 1826 } | 1827 } |
| 1827 return count; | 1828 return count; |
| 1828 } | 1829 } |
| 1829 | 1830 |
| 1830 | 1831 |
| 1831 // Count the number of user functions in the weak list of optimized | 1832 // Count the number of user functions in the weak list of optimized |
| (...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4656 | 4657 |
| 4657 // Run test with inline allocation re-enabled. | 4658 // Run test with inline allocation re-enabled. |
| 4658 CcTest::heap()->EnableInlineAllocation(); | 4659 CcTest::heap()->EnableInlineAllocation(); |
| 4659 CompileRun("run()"); | 4660 CompileRun("run()"); |
| 4660 } | 4661 } |
| 4661 | 4662 |
| 4662 | 4663 |
| 4663 static int AllocationSitesCount(Heap* heap) { | 4664 static int AllocationSitesCount(Heap* heap) { |
| 4664 int count = 0; | 4665 int count = 0; |
| 4665 for (Object* site = heap->allocation_sites_list(); | 4666 for (Object* site = heap->allocation_sites_list(); |
| 4666 !(site->IsUndefined()); | 4667 !(site->IsUndefined(heap->isolate())); |
| 4667 site = AllocationSite::cast(site)->weak_next()) { | 4668 site = AllocationSite::cast(site)->weak_next()) { |
| 4668 count++; | 4669 count++; |
| 4669 } | 4670 } |
| 4670 return count; | 4671 return count; |
| 4671 } | 4672 } |
| 4672 | 4673 |
| 4673 | 4674 |
| 4674 TEST(EnsureAllocationSiteDependentCodesProcessed) { | 4675 TEST(EnsureAllocationSiteDependentCodesProcessed) { |
| 4675 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; | 4676 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; |
| 4676 i::FLAG_allow_natives_syntax = true; | 4677 i::FLAG_allow_natives_syntax = true; |
| (...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6774 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; | 6775 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; |
| 6775 // The memory pressuer handler either performed two GCs or performed one and | 6776 // The memory pressuer handler either performed two GCs or performed one and |
| 6776 // started incremental marking. | 6777 // started incremental marking. |
| 6777 CHECK(mark_sweeps_performed == 2 || | 6778 CHECK(mark_sweeps_performed == 2 || |
| 6778 (mark_sweeps_performed == 1 && | 6779 (mark_sweeps_performed == 1 && |
| 6779 !heap->incremental_marking()->IsStopped())); | 6780 !heap->incremental_marking()->IsStopped())); |
| 6780 } | 6781 } |
| 6781 | 6782 |
| 6782 } // namespace internal | 6783 } // namespace internal |
| 6783 } // namespace v8 | 6784 } // namespace v8 |
| OLD | NEW |