| 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 #ifndef V8_STRING_STREAM_H_ | 5 #ifndef V8_STRING_STREAM_H_ |
| 6 #define V8_STRING_STREAM_H_ | 6 #define V8_STRING_STREAM_H_ |
| 7 | 7 |
| 8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 // Reset the stream. | 127 // Reset the stream. |
| 128 void Reset() { | 128 void Reset() { |
| 129 length_ = 0; | 129 length_ = 0; |
| 130 buffer_[0] = 0; | 130 buffer_[0] = 0; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Mentioned object cache support. | 133 // Mentioned object cache support. |
| 134 void PrintMentionedObjectCache(Isolate* isolate); | 134 void PrintMentionedObjectCache(Isolate* isolate); |
| 135 static void ClearMentionedObjectCache(Isolate* isolate); | 135 static void ClearMentionedObjectCache(Isolate* isolate); |
| 136 #ifdef DEBUG | 136 #if DCHECK_IS_ON |
| 137 static bool IsMentionedObjectCacheClear(Isolate* isolate); | 137 static bool IsMentionedObjectCacheClear(Isolate* isolate); |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 static const int kInitialCapacity = 16; | 140 static const int kInitialCapacity = 16; |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 void PrintObject(Object* obj); | 143 void PrintObject(Object* obj); |
| 144 | 144 |
| 145 StringAllocator* allocator_; | 145 StringAllocator* allocator_; |
| 146 unsigned capacity_; | 146 unsigned capacity_; |
| 147 unsigned length_; // does not include terminating 0-character | 147 unsigned length_; // does not include terminating 0-character |
| 148 char* buffer_; | 148 char* buffer_; |
| 149 | 149 |
| 150 bool full() const { return (capacity_ - length_) == 1; } | 150 bool full() const { return (capacity_ - length_) == 1; } |
| 151 int space() const { return capacity_ - length_; } | 151 int space() const { return capacity_ - length_; } |
| 152 | 152 |
| 153 DISALLOW_IMPLICIT_CONSTRUCTORS(StringStream); | 153 DISALLOW_IMPLICIT_CONSTRUCTORS(StringStream); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } } // namespace v8::internal | 156 } } // namespace v8::internal |
| 157 | 157 |
| 158 #endif // V8_STRING_STREAM_H_ | 158 #endif // V8_STRING_STREAM_H_ |
| OLD | NEW |