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

Side by Side Diff: src/log.cc

Issue 1400813003: Revert of 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 int space = kUtf8BufferSize - utf8_pos_; 126 Vector<char> buffer(utf8_buffer_ + utf8_pos_,
127 if (space <= 0) return; 127 kUtf8BufferSize - utf8_pos_);
128 Vector<char> buffer(utf8_buffer_ + utf8_pos_, space);
129 int size = SNPrintF(buffer, "%d", n); 128 int size = SNPrintF(buffer, "%d", n);
130 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { 129 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) {
131 utf8_pos_ += size; 130 utf8_pos_ += size;
132 } 131 }
133 } 132 }
134 133
135 void AppendHex(uint32_t n) { 134 void AppendHex(uint32_t n) {
136 int space = kUtf8BufferSize - utf8_pos_; 135 Vector<char> buffer(utf8_buffer_ + utf8_pos_,
137 if (space <= 0) return; 136 kUtf8BufferSize - utf8_pos_);
138 Vector<char> buffer(utf8_buffer_ + utf8_pos_, space);
139 int size = SNPrintF(buffer, "%x", n); 137 int size = SNPrintF(buffer, "%x", n);
140 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { 138 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) {
141 utf8_pos_ += size; 139 utf8_pos_ += size;
142 } 140 }
143 } 141 }
144 142
145 const char* get() { return utf8_buffer_; } 143 const char* get() { return utf8_buffer_; }
146 int size() const { return utf8_pos_; } 144 int size() const { return utf8_pos_; }
147 145
148 private: 146 private:
149 static const int kUtf8BufferSize = 512; 147 static const int kUtf8BufferSize = 512;
150 static const int kUtf16BufferSize = kUtf8BufferSize; 148 static const int kUtf16BufferSize = 128;
151 149
152 int utf8_pos_; 150 int utf8_pos_;
153 char utf8_buffer_[kUtf8BufferSize]; 151 char utf8_buffer_[kUtf8BufferSize];
154 uc16 utf16_buffer[kUtf16BufferSize]; 152 uc16 utf16_buffer[kUtf16BufferSize];
155 }; 153 };
156 154
157 155
158 CodeEventLogger::CodeEventLogger() : name_buffer_(new NameBuffer) { } 156 CodeEventLogger::CodeEventLogger() : name_buffer_(new NameBuffer) { }
159 157
160 CodeEventLogger::~CodeEventLogger() { delete name_buffer_; } 158 CodeEventLogger::~CodeEventLogger() { delete name_buffer_; }
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 removeCodeEventListener(jit_logger_); 1907 removeCodeEventListener(jit_logger_);
1910 delete jit_logger_; 1908 delete jit_logger_;
1911 jit_logger_ = NULL; 1909 jit_logger_ = NULL;
1912 } 1910 }
1913 1911
1914 return log_->Close(); 1912 return log_->Close();
1915 } 1913 }
1916 1914
1917 } // namespace internal 1915 } // namespace internal
1918 } // namespace v8 1916 } // 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