| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 memset(&event, 0, sizeof(event)); | 484 memset(&event, 0, sizeof(event)); |
| 485 event.type = JitCodeEvent::CODE_ADD_LINE_POS_INFO; | 485 event.type = JitCodeEvent::CODE_ADD_LINE_POS_INFO; |
| 486 event.user_data = jit_handler_data; | 486 event.user_data = jit_handler_data; |
| 487 event.line_info.offset = pc_offset; | 487 event.line_info.offset = pc_offset; |
| 488 event.line_info.pos = position; | 488 event.line_info.pos = position; |
| 489 event.line_info.position_type = position_type; | 489 event.line_info.position_type = position_type; |
| 490 | 490 |
| 491 code_event_handler_(&event); | 491 code_event_handler_(&event); |
| 492 } | 492 } |
| 493 | 493 |
| 494 |
| 494 void* Logger::IssueStartCodePosInfoEvent() { | 495 void* Logger::IssueStartCodePosInfoEvent() { |
| 495 JitCodeEvent event; | 496 JitCodeEvent event; |
| 496 memset(&event, 0, sizeof(event)); | 497 memset(&event, 0, sizeof(event)); |
| 497 event.type = JitCodeEvent::CODE_START_LINE_INFO_RECORDING; | 498 event.type = JitCodeEvent::CODE_START_LINE_INFO_RECORDING; |
| 498 | 499 |
| 499 code_event_handler_(&event); | 500 code_event_handler_(&event); |
| 500 return event.user_data; | 501 return event.user_data; |
| 501 } | 502 } |
| 502 | 503 |
| 504 |
| 503 void Logger::IssueEndCodePosInfoEvent(Code* code, void* jit_handler_data) { | 505 void Logger::IssueEndCodePosInfoEvent(Code* code, void* jit_handler_data) { |
| 504 JitCodeEvent event; | 506 JitCodeEvent event; |
| 505 memset(&event, 0, sizeof(event)); | 507 memset(&event, 0, sizeof(event)); |
| 506 event.type = JitCodeEvent::CODE_END_LINE_INFO_RECORDING; | 508 event.type = JitCodeEvent::CODE_END_LINE_INFO_RECORDING; |
| 507 event.code_start = code->instruction_start(); | 509 event.code_start = code->instruction_start(); |
| 508 event.user_data = jit_handler_data; | 510 event.user_data = jit_handler_data; |
| 509 | 511 |
| 510 code_event_handler_(&event); | 512 code_event_handler_(&event); |
| 511 } | 513 } |
| 512 | 514 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 void Logger::ApiIndexedPropertyAccess(const char* tag, | 823 void Logger::ApiIndexedPropertyAccess(const char* tag, |
| 822 JSObject* holder, | 824 JSObject* holder, |
| 823 uint32_t index) { | 825 uint32_t index) { |
| 824 if (!log_->IsEnabled() || !FLAG_log_api) return; | 826 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 825 String* class_name_obj = holder->class_name(); | 827 String* class_name_obj = holder->class_name(); |
| 826 SmartArrayPointer<char> class_name = | 828 SmartArrayPointer<char> class_name = |
| 827 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 829 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 828 ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index); | 830 ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index); |
| 829 } | 831 } |
| 830 | 832 |
| 833 |
| 831 void Logger::ApiObjectAccess(const char* tag, JSObject* object) { | 834 void Logger::ApiObjectAccess(const char* tag, JSObject* object) { |
| 832 if (!log_->IsEnabled() || !FLAG_log_api) return; | 835 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 833 String* class_name_obj = object->class_name(); | 836 String* class_name_obj = object->class_name(); |
| 834 SmartArrayPointer<char> class_name = | 837 SmartArrayPointer<char> class_name = |
| 835 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 838 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 836 ApiEvent("api,%s,\"%s\"\n", tag, *class_name); | 839 ApiEvent("api,%s,\"%s\"\n", tag, *class_name); |
| 837 } | 840 } |
| 838 | 841 |
| 839 | 842 |
| 840 void Logger::ApiEntryCall(const char* name) { | 843 void Logger::ApiEntryCall(const char* name) { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 int pc_offset, | 1202 int pc_offset, |
| 1200 int position) { | 1203 int position) { |
| 1201 if (code_event_handler_ != NULL) { | 1204 if (code_event_handler_ != NULL) { |
| 1202 IssueAddCodeLinePosInfoEvent(jit_handler_data, | 1205 IssueAddCodeLinePosInfoEvent(jit_handler_data, |
| 1203 pc_offset, | 1206 pc_offset, |
| 1204 position, | 1207 position, |
| 1205 JitCodeEvent::STATEMENT_POSITION); | 1208 JitCodeEvent::STATEMENT_POSITION); |
| 1206 } | 1209 } |
| 1207 } | 1210 } |
| 1208 | 1211 |
| 1212 |
| 1209 void Logger::CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder) { | 1213 void Logger::CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder) { |
| 1210 if (code_event_handler_ != NULL) { | 1214 if (code_event_handler_ != NULL) { |
| 1211 pos_recorder->AttachJITHandlerData(IssueStartCodePosInfoEvent()); | 1215 pos_recorder->AttachJITHandlerData(IssueStartCodePosInfoEvent()); |
| 1212 } | 1216 } |
| 1213 } | 1217 } |
| 1214 | 1218 |
| 1215 void Logger::CodeEndLinePosInfoRecordEvent(Code* code, | 1219 void Logger::CodeEndLinePosInfoRecordEvent(Code* code, |
| 1216 void* jit_handler_data) { | 1220 void* jit_handler_data) { |
| 1217 if (code_event_handler_ != NULL) { | 1221 if (code_event_handler_ != NULL) { |
| 1218 IssueEndCodePosInfoEvent(code, jit_handler_data); | 1222 IssueEndCodePosInfoEvent(code, jit_handler_data); |
| 1219 } | 1223 } |
| 1220 } | 1224 } |
| 1221 | 1225 |
| 1226 |
| 1222 void Logger::SnapshotPositionEvent(Address addr, int pos) { | 1227 void Logger::SnapshotPositionEvent(Address addr, int pos) { |
| 1223 if (!log_->IsEnabled()) return; | 1228 if (!log_->IsEnabled()) return; |
| 1224 if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos); | 1229 if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos); |
| 1225 if (Serializer::enabled() && address_to_name_map_ != NULL) { | 1230 if (Serializer::enabled() && address_to_name_map_ != NULL) { |
| 1226 const char* code_name = address_to_name_map_->Lookup(addr); | 1231 const char* code_name = address_to_name_map_->Lookup(addr); |
| 1227 if (code_name == NULL) return; // Not a code object. | 1232 if (code_name == NULL) return; // Not a code object. |
| 1228 LogMessageBuilder msg(this); | 1233 LogMessageBuilder msg(this); |
| 1229 msg.Append("%s,%d,", kLogEventsNames[SNAPSHOT_CODE_NAME_EVENT], pos); | 1234 msg.Append("%s,%d,", kLogEventsNames[SNAPSHOT_CODE_NAME_EVENT], pos); |
| 1230 msg.AppendDoubleQuotedString(code_name); | 1235 msg.AppendDoubleQuotedString(code_name); |
| 1231 msg.Append("\n"); | 1236 msg.Append("\n"); |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 profiler_ = NULL; | 1815 profiler_ = NULL; |
| 1811 } | 1816 } |
| 1812 | 1817 |
| 1813 delete ticker_; | 1818 delete ticker_; |
| 1814 ticker_ = NULL; | 1819 ticker_ = NULL; |
| 1815 | 1820 |
| 1816 return log_->Close(); | 1821 return log_->Close(); |
| 1817 } | 1822 } |
| 1818 | 1823 |
| 1819 } } // namespace v8::internal | 1824 } } // namespace v8::internal |
| OLD | NEW |