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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 str[length_] = '\0'; | 257 str[length_] = '\0'; |
258 return SmartPointer<const char>(str); | 258 return SmartPointer<const char>(str); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 void StringStream::Log() { | 262 void StringStream::Log() { |
263 LOG(StringEvent("StackDump", buffer_)); | 263 LOG(StringEvent("StackDump", buffer_)); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 void StringStream::OutputToStdOut() { | 267 void StringStream::OutputToFile(FILE* out) { |
268 // Dump the output to stdout, but make sure to break it up into | 268 // Dump the output to stdout, but make sure to break it up into |
269 // manageable chunks to avoid losing parts of the output in the OS | 269 // manageable chunks to avoid losing parts of the output in the OS |
270 // printing code. This is a problem on Windows in particular; see | 270 // printing code. This is a problem on Windows in particular; see |
271 // the VPrint() function implementations in platform-win32.cc. | 271 // the VPrint() function implementations in platform-win32.cc. |
272 unsigned position = 0; | 272 unsigned position = 0; |
273 for (unsigned next; (next = position + 2048) < length_; position = next) { | 273 for (unsigned next; (next = position + 2048) < length_; position = next) { |
274 char save = buffer_[next]; | 274 char save = buffer_[next]; |
275 buffer_[next] = '\0'; | 275 buffer_[next] = '\0'; |
276 internal::PrintF("%s", &buffer_[position]); | 276 internal::PrintF(out, "%s", &buffer_[position]); |
277 buffer_[next] = save; | 277 buffer_[next] = save; |
278 } | 278 } |
279 internal::PrintF("%s", &buffer_[position]); | 279 internal::PrintF(out, "%s", &buffer_[position]); |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 Handle<String> StringStream::ToString() { | 283 Handle<String> StringStream::ToString() { |
284 return Factory::NewStringFromUtf8(Vector<const char>(buffer_, length_)); | 284 return Factory::NewStringFromUtf8(Vector<const char>(buffer_, length_)); |
285 } | 285 } |
286 | 286 |
287 | 287 |
288 void StringStream::ClearMentionedObjectCache() { | 288 void StringStream::ClearMentionedObjectCache() { |
289 current_security_token = NULL; | 289 current_security_token = NULL; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 575 |
576 // Only grow once to the maximum allowable size. | 576 // Only grow once to the maximum allowable size. |
577 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 577 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
578 ASSERT(size_ >= *bytes); | 578 ASSERT(size_ >= *bytes); |
579 *bytes = size_; | 579 *bytes = size_; |
580 return space_; | 580 return space_; |
581 } | 581 } |
582 | 582 |
583 | 583 |
584 } } // namespace v8::internal | 584 } } // namespace v8::internal |
OLD | NEW |