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

Side by Side Diff: src/log.cc

Issue 1403763002: Reland improve perf_basic_prof filename reporting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | test/cctest/test-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 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void AppendBytes(const char* bytes) { 116 void AppendBytes(const char* bytes) {
117 AppendBytes(bytes, StrLength(bytes)); 117 AppendBytes(bytes, StrLength(bytes));
118 } 118 }
119 119
120 void AppendByte(char c) { 120 void AppendByte(char c) {
121 if (utf8_pos_ >= kUtf8BufferSize) return; 121 if (utf8_pos_ >= kUtf8BufferSize) return;
122 utf8_buffer_[utf8_pos_++] = c; 122 utf8_buffer_[utf8_pos_++] = c;
123 } 123 }
124 124
125 void AppendInt(int n) { 125 void AppendInt(int n) {
126 Vector<char> buffer(utf8_buffer_ + utf8_pos_, 126 int space = kUtf8BufferSize - utf8_pos_;
127 kUtf8BufferSize - utf8_pos_); 127 if (space <= 0) return;
128 Vector<char> buffer(utf8_buffer_ + utf8_pos_, space);
128 int size = SNPrintF(buffer, "%d", n); 129 int size = SNPrintF(buffer, "%d", n);
129 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { 130 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) {
130 utf8_pos_ += size; 131 utf8_pos_ += size;
131 } 132 }
132 } 133 }
133 134
134 void AppendHex(uint32_t n) { 135 void AppendHex(uint32_t n) {
135 Vector<char> buffer(utf8_buffer_ + utf8_pos_, 136 int space = kUtf8BufferSize - utf8_pos_;
136 kUtf8BufferSize - utf8_pos_); 137 if (space <= 0) return;
138 Vector<char> buffer(utf8_buffer_ + utf8_pos_, space);
137 int size = SNPrintF(buffer, "%x", n); 139 int size = SNPrintF(buffer, "%x", n);
138 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { 140 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) {
139 utf8_pos_ += size; 141 utf8_pos_ += size;
140 } 142 }
141 } 143 }
142 144
143 const char* get() { return utf8_buffer_; } 145 const char* get() { return utf8_buffer_; }
144 int size() const { return utf8_pos_; } 146 int size() const { return utf8_pos_; }
145 147
146 private: 148 private:
147 static const int kUtf8BufferSize = 512; 149 static const int kUtf8BufferSize = 512;
148 static const int kUtf16BufferSize = 128; 150 static const int kUtf16BufferSize = kUtf8BufferSize;
149 151
150 int utf8_pos_; 152 int utf8_pos_;
151 char utf8_buffer_[kUtf8BufferSize]; 153 char utf8_buffer_[kUtf8BufferSize];
152 uc16 utf16_buffer[kUtf16BufferSize]; 154 uc16 utf16_buffer[kUtf16BufferSize];
153 }; 155 };
154 156
155 157
156 CodeEventLogger::CodeEventLogger() : name_buffer_(new NameBuffer) { } 158 CodeEventLogger::CodeEventLogger() : name_buffer_(new NameBuffer) { }
157 159
158 CodeEventLogger::~CodeEventLogger() { delete name_buffer_; } 160 CodeEventLogger::~CodeEventLogger() { delete name_buffer_; }
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 removeCodeEventListener(jit_logger_); 1909 removeCodeEventListener(jit_logger_);
1908 delete jit_logger_; 1910 delete jit_logger_;
1909 jit_logger_ = NULL; 1911 jit_logger_ = NULL;
1910 } 1912 }
1911 1913
1912 return log_->Close(); 1914 return log_->Close();
1913 } 1915 }
1914 1916
1915 } // namespace internal 1917 } // namespace internal
1916 } // namespace v8 1918 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698