@@ -2104,20 +2104,38 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
21042104
21052105LocationSummary* StoreStaticFieldInstr::MakeLocationSummary (Zone* zone,
21062106 bool opt) const {
2107- LocationSummary* locs =
2108- new (zone) LocationSummary (zone, 1 , 1 , LocationSummary::kNoCall );
2107+ const bool can_call_to_throw =
2108+ FLAG_experimental_shared_data && !field ().is_shared ();
2109+ LocationSummary* locs = new (zone)
2110+ LocationSummary (zone, 1 , 1 ,
2111+ can_call_to_throw ? LocationSummary::kCallOnSlowPath
2112+ : LocationSummary::kNoCall );
21092113 locs->set_in (0 , value ()->NeedsWriteBarrier () ? Location::WritableRegister ()
21102114 : Location::RequiresRegister ());
21112115 locs->set_temp (0 , Location::RequiresRegister ());
21122116 return locs;
21132117}
21142118
21152119void StoreStaticFieldInstr::EmitNativeCode (FlowGraphCompiler* compiler) {
2116- Register value = locs ()->in (0 ).reg ();
2120+ Register in = locs ()->in (0 ).reg ();
21172121 Register temp = locs ()->temp (0 ).reg ();
21182122
21192123 compiler->used_static_fields ().Add (&field ());
21202124
2125+ if (FLAG_experimental_shared_data && !field ().is_shared ()) {
2126+ ThrowErrorSlowPathCode* slow_path = new FieldAccessErrorSlowPath (this );
2127+ if (value ()->NeedsWriteBarrier ()) {
2128+ // Value input is a writable register and should be manually preserved
2129+ // across allocation slow-path. Add it to live_registers set which
2130+ // determines which registers to preserve.
2131+ locs ()->live_registers ()->Add (Location::RegisterLocation (in));
2132+ }
2133+ compiler->AddSlowPathCode (slow_path);
2134+
2135+ __ LoadIsolate (temp);
2136+ __ BranchIfZero (temp, slow_path->entry_label ());
2137+ }
2138+
21212139 __ movl (temp,
21222140 compiler::Address (
21232141 THR,
@@ -2127,7 +2145,7 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
21272145 // Note: static fields ids won't be changed by hot-reload.
21282146 __ movl (
21292147 compiler::Address (temp, compiler::target::FieldTable::OffsetOf (field ())),
2130- value );
2148+ in );
21312149}
21322150
21332151LocationSummary* InstanceOfInstr::MakeLocationSummary (Zone* zone,
0 commit comments