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 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 return count - 1; | 1645 return count - 1; |
1646 } | 1646 } |
1647 | 1647 |
1648 | 1648 |
1649 // Count the number of user functions in the weak list of optimized | 1649 // Count the number of user functions in the weak list of optimized |
1650 // functions attached to a native context. | 1650 // functions attached to a native context. |
1651 static int CountOptimizedUserFunctions(v8::Handle<v8::Context> context) { | 1651 static int CountOptimizedUserFunctions(v8::Handle<v8::Context> context) { |
1652 int count = 0; | 1652 int count = 0; |
1653 Handle<Context> icontext = v8::Utils::OpenHandle(*context); | 1653 Handle<Context> icontext = v8::Utils::OpenHandle(*context); |
1654 Object* object = icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST); | 1654 Object* object = icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST); |
1655 while (object->IsJSFunction() && !JSFunction::cast(object)->IsBuiltin()) { | 1655 while (object->IsJSFunction() && |
| 1656 !JSFunction::cast(object)->shared()->IsBuiltin()) { |
1656 count++; | 1657 count++; |
1657 object = JSFunction::cast(object)->next_function_link(); | 1658 object = JSFunction::cast(object)->next_function_link(); |
1658 } | 1659 } |
1659 return count; | 1660 return count; |
1660 } | 1661 } |
1661 | 1662 |
1662 | 1663 |
1663 TEST(TestInternalWeakLists) { | 1664 TEST(TestInternalWeakLists) { |
1664 FLAG_always_opt = false; | 1665 FLAG_always_opt = false; |
1665 FLAG_allow_natives_syntax = true; | 1666 FLAG_allow_natives_syntax = true; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 // functions attached to a native context causing a GC after the | 1790 // functions attached to a native context causing a GC after the |
1790 // specified number of elements. | 1791 // specified number of elements. |
1791 static int CountOptimizedUserFunctionsWithGC(v8::Handle<v8::Context> context, | 1792 static int CountOptimizedUserFunctionsWithGC(v8::Handle<v8::Context> context, |
1792 int n) { | 1793 int n) { |
1793 int count = 0; | 1794 int count = 0; |
1794 Handle<Context> icontext = v8::Utils::OpenHandle(*context); | 1795 Handle<Context> icontext = v8::Utils::OpenHandle(*context); |
1795 Isolate* isolate = icontext->GetIsolate(); | 1796 Isolate* isolate = icontext->GetIsolate(); |
1796 Handle<Object> object(icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST), | 1797 Handle<Object> object(icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST), |
1797 isolate); | 1798 isolate); |
1798 while (object->IsJSFunction() && | 1799 while (object->IsJSFunction() && |
1799 !Handle<JSFunction>::cast(object)->IsBuiltin()) { | 1800 !Handle<JSFunction>::cast(object)->shared()->IsBuiltin()) { |
1800 count++; | 1801 count++; |
1801 if (count == n) isolate->heap()->CollectAllGarbage(); | 1802 if (count == n) isolate->heap()->CollectAllGarbage(); |
1802 object = Handle<Object>( | 1803 object = Handle<Object>( |
1803 Object::cast(JSFunction::cast(*object)->next_function_link()), | 1804 Object::cast(JSFunction::cast(*object)->next_function_link()), |
1804 isolate); | 1805 isolate); |
1805 } | 1806 } |
1806 return count; | 1807 return count; |
1807 } | 1808 } |
1808 | 1809 |
1809 | 1810 |
(...skipping 4473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6283 isolate->IncrementJsCallsFromApiCounter(); | 6284 isolate->IncrementJsCallsFromApiCounter(); |
6284 isolate->IncrementJsCallsFromApiCounter(); | 6285 isolate->IncrementJsCallsFromApiCounter(); |
6285 isolate->IncrementJsCallsFromApiCounter(); | 6286 isolate->IncrementJsCallsFromApiCounter(); |
6286 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6287 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
6287 CheckDoubleEquals(2, calls_per_ms); | 6288 CheckDoubleEquals(2, calls_per_ms); |
6288 } | 6289 } |
6289 | 6290 |
6290 | 6291 |
6291 } // namespace internal | 6292 } // namespace internal |
6292 } // namespace v8 | 6293 } // namespace v8 |
OLD | NEW |