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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 | 245 |
246 void StringStream::Add(const char* format, FmtElm arg0, FmtElm arg1, | 246 void StringStream::Add(const char* format, FmtElm arg0, FmtElm arg1, |
247 FmtElm arg2, FmtElm arg3) { | 247 FmtElm arg2, FmtElm arg3) { |
248 const char argc = 4; | 248 const char argc = 4; |
249 FmtElm argv[argc] = { arg0, arg1, arg2, arg3 }; | 249 FmtElm argv[argc] = { arg0, arg1, arg2, arg3 }; |
250 Add(CStrVector(format), Vector<FmtElm>(argv, argc)); | 250 Add(CStrVector(format), Vector<FmtElm>(argv, argc)); |
251 } | 251 } |
252 | 252 |
253 | 253 |
254 SmartPointer<const char> StringStream::ToCString() { | 254 SmartPointer<const char> StringStream::ToCString() const { |
255 char* str = NewArray<char>(length_ + 1); | 255 char* str = NewArray<char>(length_ + 1); |
256 memcpy(str, buffer_, length_); | 256 memcpy(str, buffer_, length_); |
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 } |
(...skipping 310 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 |