| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 Handle<SharedFunctionInfo>* sfis_; | 1542 Handle<SharedFunctionInfo>* sfis_; |
| 1543 Handle<Code>* code_objects_; | 1543 Handle<Code>* code_objects_; |
| 1544 int* count_; | 1544 int* count_; |
| 1545 }; | 1545 }; |
| 1546 | 1546 |
| 1547 | 1547 |
| 1548 static int EnumerateCompiledFunctions(Heap* heap, | 1548 static int EnumerateCompiledFunctions(Heap* heap, |
| 1549 Handle<SharedFunctionInfo>* sfis, | 1549 Handle<SharedFunctionInfo>* sfis, |
| 1550 Handle<Code>* code_objects) { | 1550 Handle<Code>* code_objects) { |
| 1551 HeapIterator iterator(heap); | 1551 HeapIterator iterator(heap); |
| 1552 AssertNoAllocation no_alloc; | 1552 DisallowHeapAllocation no_gc; |
| 1553 int compiled_funcs_count = 0; | 1553 int compiled_funcs_count = 0; |
| 1554 | 1554 |
| 1555 // Iterate the heap to find shared function info objects and record | 1555 // Iterate the heap to find shared function info objects and record |
| 1556 // the unoptimized code for them. | 1556 // the unoptimized code for them. |
| 1557 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1557 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1558 if (!obj->IsSharedFunctionInfo()) continue; | 1558 if (!obj->IsSharedFunctionInfo()) continue; |
| 1559 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); | 1559 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); |
| 1560 if (sfi->is_compiled() | 1560 if (sfi->is_compiled() |
| 1561 && (!sfi->script()->IsScript() | 1561 && (!sfi->script()->IsScript() |
| 1562 || Script::cast(sfi->script())->HasValidSource())) { | 1562 || Script::cast(sfi->script())->HasValidSource())) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 ASSERT(static_cast<size_t>(size) == rv); | 1711 ASSERT(static_cast<size_t>(size) == rv); |
| 1712 USE(rv); | 1712 USE(rv); |
| 1713 } | 1713 } |
| 1714 | 1714 |
| 1715 | 1715 |
| 1716 void Logger::LogCodeObjects() { | 1716 void Logger::LogCodeObjects() { |
| 1717 Heap* heap = isolate_->heap(); | 1717 Heap* heap = isolate_->heap(); |
| 1718 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1718 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1719 "Logger::LogCodeObjects"); | 1719 "Logger::LogCodeObjects"); |
| 1720 HeapIterator iterator(heap); | 1720 HeapIterator iterator(heap); |
| 1721 AssertNoAllocation no_alloc; | 1721 DisallowHeapAllocation no_gc; |
| 1722 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1722 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1723 if (obj->IsCode()) LogCodeObject(obj); | 1723 if (obj->IsCode()) LogCodeObject(obj); |
| 1724 } | 1724 } |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 | 1727 |
| 1728 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1728 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| 1729 Handle<Code> code) { | 1729 Handle<Code> code) { |
| 1730 Handle<String> func_name(shared->DebugName()); | 1730 Handle<String> func_name(shared->DebugName()); |
| 1731 if (shared->script()->IsScript()) { | 1731 if (shared->script()->IsScript()) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 LogExistingFunction(sfis[i], code_objects[i]); | 1789 LogExistingFunction(sfis[i], code_objects[i]); |
| 1790 } | 1790 } |
| 1791 } | 1791 } |
| 1792 | 1792 |
| 1793 | 1793 |
| 1794 void Logger::LogAccessorCallbacks() { | 1794 void Logger::LogAccessorCallbacks() { |
| 1795 Heap* heap = isolate_->heap(); | 1795 Heap* heap = isolate_->heap(); |
| 1796 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1796 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1797 "Logger::LogAccessorCallbacks"); | 1797 "Logger::LogAccessorCallbacks"); |
| 1798 HeapIterator iterator(heap); | 1798 HeapIterator iterator(heap); |
| 1799 AssertNoAllocation no_alloc; | 1799 DisallowHeapAllocation no_gc; |
| 1800 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1800 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1801 if (!obj->IsExecutableAccessorInfo()) continue; | 1801 if (!obj->IsExecutableAccessorInfo()) continue; |
| 1802 ExecutableAccessorInfo* ai = ExecutableAccessorInfo::cast(obj); | 1802 ExecutableAccessorInfo* ai = ExecutableAccessorInfo::cast(obj); |
| 1803 if (!ai->name()->IsName()) continue; | 1803 if (!ai->name()->IsName()) continue; |
| 1804 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1804 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
| 1805 Name* name = Name::cast(ai->name()); | 1805 Name* name = Name::cast(ai->name()); |
| 1806 if (getter_entry != 0) { | 1806 if (getter_entry != 0) { |
| 1807 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); | 1807 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); |
| 1808 } | 1808 } |
| 1809 Address setter_entry = v8::ToCData<Address>(ai->setter()); | 1809 Address setter_entry = v8::ToCData<Address>(ai->setter()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 profiler_ = NULL; | 1886 profiler_ = NULL; |
| 1887 } | 1887 } |
| 1888 | 1888 |
| 1889 delete ticker_; | 1889 delete ticker_; |
| 1890 ticker_ = NULL; | 1890 ticker_ = NULL; |
| 1891 | 1891 |
| 1892 return log_->Close(); | 1892 return log_->Close(); |
| 1893 } | 1893 } |
| 1894 | 1894 |
| 1895 } } // namespace v8::internal | 1895 } } // namespace v8::internal |
| OLD | NEW |