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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 1870343002: - Refactor Symbol allocation to expect a thread parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review feedback. Created 4 years, 8 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/cha_test.cc ('k') | runtime/vm/class_finalizer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 9497eab2d2e9625a4a653be9878863461c2c4339..1db03051a164a076847afb7bb13c2a246216395d 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -1709,7 +1709,8 @@ void ClassFinalizer::CloneMixinAppTypeParameters(const Class& mixin_app_class) {
for (intptr_t i = 0; i < num_super_type_params; i++) {
param ^= super_type_params.TypeAt(i);
param_name = param.name();
- param_name = Symbols::FromConcat(param_name, Symbols::Backtick());
+ param_name = Symbols::FromConcat(thread,
+ param_name, Symbols::Backtick());
cloned_param = TypeParameter::New(mixin_app_class,
cloned_index,
param_name,
@@ -1890,7 +1891,8 @@ void ClassFinalizer::ApplyMixinAppAlias(const Class& mixin_app_class,
// If this mixin alias is aliasing another mixin alias, another class
// will be inserted via recursion. No need to check here.
// The mixin type may or may not be finalized yet.
- Zone* zone = Thread::Current()->zone();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
AbstractType& super_type = AbstractType::Handle(zone,
mixin_app_class.super_type());
const Type& mixin_type = Type::Handle(zone, mixin_app_class.mixin());
@@ -1915,7 +1917,7 @@ void ClassFinalizer::ApplyMixinAppAlias(const Class& mixin_app_class,
Class& inserted_class = Class::Handle(zone,
library.LookupLocalClass(inserted_class_name));
if (inserted_class.IsNull()) {
- inserted_class_name = Symbols::New(inserted_class_name);
+ inserted_class_name = Symbols::New(thread, inserted_class_name);
const Script& script = Script::Handle(zone, mixin_app_class.script());
inserted_class = Class::New(
inserted_class_name, script, mixin_app_class.token_pos());
@@ -2144,21 +2146,23 @@ void ClassFinalizer::CreateForwardingConstructors(
const Class& mixin_app,
const Class& mixin_cls,
const GrowableObjectArray& cloned_funcs) {
- const String& mixin_name = String::Handle(mixin_app.Name());
- const Class& super_class = Class::Handle(mixin_app.SuperClass());
- const String& super_name = String::Handle(super_class.Name());
- const Array& functions = Array::Handle(super_class.functions());
+ Thread* T = Thread::Current();
+ Zone* Z = T->zone();
+ const String& mixin_name = String::Handle(Z, mixin_app.Name());
+ const Class& super_class = Class::Handle(Z, mixin_app.SuperClass());
+ const String& super_name = String::Handle(Z, super_class.Name());
+ const Array& functions = Array::Handle(Z, super_class.functions());
const intptr_t num_functions = functions.Length();
- Function& func = Function::Handle();
+ Function& func = Function::Handle(Z);
for (intptr_t i = 0; i < num_functions; i++) {
func ^= functions.At(i);
if (func.IsGenerativeConstructor()) {
// Build constructor name from mixin application class name
// and name of cloned super class constructor.
- const String& ctor_name = String::Handle(func.name());
- String& clone_name = String::Handle(
+ const String& ctor_name = String::Handle(Z, func.name());
+ String& clone_name = String::Handle(Z,
String::SubString(ctor_name, super_name.Length()));
- clone_name = Symbols::FromConcat(mixin_name, clone_name);
+ clone_name = Symbols::FromConcat(T, mixin_name, clone_name);
if (FLAG_trace_class_finalization) {
THR_Print("Cloning constructor '%s' as '%s'\n",
@@ -2170,9 +2174,9 @@ void ClassFinalizer::CreateForwardingConstructors(
// class. The source is the mixin class. The source may be needed
// to parse field initializer expressions in the mixin class.
const PatchClass& owner =
- PatchClass::Handle(PatchClass::New(mixin_app, mixin_cls));
+ PatchClass::Handle(Z, PatchClass::New(mixin_app, mixin_cls));
- const Function& clone = Function::Handle(
+ const Function& clone = Function::Handle(Z,
Function::New(clone_name,
func.kind(),
func.is_static(),
@@ -2191,11 +2195,11 @@ void ClassFinalizer::CreateForwardingConstructors(
const intptr_t num_parameters = func.NumParameters();
// The cloned ctor shares the parameter names array with the
// original.
- const Array& parameter_names = Array::Handle(func.parameter_names());
+ const Array& parameter_names = Array::Handle(Z, func.parameter_names());
ASSERT(parameter_names.Length() == num_parameters);
clone.set_parameter_names(parameter_names);
// The parameter types of the cloned constructor are 'dynamic'.
- clone.set_parameter_types(Array::Handle(Array::New(num_parameters)));
+ clone.set_parameter_types(Array::Handle(Z, Array::New(num_parameters)));
for (intptr_t n = 0; n < num_parameters; n++) {
clone.SetParameterTypeAt(n, Object::dynamic_type());
}
@@ -2726,7 +2730,8 @@ RawType* ClassFinalizer::ResolveMixinAppType(
const MixinAppType& mixin_app_type) {
// Lookup or create mixin application classes in the library of cls
// and resolve super type and mixin types.
- Zone* zone = Thread::Current()->zone();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
const Library& library = Library::Handle(zone, cls.library());
ASSERT(!library.IsNull());
const Script& script = Script::Handle(zone, cls.script());
@@ -2803,7 +2808,7 @@ RawType* ClassFinalizer::ResolveMixinAppType(
mixin_type_class_name);
mixin_app_class = library.LookupLocalClass(mixin_app_class_name);
if (mixin_app_class.IsNull()) {
- mixin_app_class_name = Symbols::New(mixin_app_class_name);
+ mixin_app_class_name = Symbols::New(thread, mixin_app_class_name);
mixin_app_class = Class::New(mixin_app_class_name,
script,
mixin_type.token_pos());
« no previous file with comments | « runtime/vm/cha_test.cc ('k') | runtime/vm/class_finalizer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698