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