Index: src/string-stream.h |
diff --git a/src/string-stream.h b/src/string-stream.h |
index b8828ee620405c13dcd43ea2b199f9470cb22508..92876c8c226bed3821b6f0e0a7374ab9a721367e 100644 |
--- a/src/string-stream.h |
+++ b/src/string-stream.h |
@@ -35,6 +35,20 @@ class HeapStringAllocator final : public StringAllocator { |
}; |
+class FixedStringAllocator final : public StringAllocator { |
+ public: |
+ FixedStringAllocator(char* buffer, unsigned length) |
+ : buffer_(buffer), length_(length) {} |
+ ~FixedStringAllocator() {} |
jochen (gone - plz use gerrit)
2015/06/05 16:03:43
override
|
+ char* allocate(unsigned bytes) override; |
+ char* grow(unsigned* bytes) override; |
+ |
+ private: |
+ char* buffer_; |
+ unsigned length_; |
+}; |
jochen (gone - plz use gerrit)
2015/06/05 16:03:43
disallow copy/assign
|
+ |
+ |
class FmtElm final { |
public: |
FmtElm(int value) : type_(INT) { // NOLINT |
@@ -77,11 +91,14 @@ class FmtElm final { |
class StringStream final { |
public: |
- explicit StringStream(StringAllocator* allocator): |
- allocator_(allocator), |
- capacity_(kInitialCapacity), |
- length_(0), |
- buffer_(allocator_->allocate(kInitialCapacity)) { |
+ enum ObjectPrintMode { kPrintObjectConcise, kPrintObjectVerbose }; |
+ explicit StringStream(StringAllocator* allocator, |
jochen (gone - plz use gerrit)
2015/06/05 16:03:43
no explicit
|
+ ObjectPrintMode object_print_mode = kPrintObjectConcise) |
+ : allocator_(allocator), |
+ object_print_mode_(object_print_mode), |
+ capacity_(kInitialCapacity), |
+ length_(0), |
+ buffer_(allocator_->allocate(kInitialCapacity)) { |
buffer_[0] = 0; |
} |
@@ -134,7 +151,7 @@ class StringStream final { |
void PrintMentionedObjectCache(Isolate* isolate); |
static void ClearMentionedObjectCache(Isolate* isolate); |
#ifdef DEBUG |
- static bool IsMentionedObjectCacheClear(Isolate* isolate); |
+ bool IsMentionedObjectCacheClear(Isolate* isolate); |
#endif |
static const int kInitialCapacity = 16; |
@@ -143,6 +160,7 @@ class StringStream final { |
void PrintObject(Object* obj); |
StringAllocator* allocator_; |
+ ObjectPrintMode object_print_mode_; |
unsigned capacity_; |
unsigned length_; // does not include terminating 0-character |
char* buffer_; |