Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: src/log.h

Issue 18259024: Logger: extract low level logging code into a separate class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 V(STORE_IC_TAG, "StoreIC") \ 144 V(STORE_IC_TAG, "StoreIC") \
145 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ 145 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \
146 V(STUB_TAG, "Stub") \ 146 V(STUB_TAG, "Stub") \
147 V(NATIVE_FUNCTION_TAG, "Function") \ 147 V(NATIVE_FUNCTION_TAG, "Function") \
148 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ 148 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \
149 V(NATIVE_SCRIPT_TAG, "Script") 149 V(NATIVE_SCRIPT_TAG, "Script")
150 // Note that 'NATIVE_' cases for functions and scripts are mapped onto 150 // Note that 'NATIVE_' cases for functions and scripts are mapped onto
151 // original tags when writing to the log. 151 // original tags when writing to the log.
152 152
153 153
154 class LowLevelLogger;
154 class Sampler; 155 class Sampler;
155 156
156 157
157 class Logger { 158 class Logger {
158 public: 159 public:
159 #define DECLARE_ENUM(enum_item, ignore) enum_item, 160 #define DECLARE_ENUM(enum_item, ignore) enum_item,
160 enum LogEventsAndTags { 161 enum LogEventsAndTags {
161 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 162 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
162 NUMBER_OF_LOG_EVENTS 163 NUMBER_OF_LOG_EVENTS
163 }; 164 };
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 424
424 // Helper method. It dumps name into name_buffer_. 425 // Helper method. It dumps name into name_buffer_.
425 void AppendName(Name* name); 426 void AppendName(Name* name);
426 427
427 // Appends standard code header. 428 // Appends standard code header.
428 void AppendCodeCreateHeader(LogMessageBuilder*, LogEventsAndTags, Code*); 429 void AppendCodeCreateHeader(LogMessageBuilder*, LogEventsAndTags, Code*);
429 430
430 // Appends symbol for the name. 431 // Appends symbol for the name.
431 void AppendSymbolName(LogMessageBuilder*, Symbol*); 432 void AppendSymbolName(LogMessageBuilder*, Symbol*);
432 433
433 // Emits general information about generated code.
434 void LogCodeInfo();
435
436 void RegisterSnapshotCodeName(Code* code, const char* name, int name_size); 434 void RegisterSnapshotCodeName(Code* code, const char* name, int name_size);
437 435
438 // Low-level logging support.
439
440 void LowLevelCodeCreateEvent(Code* code, const char* name, int name_size);
441
442 void LowLevelCodeMoveEvent(Address from, Address to);
443
444 void LowLevelCodeDeleteEvent(Address from);
445
446 void LowLevelSnapshotPositionEvent(Address addr, int pos);
447
448 void LowLevelLogWriteBytes(const char* bytes, int size);
449
450 template <typename T>
451 void LowLevelLogWriteStruct(const T& s) {
452 char tag = T::kTag;
453 LowLevelLogWriteBytes(reinterpret_cast<const char*>(&tag), sizeof(tag));
454 LowLevelLogWriteBytes(reinterpret_cast<const char*>(&s), sizeof(s));
455 }
456
457 // Emits a profiler tick event. Used by the profiler thread. 436 // Emits a profiler tick event. Used by the profiler thread.
458 void TickEvent(TickSample* sample, bool overflow); 437 void TickEvent(TickSample* sample, bool overflow);
459 438
460 void ApiEvent(const char* name, ...); 439 void ApiEvent(const char* name, ...);
461 440
462 // Logs a StringEvent regardless of whether FLAG_log is true. 441 // Logs a StringEvent regardless of whether FLAG_log is true.
463 void UncheckedStringEvent(const char* name, const char* value); 442 void UncheckedStringEvent(const char* name, const char* value);
464 443
465 // Logs an IntEvent regardless of whether FLAG_log is true. 444 // Logs an IntEvent regardless of whether FLAG_log is true.
466 void UncheckedIntEvent(const char* name, int value); 445 void UncheckedIntEvent(const char* name, int value);
(...skipping 21 matching lines...) Expand all
488 friend class Profiler; 467 friend class Profiler;
489 template <StateTag Tag> friend class VMState; 468 template <StateTag Tag> friend class VMState;
490 469
491 friend class LoggerTestHelper; 470 friend class LoggerTestHelper;
492 471
493 472
494 int logging_nesting_; 473 int logging_nesting_;
495 int cpu_profiler_nesting_; 474 int cpu_profiler_nesting_;
496 475
497 Log* log_; 476 Log* log_;
477 LowLevelLogger* ll_logger_;
498 478
499 NameBuffer* name_buffer_; 479 NameBuffer* name_buffer_;
500 480
501 NameMap* address_to_name_map_; 481 NameMap* address_to_name_map_;
502 482
503 // Guards against multiple calls to TearDown() that can happen in some tests. 483 // Guards against multiple calls to TearDown() that can happen in some tests.
504 // 'true' between SetUp() and TearDown(). 484 // 'true' between SetUp() and TearDown().
505 bool is_initialized_; 485 bool is_initialized_;
506 486
507 // The code event handler - if any. 487 // The code event handler - if any.
(...skipping 13 matching lines...) Expand all
521 int64_t epoch_; 501 int64_t epoch_;
522 502
523 friend class CpuProfiler; 503 friend class CpuProfiler;
524 }; 504 };
525 505
526 506
527 } } // namespace v8::internal 507 } } // namespace v8::internal
528 508
529 509
530 #endif // V8_LOG_H_ 510 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « no previous file | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698