Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(864)

Unified Diff: src/string-stream.h

Issue 1149623010: Print and save JS stacktrace on OOM crash. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string-stream.h
diff --git a/src/string-stream.h b/src/string-stream.h
index b8828ee620405c13dcd43ea2b199f9470cb22508..cc50bb7150eb9f605340456448eefd63bdf35dd4 100644
--- a/src/string-stream.h
+++ b/src/string-stream.h
@@ -35,6 +35,21 @@ class HeapStringAllocator final : public StringAllocator {
};
+class FixedStringAllocator final : public StringAllocator {
+ public:
+ FixedStringAllocator(char* buffer, unsigned length)
+ : buffer_(buffer), length_(length) {}
+ ~FixedStringAllocator() override{};
+ char* allocate(unsigned bytes) override;
+ char* grow(unsigned* bytes) override;
+
+ private:
+ char* buffer_;
+ unsigned length_;
+ DISALLOW_COPY_AND_ASSIGN(FixedStringAllocator);
+};
+
+
class FmtElm final {
public:
FmtElm(int value) : type_(INT) { // NOLINT
@@ -77,11 +92,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 };
+ StringStream(StringAllocator* allocator,
+ 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 +152,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 +161,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_;
« no previous file with comments | « src/isolate.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698