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 return isolate->factory()->NewStringFromUtf8( | 268 MaybeHandle<String> maybe_result = isolate->factory()->NewStringFromUtf8( |
269 Vector<const char>(buffer_, length_)); | 269 Vector<const char>(buffer_, length_)); |
| 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; |
270 } | 276 } |
271 | 277 |
272 | 278 |
273 void StringStream::ClearMentionedObjectCache(Isolate* isolate) { | 279 void StringStream::ClearMentionedObjectCache(Isolate* isolate) { |
274 isolate->set_string_stream_current_security_token(NULL); | 280 isolate->set_string_stream_current_security_token(NULL); |
275 if (isolate->string_stream_debug_object_cache() == NULL) { | 281 if (isolate->string_stream_debug_object_cache() == NULL) { |
276 isolate->set_string_stream_debug_object_cache(new DebugObjectCache(0)); | 282 isolate->set_string_stream_debug_object_cache(new DebugObjectCache(0)); |
277 } | 283 } |
278 isolate->string_stream_debug_object_cache()->Clear(); | 284 isolate->string_stream_debug_object_cache()->Clear(); |
279 } | 285 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 562 |
557 // Only grow once to the maximum allowable size. | 563 // Only grow once to the maximum allowable size. |
558 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 564 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
559 ASSERT(size_ >= *bytes); | 565 ASSERT(size_ >= *bytes); |
560 *bytes = size_; | 566 *bytes = size_; |
561 return space_; | 567 return space_; |
562 } | 568 } |
563 | 569 |
564 | 570 |
565 } } // namespace v8::internal | 571 } } // namespace v8::internal |
OLD | NEW |