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

Unified Diff: runtime/vm/object.cc

Issue 2899323002: Heap::kNew-space allocations discovered by experimental code called transitively from parser
Patch Set: Created 3 years, 7 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/isolate_reload.cc ('k') | no next file » | 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 546148d2668fed3a0ed6b203503f0ffa94db40fd..6ef9332fe925b057550261de0ee9a3259c15b325 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2894,7 +2894,7 @@ bool Class::ValidatePostFinalizePatch(const Class& orig_class,
*error = LanguageError::NewFormatted(
*error, // No previous error.
Script::Handle(script()), token_pos(), Report::AtLocation,
- Report::kError, Heap::kNew,
+ Report::kError, Heap::kOld,
"new fields are not allowed for this patch");
return false;
}
@@ -2903,7 +2903,7 @@ bool Class::ValidatePostFinalizePatch(const Class& orig_class,
*error = LanguageError::NewFormatted(*error, // No previous error.
Script::Handle(script()), token_pos(),
Report::AtLocation, Report::kError,
- Heap::kNew, "no functions to patch");
+ Heap::kOld, "no functions to patch");
return false;
}
// Iterate over all functions that will be patched and make sure
@@ -2926,7 +2926,7 @@ bool Class::ValidatePostFinalizePatch(const Class& orig_class,
*error = LanguageError::NewFormatted(
*error, // No previous error.
Script::Handle(script()), token_pos(), Report::AtLocation,
- Report::kError, Heap::kNew,
+ Report::kError, Heap::kOld,
!orig_func.is_external()
? "'%s' is not external and therefore cannot be patched"
: "'%s' has already executed and therefore cannot be patched",
@@ -2938,7 +2938,7 @@ bool Class::ValidatePostFinalizePatch(const Class& orig_class,
*error = LanguageError::NewFormatted(
*error, // No previous error.
Script::Handle(script()), token_pos(), Report::AtLocation,
- Report::kError, Heap::kNew,
+ Report::kError, Heap::kOld,
"'%s' is not private and therefore cannot be patched",
name.ToCString());
return false;
@@ -2974,15 +2974,15 @@ bool Class::ApplyPatch(const Class& patch, Error* error) const {
Function& orig_func = Function::Handle();
// Lookup the original implicit constructor, if any.
member_name = Name();
- member_name = String::Concat(member_name, Symbols::Dot());
+ member_name = String::Concat(member_name, Symbols::Dot(), Heap::kOld);
Function& orig_implicit_ctor = Function::Handle(LookupFunction(member_name));
if (!orig_implicit_ctor.IsNull() &&
!orig_implicit_ctor.IsImplicitConstructor()) {
// Not an implicit constructor, but a user declared one.
orig_implicit_ctor = Function::null();
}
- const GrowableObjectArray& new_functions =
- GrowableObjectArray::Handle(GrowableObjectArray::New(orig_len));
+ const GrowableObjectArray& new_functions = GrowableObjectArray::Handle(
+ GrowableObjectArray::New(orig_len, Heap::kOld));
for (intptr_t i = 0; i < orig_len; i++) {
orig_func ^= orig_list.At(i);
member_name ^= orig_func.name();
@@ -3015,11 +3015,11 @@ bool Class::ApplyPatch(const Class& patch, Error* error) const {
orig_implicit_ctor = Function::null();
}
func.set_owner(patch_class);
- new_functions.Add(func);
+ new_functions.Add(func, Heap::kOld);
}
if (!orig_implicit_ctor.IsNull()) {
// Preserve the original implicit constructor.
- new_functions.Add(orig_implicit_ctor);
+ new_functions.Add(orig_implicit_ctor, Heap::kOld);
}
Array& new_list = Array::Handle(Array::MakeArray(new_functions));
SetFunctions(new_list);
@@ -3033,7 +3033,7 @@ bool Class::ApplyPatch(const Class& patch, Error* error) const {
Field& field = Field::Handle();
Field& orig_field = Field::Handle();
- new_list = Array::New(patch_len + orig_len);
+ new_list = Array::New(patch_len + orig_len, Heap::kOld);
for (intptr_t i = 0; i < patch_len; i++) {
field ^= patch_list.At(i);
field.set_owner(patch_class);
@@ -3180,7 +3180,8 @@ void Class::SetFields(const Array& value) const {
void Class::AddField(const Field& field) const {
const Array& arr = Array::Handle(fields());
- const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1));
+ const Array& new_arr =
+ Array::Handle(Array::Grow(arr, arr.Length() + 1, Heap::kOld));
new_arr.SetAt(arr.Length(), field);
SetFields(new_arr);
}
@@ -5269,12 +5270,12 @@ RawString* TypeArguments::EnumerateURIs() const {
Zone* zone = thread->zone();
AbstractType& type = AbstractType::Handle(zone);
const intptr_t num_types = Length();
- const Array& pieces = Array::Handle(zone, Array::New(num_types));
+ const Array& pieces = Array::Handle(zone, Array::New(num_types, Heap::kOld));
for (intptr_t i = 0; i < num_types; i++) {
type = TypeAt(i);
pieces.SetAt(i, String::Handle(zone, type.EnumerateURIs()));
}
- return String::ConcatAll(pieces);
+ return String::ConcatAll(pieces, Heap::kOld);
}
@@ -7718,7 +7719,7 @@ void Field::SetOriginal(const Field& value) const {
RawString* Field::GetterName(const String& field_name) {
- return String::Concat(Symbols::GetterPrefix(), field_name);
+ return String::Concat(Symbols::GetterPrefix(), field_name, Heap::kOld);
}
@@ -8063,10 +8064,11 @@ RawInstance* Field::AccessorClosure(bool make_setter) const {
const char* field_name = String::Handle(zone, name()).ToCString();
String& expr_src = String::Handle(zone);
if (make_setter) {
- expr_src = String::NewFormatted("(%s_) { return %s = %s_; }", field_name,
- field_name, field_name);
+ expr_src = String::NewFormatted(Heap::kOld, "(%s_) { return %s = %s_; }",
+ field_name, field_name, field_name);
} else {
- expr_src = String::NewFormatted("() { return %s; }", field_name);
+ expr_src =
+ String::NewFormatted(Heap::kOld, "() { return %s; }", field_name);
}
Object& result =
Object::Handle(zone, field_owner.Evaluate(expr_src, Object::empty_array(),
@@ -9992,7 +9994,7 @@ void Library::AddPatchClass(const Class& cls) const {
ASSERT(GetPatchClass(String::Handle(cls.Name())) == Class::null());
const GrowableObjectArray& patch_classes =
GrowableObjectArray::Handle(this->patch_classes());
- patch_classes.Add(cls);
+ patch_classes.Add(cls, Heap::kOld);
}
@@ -10926,7 +10928,7 @@ void Library::AddImport(const Namespace& ns) const {
intptr_t capacity = imports.Length();
if (num_imports() == capacity) {
capacity = capacity + kImportsCapacityIncrement + (capacity >> 2);
- imports = Array::Grow(imports, capacity);
+ imports = Array::Grow(imports, capacity, Heap::kOld);
StorePointer(&raw_ptr()->imports_, imports.raw());
}
intptr_t index = num_imports();
@@ -10948,7 +10950,7 @@ bool Library::HasExports() const {
void Library::AddExport(const Namespace& ns) const {
Array& exports = Array::Handle(this->exports());
intptr_t num_exports = exports.Length();
- exports = Array::Grow(exports, num_exports + 1);
+ exports = Array::Grow(exports, num_exports + 1, Heap::kOld);
StorePointer(&raw_ptr()->exports_, exports.raw());
exports.SetAt(num_exports, ns);
}
@@ -10965,7 +10967,7 @@ static RawArray* NewDictionary(intptr_t initial_size) {
void Library::InitResolvedNamesCache() const {
ASSERT(Thread::Current()->IsMutatorThread());
StorePointer(&raw_ptr()->resolved_names_,
- HashTables::New<ResolvedNamesMap>(64));
+ HashTables::New<ResolvedNamesMap>(64, Heap::kOld));
}
@@ -10977,7 +10979,7 @@ void Library::ClearResolvedNamesCache() const {
void Library::InitExportedNamesCache() const {
StorePointer(&raw_ptr()->exported_names_,
- HashTables::New<ResolvedNamesMap>(16));
+ HashTables::New<ResolvedNamesMap>(16, Heap::kOld));
}
@@ -11308,7 +11310,7 @@ void Library::Register(Thread* thread) const {
GrowableObjectArray::Handle(zone, object_store->libraries());
ASSERT(!libs.IsNull());
set_index(libs.Length());
- libs.Add(*this);
+ libs.Add(*this, Heap::kOld);
// - A map from URL string to library.
if (object_store->libraries_map() == Array::null()) {
@@ -11705,7 +11707,7 @@ RawLibraryPrefix* LibraryPrefix::New(const String& name,
result.set_importer(importer);
result.StoreNonPointer(&result.raw_ptr()->is_deferred_load_, deferred_load);
result.StoreNonPointer(&result.raw_ptr()->is_loaded_, !deferred_load);
- result.set_imports(Array::Handle(Array::New(kInitialSize)));
+ result.set_imports(Array::Handle(Array::New(kInitialSize, Heap::kOld)));
result.AddImport(import);
return result.raw();
}
@@ -18172,7 +18174,7 @@ bool TypeParameter::CheckBound(const AbstractType& bounded_type,
// meaningless, therefore use the token index of this type parameter.
*bound_error = LanguageError::NewFormatted(
*bound_error, script, token_pos(), Report::AtLocation,
- Report::kMalboundedType, Heap::kNew,
+ Report::kMalboundedType, Heap::kOld,
"type parameter '%s' of class '%s' must extend bound '%s', "
"but type argument '%s' is not a subtype of '%s' where\n%s%s",
type_param_name.ToCString(), class_name.ToCString(),
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698