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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2506993004: VM: [Kernel] Clone Field objects if building IL during background compilation. (Closed)
Patch Set: Created 4 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index 5490abbadf9b7717e6eef858d384bac97fe46854..c344d6d0b8605e07aad12593718c900f77580b17 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -2360,10 +2360,22 @@ Fragment FlowGraphBuilder::LoadClassId() {
}
+const dart::Field& MayCloneField(Zone* zone, const dart::Field& field) {
+ if ((Compiler::IsBackgroundCompilation() ||
+ FLAG_force_clone_compiler_objects) &&
+ field.IsOriginal()) {
+ return dart::Field::ZoneHandle(zone, field.CloneFromOriginal());
+ } else {
+ ASSERT(field.IsZoneHandle());
+ return field;
+ }
+}
+
+
Fragment FlowGraphBuilder::LoadField(const dart::Field& field) {
- LoadFieldInstr* load = new (Z)
- LoadFieldInstr(Pop(), &field, AbstractType::ZoneHandle(Z, field.type()),
- TokenPosition::kNoSource);
+ LoadFieldInstr* load = new (Z) LoadFieldInstr(
+ Pop(), &MayCloneField(Z, field),
+ AbstractType::ZoneHandle(Z, field.type()), TokenPosition::kNoSource);
Push(load);
return Fragment(load);
}
@@ -2409,7 +2421,8 @@ Fragment FlowGraphBuilder::LoadLocal(LocalVariable* variable) {
Fragment FlowGraphBuilder::InitStaticField(const dart::Field& field) {
- InitStaticFieldInstr* init = new (Z) InitStaticFieldInstr(Pop(), field);
+ InitStaticFieldInstr* init =
+ new (Z) InitStaticFieldInstr(Pop(), MayCloneField(Z, field));
return Fragment(init);
}
@@ -2527,23 +2540,26 @@ Fragment FlowGraphBuilder::StoreInstanceField(
if (value->BindsToConstant()) {
emit_store_barrier = kNoStoreBarrier;
}
- StoreInstanceFieldInstr* store = new (Z) StoreInstanceFieldInstr(
- field, Pop(), value, emit_store_barrier, TokenPosition::kNoSource);
+ StoreInstanceFieldInstr* store = new (Z)
+ StoreInstanceFieldInstr(MayCloneField(Z, field), Pop(), value,
+ emit_store_barrier, TokenPosition::kNoSource);
return Fragment(store);
}
Fragment FlowGraphBuilder::StoreInstanceFieldGuarded(const dart::Field& field) {
Fragment instructions;
+ const dart::Field& field_clone = MayCloneField(Z, field);
if (FLAG_use_field_guards) {
LocalVariable* store_expression = MakeTemporary();
instructions += LoadLocal(store_expression);
- instructions += GuardFieldClass(field, Thread::Current()->GetNextDeoptId());
+ instructions +=
+ GuardFieldClass(field_clone, Thread::Current()->GetNextDeoptId());
instructions += LoadLocal(store_expression);
instructions +=
- GuardFieldLength(field, Thread::Current()->GetNextDeoptId());
+ GuardFieldLength(field_clone, Thread::Current()->GetNextDeoptId());
}
- instructions += StoreInstanceField(field);
+ instructions += StoreInstanceField(field_clone);
return instructions;
}
@@ -2580,8 +2596,8 @@ Fragment FlowGraphBuilder::StoreLocal(LocalVariable* variable) {
Fragment FlowGraphBuilder::StoreStaticField(const dart::Field& field) {
- return Fragment(
- new (Z) StoreStaticFieldInstr(field, Pop(), TokenPosition::kNoSource));
+ return Fragment(new (Z) StoreStaticFieldInstr(MayCloneField(Z, field), Pop(),
+ TokenPosition::kNoSource));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698