| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 } | 908 } |
| 909 | 909 |
| 910 | 910 |
| 911 void Logger::HeapSampleJSRetainersEvent( | 911 void Logger::HeapSampleJSRetainersEvent( |
| 912 const char* constructor, const char* event) { | 912 const char* constructor, const char* event) { |
| 913 #ifdef ENABLE_LOGGING_AND_PROFILING | 913 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 914 if (!Log::IsEnabled() || !FLAG_log_gc) return; | 914 if (!Log::IsEnabled() || !FLAG_log_gc) return; |
| 915 // Event starts with comma, so we don't have it in the format string. | 915 // Event starts with comma, so we don't have it in the format string. |
| 916 static const char* event_text = "heap-js-ret-item,%s"; | 916 static const char* event_text = "heap-js-ret-item,%s"; |
| 917 // We take placeholder strings into account, but it's OK to be conservative. | 917 // We take placeholder strings into account, but it's OK to be conservative. |
| 918 static const int event_text_len = strlen(event_text); | 918 static const int event_text_len = StrLength(event_text); |
| 919 const int cons_len = strlen(constructor), event_len = strlen(event); | 919 const int cons_len = StrLength(constructor); |
| 920 const int event_len = StrLength(event); |
| 920 int pos = 0; | 921 int pos = 0; |
| 921 // Retainer lists can be long. We may need to split them into multiple events. | 922 // Retainer lists can be long. We may need to split them into multiple events. |
| 922 do { | 923 do { |
| 923 LogMessageBuilder msg; | 924 LogMessageBuilder msg; |
| 924 msg.Append(event_text, constructor); | 925 msg.Append(event_text, constructor); |
| 925 int to_write = event_len - pos; | 926 int to_write = event_len - pos; |
| 926 if (to_write > Log::kMessageBufferSize - (cons_len + event_text_len)) { | 927 if (to_write > Log::kMessageBufferSize - (cons_len + event_text_len)) { |
| 927 int cut_pos = pos + Log::kMessageBufferSize - (cons_len + event_text_len); | 928 int cut_pos = pos + Log::kMessageBufferSize - (cons_len + event_text_len); |
| 928 ASSERT(cut_pos < event_len); | 929 ASSERT(cut_pos < event_len); |
| 929 while (cut_pos > pos && event[cut_pos] != ',') --cut_pos; | 930 while (cut_pos > pos && event[cut_pos] != ',') --cut_pos; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 // Otherwise, if the sliding state window computation has not been | 1313 // Otherwise, if the sliding state window computation has not been |
| 1313 // started we do it now. | 1314 // started we do it now. |
| 1314 if (sliding_state_window_ == NULL) { | 1315 if (sliding_state_window_ == NULL) { |
| 1315 sliding_state_window_ = new SlidingStateWindow(); | 1316 sliding_state_window_ = new SlidingStateWindow(); |
| 1316 } | 1317 } |
| 1317 #endif | 1318 #endif |
| 1318 } | 1319 } |
| 1319 | 1320 |
| 1320 | 1321 |
| 1321 } } // namespace v8::internal | 1322 } } // namespace v8::internal |
| OLD | NEW |