Commit Graph

10 Commits

Author SHA1 Message Date
Tess Strickland 09ddcece30 [vm] Make BufferFormatter also a subclass of BaseTextBuffer.
Change-Id: I4d2759ffa80c0106838ad0ddbc6dd086fddda1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157742
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-08-07 21:40:45 +00:00
Tess Strickland fa03ee7782 [vm] Create a common base class for TextBuffer/ZoneTextBuffer.
Generally, methods that take a *TextBuffer pointer do not care how the
internal buffer is allocated, and so they could be used for either if
both were subclasses of a base class that contained the printing
methods.  This CL makes that base class, and now TextBuffer and
ZoneTextBuffer now share the exact same set of methods for printing to
the internal buffer.

Since the base class is in platform, this does mean dropping the
overload of AddString for Dart String objects that was part of
ZoneTextBuffer.  Instead, this CL just adds an intermediate call to
ToCString() for the small number of callers that used the overload,
keeping the printing interface the same for both.

In addition, one use of TextBuffer that then re-allocated the buffer
contents into the zone manually has been replaced with a ZoneTextBuffer
instead.

Change-Id: I438a085e7e20d55d93987fd7f36afd636f95955f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157741
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-08-07 18:09:35 +00:00
Ryan Macnak b5d657c3f0 [vm] Fix memory leaks during ELF generation.
Change-Id: I8c7d5506a91a4e2190951e083438fee652b736ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140371
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-24 01:09:35 +00:00
Ryan Macnak a067265272 [vm] Scrub and qualify names without allocating on the Dart heap.
Sometimes we needs to produce these names in a NoSafepointScope, such as when generating a snapshot.

Bug: https://github.com/dart-lang/sdk/issues/40143
Change-Id: I0d66134c936313b16c38f8699b33a7c7bd443e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133153
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-24 20:36:18 +00:00
Ryan Macnak 60de5b4983 [vm] Avoid quadratic growth in (Malloc)TextBuffer and ZoneTextBuffer.
In particular, avoid quadratic memory use in ZoneTextBuffer.

Change-Id: I8d2ea77d35cd3c2c353ae557a2ee676ee8413653
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95483
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-05 22:32:22 +00:00
Ryan Macnak 558a931409 [vm] Move some string utils from runtime/vm to runtime/platform.
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-01 02:07:46 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Ryan Macnak b15b98bcc3 Reapply "Use CodeSourceMap for stack traces (still JIT only)."
- Fix missing null termination in initialization of ZoneTextBuffer.
 - Merge with John's async stack trace changes.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2686813006 .
2017-02-09 18:03:41 -08:00
Ryan Macnak 15a9eafb77 Revert "Reapply "Use CodeSourceMap for stack traces (still JIT only).""
This reverts commit bee82fef8b.

Revert "Use zone memory for StackTrace::ToCString."

This reverts commit 4e8b265ea0.

The later CL somehow caused hangs in some service tests.

Review-Url: https://codereview.chromium.org/2683033007 .
2017-02-09 13:14:01 -08:00
Ryan Macnak 4e8b265ea0 Use zone memory for StackTrace::ToCString.
Fixes memory leak of the TextBuffer's buffer.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2689563003 .
2017-02-09 12:34:16 -08:00