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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 break; | 1675 break; |
1676 case Code::CALL_IC: | 1676 case Code::CALL_IC: |
1677 description = "A call IC from the snapshot"; | 1677 description = "A call IC from the snapshot"; |
1678 tag = Logger::CALL_IC_TAG; | 1678 tag = Logger::CALL_IC_TAG; |
1679 break; | 1679 break; |
1680 case Code::KEYED_CALL_IC: | 1680 case Code::KEYED_CALL_IC: |
1681 description = "A keyed call IC from the snapshot"; | 1681 description = "A keyed call IC from the snapshot"; |
1682 tag = Logger::KEYED_CALL_IC_TAG; | 1682 tag = Logger::KEYED_CALL_IC_TAG; |
1683 break; | 1683 break; |
1684 } | 1684 } |
1685 PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description)); | 1685 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); |
1686 } | 1686 } |
1687 } | 1687 } |
1688 | 1688 |
1689 | 1689 |
1690 void Logger::LogCodeInfo() { | 1690 void Logger::LogCodeInfo() { |
1691 if (!log_->IsEnabled() || !FLAG_ll_prof) return; | 1691 if (!log_->IsEnabled() || !FLAG_ll_prof) return; |
1692 #if V8_TARGET_ARCH_IA32 | 1692 #if V8_TARGET_ARCH_IA32 |
1693 const char arch[] = "ia32"; | 1693 const char arch[] = "ia32"; |
1694 #elif V8_TARGET_ARCH_X64 | 1694 #elif V8_TARGET_ARCH_X64 |
1695 const char arch[] = "x64"; | 1695 const char arch[] = "x64"; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 | 1779 |
1780 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1780 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1781 Handle<Code> code) { | 1781 Handle<Code> code) { |
1782 Handle<String> func_name(shared->DebugName()); | 1782 Handle<String> func_name(shared->DebugName()); |
1783 if (shared->script()->IsScript()) { | 1783 if (shared->script()->IsScript()) { |
1784 Handle<Script> script(Script::cast(shared->script())); | 1784 Handle<Script> script(Script::cast(shared->script())); |
1785 if (script->name()->IsString()) { | 1785 if (script->name()->IsString()) { |
1786 Handle<String> script_name(String::cast(script->name())); | 1786 Handle<String> script_name(String::cast(script->name())); |
1787 int line_num = GetScriptLineNumber(script, shared->start_position()); | 1787 int line_num = GetScriptLineNumber(script, shared->start_position()); |
1788 if (line_num > 0) { | 1788 if (line_num > 0) { |
1789 PROFILE(ISOLATE, | 1789 PROFILE(isolate_, |
1790 CodeCreateEvent( | 1790 CodeCreateEvent( |
1791 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1791 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
1792 *code, *shared, | 1792 *code, *shared, |
1793 *script_name, line_num + 1)); | 1793 *script_name, line_num + 1)); |
1794 } else { | 1794 } else { |
1795 // Can't distinguish eval and script here, so always use Script. | 1795 // Can't distinguish eval and script here, so always use Script. |
1796 PROFILE(ISOLATE, | 1796 PROFILE(isolate_, |
1797 CodeCreateEvent( | 1797 CodeCreateEvent( |
1798 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 1798 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
1799 *code, *shared, *script_name)); | 1799 *code, *shared, *script_name)); |
1800 } | 1800 } |
1801 } else { | 1801 } else { |
1802 PROFILE(ISOLATE, | 1802 PROFILE(isolate_, |
1803 CodeCreateEvent( | 1803 CodeCreateEvent( |
1804 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1804 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
1805 *code, *shared, *func_name)); | 1805 *code, *shared, *func_name)); |
1806 } | 1806 } |
1807 } else if (shared->IsApiFunction()) { | 1807 } else if (shared->IsApiFunction()) { |
1808 // API function. | 1808 // API function. |
1809 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); | 1809 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); |
1810 Object* raw_call_data = fun_data->call_code(); | 1810 Object* raw_call_data = fun_data->call_code(); |
1811 if (!raw_call_data->IsUndefined()) { | 1811 if (!raw_call_data->IsUndefined()) { |
1812 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1812 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); |
1813 Object* callback_obj = call_data->callback(); | 1813 Object* callback_obj = call_data->callback(); |
1814 Address entry_point = v8::ToCData<Address>(callback_obj); | 1814 Address entry_point = v8::ToCData<Address>(callback_obj); |
1815 PROFILE(ISOLATE, CallbackEvent(*func_name, entry_point)); | 1815 PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); |
1816 } | 1816 } |
1817 } else { | 1817 } else { |
1818 PROFILE(ISOLATE, | 1818 PROFILE(isolate_, |
1819 CodeCreateEvent( | 1819 CodeCreateEvent( |
1820 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); | 1820 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); |
1821 } | 1821 } |
1822 } | 1822 } |
1823 | 1823 |
1824 | 1824 |
1825 void Logger::LogCompiledFunctions() { | 1825 void Logger::LogCompiledFunctions() { |
1826 Heap* heap = isolate_->heap(); | 1826 Heap* heap = isolate_->heap(); |
1827 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1827 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
1828 "Logger::LogCompiledFunctions"); | 1828 "Logger::LogCompiledFunctions"); |
(...skipping 20 matching lines...) Expand all Loading... |
1849 "Logger::LogAccessorCallbacks"); | 1849 "Logger::LogAccessorCallbacks"); |
1850 HeapIterator iterator(heap); | 1850 HeapIterator iterator(heap); |
1851 AssertNoAllocation no_alloc; | 1851 AssertNoAllocation no_alloc; |
1852 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1852 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1853 if (!obj->IsExecutableAccessorInfo()) continue; | 1853 if (!obj->IsExecutableAccessorInfo()) continue; |
1854 ExecutableAccessorInfo* ai = ExecutableAccessorInfo::cast(obj); | 1854 ExecutableAccessorInfo* ai = ExecutableAccessorInfo::cast(obj); |
1855 if (!ai->name()->IsName()) continue; | 1855 if (!ai->name()->IsName()) continue; |
1856 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1856 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
1857 Name* name = Name::cast(ai->name()); | 1857 Name* name = Name::cast(ai->name()); |
1858 if (getter_entry != 0) { | 1858 if (getter_entry != 0) { |
1859 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); | 1859 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); |
1860 } | 1860 } |
1861 Address setter_entry = v8::ToCData<Address>(ai->setter()); | 1861 Address setter_entry = v8::ToCData<Address>(ai->setter()); |
1862 if (setter_entry != 0) { | 1862 if (setter_entry != 0) { |
1863 PROFILE(ISOLATE, SetterCallbackEvent(name, setter_entry)); | 1863 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry)); |
1864 } | 1864 } |
1865 } | 1865 } |
1866 } | 1866 } |
1867 | 1867 |
1868 | 1868 |
1869 bool Logger::SetUp() { | 1869 bool Logger::SetUp() { |
1870 // Tests and EnsureInitialize() can call this twice in a row. It's harmless. | 1870 // Tests and EnsureInitialize() can call this twice in a row. It's harmless. |
1871 if (is_initialized_) return true; | 1871 if (is_initialized_) return true; |
1872 is_initialized_ = true; | 1872 is_initialized_ = true; |
1873 | 1873 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 2020 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
2021 ASSERT(sampler->IsActive()); | 2021 ASSERT(sampler->IsActive()); |
2022 ScopedLock lock(active_samplers_mutex); | 2022 ScopedLock lock(active_samplers_mutex); |
2023 ASSERT(active_samplers_ != NULL); | 2023 ASSERT(active_samplers_ != NULL); |
2024 bool removed = active_samplers_->RemoveElement(sampler); | 2024 bool removed = active_samplers_->RemoveElement(sampler); |
2025 ASSERT(removed); | 2025 ASSERT(removed); |
2026 USE(removed); | 2026 USE(removed); |
2027 } | 2027 } |
2028 | 2028 |
2029 } } // namespace v8::internal | 2029 } } // namespace v8::internal |
OLD | NEW |