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

Unified Diff: runtime/vm/object.cc

Issue 1368173002: Do not eagerly finalize when optimizing. Remove allocation of temporary strings in new space. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Improve comments Created 5 years, 3 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 | « runtime/vm/object.h ('k') | runtime/vm/report.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 868ef91e882c433878702abf3d5e082c324b80e6..eb976a9504e0f5c47f7187e93f17475c051197e7 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -4449,10 +4449,12 @@ RawString* UnresolvedClass::Name() const {
const LibraryPrefix& lib_prefix = LibraryPrefix::Handle(library_prefix());
String& name = String::Handle();
name = lib_prefix.name(); // Qualifier.
- name = String::Concat(name, Symbols::Dot());
- const String& str = String::Handle(ident());
- name = String::Concat(name, str);
- return name.raw();
+ Zone* zone = Thread::Current()->zone();
+ GrowableHandlePtrArray<const String> strs(zone, 3);
+ strs.Add(name);
+ strs.Add(Symbols::Dot());
+ strs.Add(String::Handle(zone, ident()));
+ return Symbols::FromConcatAll(strs);
} else {
return ident();
}
@@ -8736,7 +8738,7 @@ void Script::TokenRangeAtLine(intptr_t line_number,
}
-RawString* Script::GetLine(intptr_t line_number) const {
+RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const {
const String& src = String::Handle(Source());
intptr_t relative_line_number = line_number - line_offset();
intptr_t current_line = 1;
@@ -8763,7 +8765,8 @@ RawString* Script::GetLine(intptr_t line_number) const {
if (line_start_idx >= 0) {
return String::SubString(src,
line_start_idx,
- last_char_idx - line_start_idx + 1);
+ last_char_idx - line_start_idx + 1,
+ space);
} else {
return Symbols::Empty().raw();
}
@@ -14051,7 +14054,8 @@ RawLanguageError* LanguageError::NewFormattedV(const Error& prev_error,
result.set_script(script);
result.set_token_pos(token_pos);
result.set_kind(kind);
- result.set_message(String::Handle(String::NewFormattedV(format, args)));
+ result.set_message(String::Handle(
+ String::NewFormattedV(format, args, space)));
return result.raw();
}
@@ -16200,12 +16204,13 @@ RawAbstractType* TypeParameter::InstantiateFrom(
bool TypeParameter::CheckBound(const AbstractType& bounded_type,
const AbstractType& upper_bound,
- Error* bound_error) const {
+ Error* bound_error,
+ Heap::Space space) const {
ASSERT((bound_error != NULL) && bound_error->IsNull());
ASSERT(bounded_type.IsFinalized());
ASSERT(upper_bound.IsFinalized());
ASSERT(!bounded_type.IsMalformed());
- if (bounded_type.IsSubtypeOf(upper_bound, bound_error)) {
+ if (bounded_type.IsSubtypeOf(upper_bound, bound_error, space)) {
return true;
}
// Set bound_error if the caller is interested and if this is the first error.
@@ -18790,7 +18795,18 @@ RawString* String::NewFormatted(const char* format, ...) {
}
-RawString* String::NewFormattedV(const char* format, va_list args) {
+RawString* String::NewFormatted(Heap::Space space, const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ RawString* result = NewFormattedV(format, args, space);
+ NoSafepointScope no_safepoint;
+ va_end(args);
+ return result;
+}
+
+
+RawString* String::NewFormattedV(const char* format, va_list args,
+ Heap::Space space) {
va_list args_copy;
va_copy(args_copy, args);
intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy);
@@ -18800,7 +18816,7 @@ RawString* String::NewFormattedV(const char* format, va_list args) {
char* buffer = zone->Alloc<char>(len + 1);
OS::VSNPrint(buffer, (len + 1), format, args);
- return String::New(buffer);
+ return String::New(buffer, space);
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/report.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698