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 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 } | 1705 } |
1706 | 1706 |
1707 | 1707 |
1708 // Count the number of user functions in the weak list of optimized | 1708 // Count the number of user functions in the weak list of optimized |
1709 // functions attached to a native context. | 1709 // functions attached to a native context. |
1710 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { | 1710 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { |
1711 int count = 0; | 1711 int count = 0; |
1712 Handle<Context> icontext = v8::Utils::OpenHandle(*context); | 1712 Handle<Context> icontext = v8::Utils::OpenHandle(*context); |
1713 Object* object = icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST); | 1713 Object* object = icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST); |
1714 while (object->IsJSFunction() && | 1714 while (object->IsJSFunction() && |
1715 JSFunction::cast(object)->shared()->IsUserJavaScript()) { | 1715 !JSFunction::cast(object)->shared()->IsBuiltin()) { |
1716 count++; | 1716 count++; |
1717 object = JSFunction::cast(object)->next_function_link(); | 1717 object = JSFunction::cast(object)->next_function_link(); |
1718 } | 1718 } |
1719 return count; | 1719 return count; |
1720 } | 1720 } |
1721 | 1721 |
1722 | 1722 |
1723 TEST(TestInternalWeakLists) { | 1723 TEST(TestInternalWeakLists) { |
1724 FLAG_always_opt = false; | 1724 FLAG_always_opt = false; |
1725 FLAG_allow_natives_syntax = true; | 1725 FLAG_allow_natives_syntax = true; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 // functions attached to a native context causing a GC after the | 1847 // functions attached to a native context causing a GC after the |
1848 // specified number of elements. | 1848 // specified number of elements. |
1849 static int CountOptimizedUserFunctionsWithGC(v8::Local<v8::Context> context, | 1849 static int CountOptimizedUserFunctionsWithGC(v8::Local<v8::Context> context, |
1850 int n) { | 1850 int n) { |
1851 int count = 0; | 1851 int count = 0; |
1852 Handle<Context> icontext = v8::Utils::OpenHandle(*context); | 1852 Handle<Context> icontext = v8::Utils::OpenHandle(*context); |
1853 Isolate* isolate = icontext->GetIsolate(); | 1853 Isolate* isolate = icontext->GetIsolate(); |
1854 Handle<Object> object(icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST), | 1854 Handle<Object> object(icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST), |
1855 isolate); | 1855 isolate); |
1856 while (object->IsJSFunction() && | 1856 while (object->IsJSFunction() && |
1857 Handle<JSFunction>::cast(object)->shared()->IsUserJavaScript()) { | 1857 !Handle<JSFunction>::cast(object)->shared()->IsBuiltin()) { |
1858 count++; | 1858 count++; |
1859 if (count == n) | 1859 if (count == n) |
1860 isolate->heap()->CollectAllGarbage( | 1860 isolate->heap()->CollectAllGarbage( |
1861 i::Heap::kFinalizeIncrementalMarkingMask, | 1861 i::Heap::kFinalizeIncrementalMarkingMask, |
1862 i::GarbageCollectionReason::kTesting); | 1862 i::GarbageCollectionReason::kTesting); |
1863 object = Handle<Object>( | 1863 object = Handle<Object>( |
1864 Object::cast(JSFunction::cast(*object)->next_function_link()), | 1864 Object::cast(JSFunction::cast(*object)->next_function_link()), |
1865 isolate); | 1865 isolate); |
1866 } | 1866 } |
1867 return count; | 1867 return count; |
(...skipping 5152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7020 SlotSet::FREE_EMPTY_BUCKETS); | 7020 SlotSet::FREE_EMPTY_BUCKETS); |
7021 slots[chunk->area_end() - kPointerSize] = false; | 7021 slots[chunk->area_end() - kPointerSize] = false; |
7022 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7022 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7023 CHECK(slots[addr]); | 7023 CHECK(slots[addr]); |
7024 return KEEP_SLOT; | 7024 return KEEP_SLOT; |
7025 }); | 7025 }); |
7026 } | 7026 } |
7027 | 7027 |
7028 } // namespace internal | 7028 } // namespace internal |
7029 } // namespace v8 | 7029 } // namespace v8 |
OLD | NEW |