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

Unified Diff: runtime/vm/isolate_reload.cc

Issue 2194333002: RELOAD: Maintain identity of static tear-offs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate_reload.cc
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 9a67be9f5369bfc3a842bc4857c033dc03e9fc69..eabaf2e550234a0b469e31d8769066c854bcddb3 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -960,9 +960,14 @@ void IsolateReloadContext::Commit() {
// Copy static field values from the old classes to the new classes.
// Patch fields and functions in the old classes so that they retain
// the old script.
- Class& cls = Class::Handle();
+ Class& old_cls = Class::Handle();
Class& new_cls = Class::Handle();
-
+ Array& functions = Array::Handle();
+ Function& old_func = Function::Handle();
+ String& selector = String::Handle();
+ Function& new_func = Function::Handle();
+ Instance& old_closure = Instance::Handle();
+ Instance& new_closure = Instance::Handle();
UnorderedHashMap<ClassMapTraits> class_map(class_map_storage_);
{
@@ -970,15 +975,33 @@ void IsolateReloadContext::Commit() {
while (it.MoveNext()) {
const intptr_t entry = it.Current();
new_cls = Class::RawCast(class_map.GetKey(entry));
- cls = Class::RawCast(class_map.GetPayload(entry, 0));
- if (new_cls.raw() != cls.raw()) {
- ASSERT(new_cls.is_enum_class() == cls.is_enum_class());
+ old_cls = Class::RawCast(class_map.GetPayload(entry, 0));
+ if (new_cls.raw() != old_cls.raw()) {
+ ASSERT(new_cls.is_enum_class() == old_cls.is_enum_class());
if (new_cls.is_enum_class() && new_cls.is_finalized()) {
- new_cls.ReplaceEnum(cls);
+ new_cls.ReplaceEnum(old_cls);
} else {
- new_cls.CopyStaticFieldValues(cls);
+ new_cls.CopyStaticFieldValues(old_cls);
+ }
+ old_cls.PatchFieldsAndFunctions();
+
+ // Map implicit static closures.
+ functions = old_cls.functions();
Cutch 2016/08/01 22:26:04 please factor this into a function that lives in o
rmacnak 2016/08/02 00:43:45 Done.
+ for (intptr_t i = 0; i < functions.Length(); i++) {
+ old_func ^= functions.At(i);
+ if (old_func.is_static() &&
+ old_func.HasImplicitClosureFunction()) {
+ selector = old_func.name();
+ new_func = new_cls.LookupFunction(selector);
+ if (!new_func.IsNull() && new_func.is_static()) {
+ old_func = old_func.ImplicitClosureFunction();
+ old_closure = old_func.ImplicitStaticClosure();
+ new_func = new_func.ImplicitClosureFunction();
+ new_closure = new_func.ImplicitStaticClosure();
+ AddBecomeMapping(old_closure, new_closure);
+ }
+ }
}
turnidge 2016/08/01 21:04:28 Perhaps this should be implemented in a separate f
- cls.PatchFieldsAndFunctions();
}
}
}
« no previous file with comments | « no previous file | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698