| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "string-stream.h" | 5 #include "string-stream.h" |
| 6 | 6 |
| 7 #include "handles-inl.h" | 7 #include "handles-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 char save = buffer_[next]; | 258 char save = buffer_[next]; |
| 259 buffer_[next] = '\0'; | 259 buffer_[next] = '\0'; |
| 260 internal::PrintF(out, "%s", &buffer_[position]); | 260 internal::PrintF(out, "%s", &buffer_[position]); |
| 261 buffer_[next] = save; | 261 buffer_[next] = save; |
| 262 } | 262 } |
| 263 internal::PrintF(out, "%s", &buffer_[position]); | 263 internal::PrintF(out, "%s", &buffer_[position]); |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 |
| 267 Handle<String> StringStream::ToString(Isolate* isolate) { | 267 Handle<String> StringStream::ToString(Isolate* isolate) { |
| 268 MaybeHandle<String> maybe_result = isolate->factory()->NewStringFromUtf8( | 268 return isolate->factory()->NewStringFromUtf8( |
| 269 Vector<const char>(buffer_, length_)); | 269 Vector<const char>(buffer_, length_)).ToHandleChecked(); |
| 270 | |
| 271 // TODO(ishell): Temporarily returning null handle from here. I will proceed | |
| 272 // with maybehandlification in next CLs. | |
| 273 Handle<String> result; | |
| 274 if (!maybe_result.ToHandle(&result)) return Handle<String>(); | |
| 275 return result; | |
| 276 } | 270 } |
| 277 | 271 |
| 278 | 272 |
| 279 void StringStream::ClearMentionedObjectCache(Isolate* isolate) { | 273 void StringStream::ClearMentionedObjectCache(Isolate* isolate) { |
| 280 isolate->set_string_stream_current_security_token(NULL); | 274 isolate->set_string_stream_current_security_token(NULL); |
| 281 if (isolate->string_stream_debug_object_cache() == NULL) { | 275 if (isolate->string_stream_debug_object_cache() == NULL) { |
| 282 isolate->set_string_stream_debug_object_cache(new DebugObjectCache(0)); | 276 isolate->set_string_stream_debug_object_cache(new DebugObjectCache(0)); |
| 283 } | 277 } |
| 284 isolate->string_stream_debug_object_cache()->Clear(); | 278 isolate->string_stream_debug_object_cache()->Clear(); |
| 285 } | 279 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 556 |
| 563 // Only grow once to the maximum allowable size. | 557 // Only grow once to the maximum allowable size. |
| 564 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 558 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
| 565 ASSERT(size_ >= *bytes); | 559 ASSERT(size_ >= *bytes); |
| 566 *bytes = size_; | 560 *bytes = size_; |
| 567 return space_; | 561 return space_; |
| 568 } | 562 } |
| 569 | 563 |
| 570 | 564 |
| 571 } } // namespace v8::internal | 565 } } // namespace v8::internal |
| OLD | NEW |