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

Side by Side Diff: runtime/vm/zone.cc

Issue 1377663002: Add Timeline to dart:developer (Closed) Base URL: git@github.com:dart-lang/sdk.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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/zone.h" 5 #include "vm/zone.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/handles_impl.h" 10 #include "vm/handles_impl.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 172
173 char* Zone::MakeCopyOfString(const char* str) { 173 char* Zone::MakeCopyOfString(const char* str) {
174 intptr_t len = strlen(str) + 1; // '\0'-terminated. 174 intptr_t len = strlen(str) + 1; // '\0'-terminated.
175 char* copy = Alloc<char>(len); 175 char* copy = Alloc<char>(len);
176 strncpy(copy, str, len); 176 strncpy(copy, str, len);
177 return copy; 177 return copy;
178 } 178 }
179 179
180 180
181 char* Zone::ConcatStrings(const char* a, const char* b, char join) {
182 intptr_t a_len = (a == NULL) ? 0 : strlen(a);
183 const intptr_t b_len = strlen(b) + 1; // '\0'-terminated.
184 const intptr_t len = a_len + b_len;
185 char* copy = Alloc<char>(len);
186 if (a_len > 0) {
187 strncpy(copy, a, a_len);
188 // Insert join character.
189 copy[a_len++] = join;
190 }
191 strncpy(&copy[a_len], b, b_len);
192 return copy;
193 }
194
195
181 #if defined(DEBUG) 196 #if defined(DEBUG)
182 void Zone::DumpZoneSizes() { 197 void Zone::DumpZoneSizes() {
183 intptr_t size = 0; 198 intptr_t size = 0;
184 for (Segment* s = large_segments_; s != NULL; s = s->next()) { 199 for (Segment* s = large_segments_; s != NULL; s = s->next()) {
185 size += s->size(); 200 size += s->size();
186 } 201 }
187 OS::PrintErr("*** Zone(0x%" Px ") size in bytes," 202 OS::PrintErr("*** Zone(0x%" Px ") size in bytes,"
188 " Total = %" Pd " Large Segments = %" Pd "\n", 203 " Total = %" Pd " Large Segments = %" Pd "\n",
189 reinterpret_cast<intptr_t>(this), SizeInBytes(), size); 204 reinterpret_cast<intptr_t>(this), SizeInBytes(), size);
190 } 205 }
(...skipping 17 matching lines...) Expand all
208 return buffer; 223 return buffer;
209 } 224 }
210 225
211 226
212 char* Zone::VPrint(const char* format, va_list args) { 227 char* Zone::VPrint(const char* format, va_list args) {
213 return OS::VSCreate(this, format, args); 228 return OS::VSCreate(this, format, args);
214 } 229 }
215 230
216 231
217 } // namespace dart 232 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698