| Index: runtime/vm/report.cc
|
| diff --git a/runtime/vm/report.cc b/runtime/vm/report.cc
|
| index 5637adce8be48654cec843bf41c316bed98b9e09..f1cf49508a1c40c470a1a9de33a5cb8beef74354 100644
|
| --- a/runtime/vm/report.cc
|
| +++ b/runtime/vm/report.cc
|
| @@ -46,42 +46,54 @@ RawString* Report::PrependSnippet(Kind kind,
|
| // Only report the line position if we have the original source. We still
|
| // need to get a valid column so that we can report the ^ mark below the
|
| // snippet.
|
| + // Allocate formatted strings in old sapce as they may be created during
|
| + // optimizing compilation. Those strings are created rarely and should not
|
| + // polute old space.
|
| if (script.HasSource()) {
|
| - result = String::NewFormatted("'%s': %s: line %" Pd " pos %" Pd ": ",
|
| + result = String::NewFormatted(Heap::kOld,
|
| + "'%s': %s: line %" Pd " pos %" Pd ": ",
|
| script_url.ToCString(),
|
| message_header,
|
| line,
|
| column);
|
| } else {
|
| - result = String::NewFormatted("'%s': %s: line %" Pd ": ",
|
| + result = String::NewFormatted(Heap::kOld,
|
| + "'%s': %s: line %" Pd ": ",
|
| script_url.ToCString(),
|
| message_header,
|
| line);
|
| }
|
| // Append the formatted error or warning message.
|
| - result = String::Concat(result, message);
|
| + GrowableHandlePtrArray<const String> strs(Thread::Current()->zone(), 5);
|
| + strs.Add(result);
|
| + strs.Add(message);
|
| // Append the source line.
|
| - const String& script_line = String::Handle(script.GetLine(line));
|
| + const String& script_line = String::Handle(
|
| + script.GetLine(line, Heap::kOld));
|
| ASSERT(!script_line.IsNull());
|
| - result = String::Concat(result, Symbols::NewLine());
|
| - result = String::Concat(result, script_line);
|
| - result = String::Concat(result, Symbols::NewLine());
|
| + strs.Add(Symbols::NewLine());
|
| + strs.Add(script_line);
|
| + strs.Add(Symbols::NewLine());
|
| // Append the column marker.
|
| const String& column_line = String::Handle(
|
| - String::NewFormatted("%*s\n", static_cast<int>(column), "^"));
|
| - result = String::Concat(result, column_line);
|
| + String::NewFormatted(Heap::kOld,
|
| + "%*s\n", static_cast<int>(column), "^"));
|
| + strs.Add(column_line);
|
| + // TODO(srdjan): Use Strings::FromConcatAll in old space, once
|
| + // implemented.
|
| + result = Symbols::FromConcatAll(strs);
|
| } else {
|
| // Token position is unknown.
|
| - result = String::NewFormatted("'%s': %s: ",
|
| + result = String::NewFormatted(Heap::kOld, "'%s': %s: ",
|
| script_url.ToCString(),
|
| message_header);
|
| - result = String::Concat(result, message);
|
| + result = String::Concat(result, message, Heap::kOld);
|
| }
|
| } else {
|
| // Script is unknown.
|
| // Append the formatted error or warning message.
|
| - result = String::NewFormatted("%s: ", message_header);
|
| - result = String::Concat(result, message);
|
| + result = String::NewFormatted(Heap::kOld, "%s: ", message_header);
|
| + result = String::Concat(result, message, Heap::kOld);
|
| }
|
| return result.raw();
|
| }
|
|
|