OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 // | 401 // |
402 // Logger class implementation. | 402 // Logger class implementation. |
403 // | 403 // |
404 Ticker* Logger::ticker_ = NULL; | 404 Ticker* Logger::ticker_ = NULL; |
405 char* Logger::message_buffer_ = NULL; | 405 char* Logger::message_buffer_ = NULL; |
406 FILE* Logger::logfile_ = NULL; | 406 FILE* Logger::logfile_ = NULL; |
407 Profiler* Logger::profiler_ = NULL; | 407 Profiler* Logger::profiler_ = NULL; |
408 Mutex* Logger::mutex_ = NULL; | 408 Mutex* Logger::mutex_ = NULL; |
409 VMState* Logger::current_state_ = NULL; | 409 VMState* Logger::current_state_ = NULL; |
410 VMState Logger::bottom_state_(OTHER); | 410 VMState Logger::bottom_state_(EXTERNAL); |
411 SlidingStateWindow* Logger::sliding_state_window_ = NULL; | 411 SlidingStateWindow* Logger::sliding_state_window_ = NULL; |
412 | 412 |
413 #endif // ENABLE_LOGGING_AND_PROFILING | 413 #endif // ENABLE_LOGGING_AND_PROFILING |
414 | 414 |
415 | 415 |
416 void Logger::Preamble(const char* content) { | 416 void Logger::Preamble(const char* content) { |
417 #ifdef ENABLE_LOGGING_AND_PROFILING | 417 #ifdef ENABLE_LOGGING_AND_PROFILING |
418 if (logfile_ == NULL || !FLAG_log_code) return; | 418 if (logfile_ == NULL || !FLAG_log_code) return; |
419 LogMessageBuilder msg; | 419 LogMessageBuilder msg; |
420 msg.Append("%s", content); | 420 msg.Append("%s", content); |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 return "COMPILER"; | 1103 return "COMPILER"; |
1104 case OTHER: | 1104 case OTHER: |
1105 return "OTHER"; | 1105 return "OTHER"; |
1106 default: | 1106 default: |
1107 UNREACHABLE(); | 1107 UNREACHABLE(); |
1108 return NULL; | 1108 return NULL; |
1109 } | 1109 } |
1110 } | 1110 } |
1111 | 1111 |
1112 VMState::VMState(StateTag state) { | 1112 VMState::VMState(StateTag state) { |
| 1113 #if !defined(ENABLE_HEAP_PROTECTION) |
| 1114 // When not protecting the heap, there is no difference between |
| 1115 // EXTERNAL and OTHER. As an optimizatin in that case, we will not |
| 1116 // perform EXTERNAL->OTHER transitions through the API. We thus |
| 1117 // compress the two states into one. |
| 1118 if (state == EXTERNAL) state = OTHER; |
| 1119 #endif |
1113 state_ = state; | 1120 state_ = state; |
1114 previous_ = Logger::current_state_; | 1121 previous_ = Logger::current_state_; |
1115 Logger::current_state_ = this; | 1122 Logger::current_state_ = this; |
1116 | 1123 |
1117 if (FLAG_log_state_changes) { | 1124 if (FLAG_log_state_changes) { |
1118 LOG(UncheckedStringEvent("Entering", StateToString(state_))); | 1125 LOG(UncheckedStringEvent("Entering", StateToString(state_))); |
1119 if (previous_ != NULL) { | 1126 if (previous_ != NULL) { |
1120 LOG(UncheckedStringEvent("From", StateToString(previous_->state_))); | 1127 LOG(UncheckedStringEvent("From", StateToString(previous_->state_))); |
1121 } | 1128 } |
1122 } | 1129 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 } else if (previous_->state_ == EXTERNAL) { | 1162 } else if (previous_->state_ == EXTERNAL) { |
1156 // We are leaving V8. | 1163 // We are leaving V8. |
1157 Heap::Protect(); | 1164 Heap::Protect(); |
1158 } | 1165 } |
1159 } | 1166 } |
1160 #endif | 1167 #endif |
1161 } | 1168 } |
1162 #endif | 1169 #endif |
1163 | 1170 |
1164 } } // namespace v8::internal | 1171 } } // namespace v8::internal |
OLD | NEW |