| 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 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 CompileRun(source.start()); | 1685 CompileRun(source.start()); |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 | 1688 |
| 1689 // Count the number of native contexts in the weak list of native contexts. | 1689 // Count the number of native contexts in the weak list of native contexts. |
| 1690 int CountNativeContexts() { | 1690 int CountNativeContexts() { |
| 1691 int count = 0; | 1691 int count = 0; |
| 1692 Object* object = CcTest::heap()->native_contexts_list(); | 1692 Object* object = CcTest::heap()->native_contexts_list(); |
| 1693 while (!object->IsUndefined()) { | 1693 while (!object->IsUndefined()) { |
| 1694 count++; | 1694 count++; |
| 1695 object = Context::cast(object)->get(Context::NEXT_CONTEXT_LINK); | 1695 object = Context::cast(object)->next_context_link(); |
| 1696 } | 1696 } |
| 1697 return count; | 1697 return count; |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 | 1700 |
| 1701 // Count the number of user functions in the weak list of optimized | 1701 // Count the number of user functions in the weak list of optimized |
| 1702 // functions attached to a native context. | 1702 // functions attached to a native context. |
| 1703 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { | 1703 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { |
| 1704 int count = 0; | 1704 int count = 0; |
| 1705 Handle<Context> icontext = v8::Utils::OpenHandle(*context); | 1705 Handle<Context> icontext = v8::Utils::OpenHandle(*context); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 // Count the number of native contexts in the weak list of native contexts | 1823 // Count the number of native contexts in the weak list of native contexts |
| 1824 // causing a GC after the specified number of elements. | 1824 // causing a GC after the specified number of elements. |
| 1825 static int CountNativeContextsWithGC(Isolate* isolate, int n) { | 1825 static int CountNativeContextsWithGC(Isolate* isolate, int n) { |
| 1826 Heap* heap = isolate->heap(); | 1826 Heap* heap = isolate->heap(); |
| 1827 int count = 0; | 1827 int count = 0; |
| 1828 Handle<Object> object(heap->native_contexts_list(), isolate); | 1828 Handle<Object> object(heap->native_contexts_list(), isolate); |
| 1829 while (!object->IsUndefined()) { | 1829 while (!object->IsUndefined()) { |
| 1830 count++; | 1830 count++; |
| 1831 if (count == n) heap->CollectAllGarbage(); | 1831 if (count == n) heap->CollectAllGarbage(); |
| 1832 object = | 1832 object = |
| 1833 Handle<Object>(Context::cast(*object)->get(Context::NEXT_CONTEXT_LINK), | 1833 Handle<Object>(Context::cast(*object)->next_context_link(), isolate); |
| 1834 isolate); | |
| 1835 } | 1834 } |
| 1836 return count; | 1835 return count; |
| 1837 } | 1836 } |
| 1838 | 1837 |
| 1839 | 1838 |
| 1840 // Count the number of user functions in the weak list of optimized | 1839 // Count the number of user functions in the weak list of optimized |
| 1841 // functions attached to a native context causing a GC after the | 1840 // functions attached to a native context causing a GC after the |
| 1842 // specified number of elements. | 1841 // specified number of elements. |
| 1843 static int CountOptimizedUserFunctionsWithGC(v8::Local<v8::Context> context, | 1842 static int CountOptimizedUserFunctionsWithGC(v8::Local<v8::Context> context, |
| 1844 int n) { | 1843 int n) { |
| (...skipping 4762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6607 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); | 6606 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); |
| 6608 } | 6607 } |
| 6609 } | 6608 } |
| 6610 // Force allocation from the free list. | 6609 // Force allocation from the free list. |
| 6611 heap->set_force_oom(true); | 6610 heap->set_force_oom(true); |
| 6612 heap->CollectGarbage(OLD_SPACE); | 6611 heap->CollectGarbage(OLD_SPACE); |
| 6613 } | 6612 } |
| 6614 | 6613 |
| 6615 } // namespace internal | 6614 } // namespace internal |
| 6616 } // namespace v8 | 6615 } // namespace v8 |
| OLD | NEW |