OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 AppendBytes(kLogEventsNames[tag]); | 76 AppendBytes(kLogEventsNames[tag]); |
77 AppendByte(':'); | 77 AppendByte(':'); |
78 } | 78 } |
79 | 79 |
80 void AppendName(Name* name) { | 80 void AppendName(Name* name) { |
81 if (name->IsString()) { | 81 if (name->IsString()) { |
82 AppendString(String::cast(name)); | 82 AppendString(String::cast(name)); |
83 } else { | 83 } else { |
84 Symbol* symbol = Symbol::cast(name); | 84 Symbol* symbol = Symbol::cast(name); |
85 AppendBytes("symbol("); | 85 AppendBytes("symbol("); |
86 if (!symbol->name()->IsUndefined()) { | 86 if (!symbol->name()->IsUndefined(symbol->GetIsolate())) { |
87 AppendBytes("\""); | 87 AppendBytes("\""); |
88 AppendString(String::cast(symbol->name())); | 88 AppendString(String::cast(symbol->name())); |
89 AppendBytes("\" "); | 89 AppendBytes("\" "); |
90 } | 90 } |
91 AppendBytes("hash "); | 91 AppendBytes("hash "); |
92 AppendHex(symbol->Hash()); | 92 AppendHex(symbol->Hash()); |
93 AppendByte(')'); | 93 AppendByte(')'); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 base::SmartArrayPointer<char> class_name = | 1014 base::SmartArrayPointer<char> class_name = |
1015 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1015 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
1016 if (name->IsString()) { | 1016 if (name->IsString()) { |
1017 base::SmartArrayPointer<char> property_name = | 1017 base::SmartArrayPointer<char> property_name = |
1018 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1018 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
1019 ApiEvent("api,%s,\"%s\",\"%s\"", tag, class_name.get(), | 1019 ApiEvent("api,%s,\"%s\",\"%s\"", tag, class_name.get(), |
1020 property_name.get()); | 1020 property_name.get()); |
1021 } else { | 1021 } else { |
1022 Symbol* symbol = Symbol::cast(name); | 1022 Symbol* symbol = Symbol::cast(name); |
1023 uint32_t hash = symbol->Hash(); | 1023 uint32_t hash = symbol->Hash(); |
1024 if (symbol->name()->IsUndefined()) { | 1024 if (symbol->name()->IsUndefined(symbol->GetIsolate())) { |
1025 ApiEvent("api,%s,\"%s\",symbol(hash %x)", tag, class_name.get(), hash); | 1025 ApiEvent("api,%s,\"%s\",symbol(hash %x)", tag, class_name.get(), hash); |
1026 } else { | 1026 } else { |
1027 base::SmartArrayPointer<char> str = | 1027 base::SmartArrayPointer<char> str = |
1028 String::cast(symbol->name()) | 1028 String::cast(symbol->name()) |
1029 ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1029 ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
1030 ApiEvent("api,%s,\"%s\",symbol(\"%s\" hash %x)", tag, class_name.get(), | 1030 ApiEvent("api,%s,\"%s\",symbol(\"%s\" hash %x)", tag, class_name.get(), |
1031 str.get(), hash); | 1031 str.get(), hash); |
1032 } | 1032 } |
1033 } | 1033 } |
1034 } | 1034 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 msg.Append("%s,%s,-2,", | 1082 msg.Append("%s,%s,-2,", |
1083 kLogEventsNames[CODE_CREATION_EVENT], | 1083 kLogEventsNames[CODE_CREATION_EVENT], |
1084 kLogEventsNames[CALLBACK_TAG]); | 1084 kLogEventsNames[CALLBACK_TAG]); |
1085 msg.AppendAddress(entry_point); | 1085 msg.AppendAddress(entry_point); |
1086 if (name->IsString()) { | 1086 if (name->IsString()) { |
1087 base::SmartArrayPointer<char> str = | 1087 base::SmartArrayPointer<char> str = |
1088 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1088 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
1089 msg.Append(",1,\"%s%s\"", prefix, str.get()); | 1089 msg.Append(",1,\"%s%s\"", prefix, str.get()); |
1090 } else { | 1090 } else { |
1091 Symbol* symbol = Symbol::cast(name); | 1091 Symbol* symbol = Symbol::cast(name); |
1092 if (symbol->name()->IsUndefined()) { | 1092 if (symbol->name()->IsUndefined(symbol->GetIsolate())) { |
1093 msg.Append(",1,symbol(hash %x)", symbol->Hash()); | 1093 msg.Append(",1,symbol(hash %x)", symbol->Hash()); |
1094 } else { | 1094 } else { |
1095 base::SmartArrayPointer<char> str = | 1095 base::SmartArrayPointer<char> str = |
1096 String::cast(symbol->name()) | 1096 String::cast(symbol->name()) |
1097 ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1097 ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
1098 msg.Append(",1,symbol(\"%s%s\" hash %x)", prefix, str.get(), | 1098 msg.Append(",1,symbol(\"%s%s\" hash %x)", prefix, str.get(), |
1099 symbol->Hash()); | 1099 symbol->Hash()); |
1100 } | 1100 } |
1101 } | 1101 } |
1102 msg.WriteToLogFile(); | 1102 msg.WriteToLogFile(); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 PROFILE(isolate_, | 1677 PROFILE(isolate_, |
1678 CodeCreateEvent( | 1678 CodeCreateEvent( |
1679 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1679 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
1680 *code, *shared, isolate_->heap()->empty_string(), line_num, | 1680 *code, *shared, isolate_->heap()->empty_string(), line_num, |
1681 column_num)); | 1681 column_num)); |
1682 } | 1682 } |
1683 } else if (shared->IsApiFunction()) { | 1683 } else if (shared->IsApiFunction()) { |
1684 // API function. | 1684 // API function. |
1685 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); | 1685 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); |
1686 Object* raw_call_data = fun_data->call_code(); | 1686 Object* raw_call_data = fun_data->call_code(); |
1687 if (!raw_call_data->IsUndefined()) { | 1687 if (!raw_call_data->IsUndefined(isolate_)) { |
1688 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1688 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); |
1689 Object* callback_obj = call_data->callback(); | 1689 Object* callback_obj = call_data->callback(); |
1690 Address entry_point = v8::ToCData<Address>(callback_obj); | 1690 Address entry_point = v8::ToCData<Address>(callback_obj); |
1691 #if USES_FUNCTION_DESCRIPTORS | 1691 #if USES_FUNCTION_DESCRIPTORS |
1692 entry_point = *FUNCTION_ENTRYPOINT_ADDRESS(entry_point); | 1692 entry_point = *FUNCTION_ENTRYPOINT_ADDRESS(entry_point); |
1693 #endif | 1693 #endif |
1694 PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); | 1694 PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); |
1695 } | 1695 } |
1696 } else { | 1696 } else { |
1697 PROFILE(isolate_, CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *shared, | 1697 PROFILE(isolate_, CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *shared, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 removeCodeEventListener(jit_logger_); | 1903 removeCodeEventListener(jit_logger_); |
1904 delete jit_logger_; | 1904 delete jit_logger_; |
1905 jit_logger_ = NULL; | 1905 jit_logger_ = NULL; |
1906 } | 1906 } |
1907 | 1907 |
1908 return log_->Close(); | 1908 return log_->Close(); |
1909 } | 1909 } |
1910 | 1910 |
1911 } // namespace internal | 1911 } // namespace internal |
1912 } // namespace v8 | 1912 } // namespace v8 |
OLD | NEW |