d418dde65b
Add missing safepoint transitions. Issue #27092 Likely contributes to Issue #27010 dart2js hello Peak RSS at first Observatory visit -> Peak RSS after visiting timeline (with endless recorder) Before 215M -> 321M After 182M -> 233M R=johnmccutchan@google.com Review URL: https://codereview.chromium.org/2254543006 .
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef PLATFORM_TEXT_BUFFER_H_
|
|
#define PLATFORM_TEXT_BUFFER_H_
|
|
|
|
#include "vm/allocation.h"
|
|
#include "vm/globals.h"
|
|
|
|
namespace dart {
|
|
|
|
|
|
// TextBuffer maintains a dynamic character buffer with a printf-style way to
|
|
// append text.
|
|
class TextBuffer : ValueObject {
|
|
public:
|
|
explicit TextBuffer(intptr_t buf_size);
|
|
~TextBuffer();
|
|
|
|
intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
|
void AddChar(char ch);
|
|
void EscapeAndAddUTF16CodeUnit(uint16_t cu);
|
|
void EscapeAndAddCodeUnit(uint32_t cu);
|
|
void AddString(const char* s);
|
|
void AddEscapedString(const char* s);
|
|
void AddRaw(const uint8_t* buffer,
|
|
intptr_t buffer_length);
|
|
|
|
void Clear();
|
|
|
|
char* buf() { return buf_; }
|
|
intptr_t length() { return msg_len_; }
|
|
|
|
// Steal ownership of the buffer pointer.
|
|
// NOTE: TextBuffer is empty afterwards.
|
|
char* Steal();
|
|
|
|
private:
|
|
void EnsureCapacity(intptr_t len);
|
|
char* buf_;
|
|
intptr_t buf_size_;
|
|
intptr_t msg_len_;
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // PLATFORM_TEXT_BUFFER_H_
|