@@ -91,14 +91,26 @@ void StubCodeCompiler::GenerateInitLateStaticFieldStub(bool is_final,
9191
9292 __ EnterStubFrame ();
9393
94+ if (FLAG_experimental_shared_data && is_shared) {
95+ // Since initialization of shared fields has to be guarded by
96+ // a mutex, do the initialization in the runtime.
97+ __ PushObject (NullObject ()); // Make room for the result
98+ __ PushRegister (kFieldReg );
99+ __ CallRuntime (kInitializeSharedFieldRuntimeEntry , /* argument_count=*/ 1 );
100+ __ PopRegister (kFieldReg );
101+ __ PopRegister (kResultReg );
102+ __ LeaveStubFrame ();
103+ __ Ret ();
104+ return ;
105+ }
106+
94107 Label throw_since_no_isolate_is_present;
95108 if (FLAG_experimental_shared_data) {
96- if (!is_shared) {
97- // This stub is also called from mutator thread running without an
98- // isolate and attempts to load value from isolate static field.
99- __ LoadIsolate (kScratchReg );
100- __ BranchIfZero (kScratchReg , &throw_since_no_isolate_is_present);
101- }
109+ ASSERT (!is_shared);
110+ // This stub is also called from mutator thread running without an
111+ // isolate and attempts to load value from isolate static field.
112+ __ LoadIsolate (kScratchReg );
113+ __ BranchIfZero (kScratchReg , &throw_since_no_isolate_is_present);
102114 }
103115
104116 __ Comment (" Calling initializer function" );
@@ -143,20 +155,19 @@ void StubCodeCompiler::GenerateInitLateStaticFieldStub(bool is_final,
143155 }
144156
145157 if (FLAG_experimental_shared_data) {
146- if (!is_shared) {
158+ ASSERT (!is_shared);
147159#if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
148- // We are jumping over LeaveStubFrame so restore LR state to match one
149- // at the jump point.
150- __ set_lr_state (compiler::LRState::OnEntry ().EnterFrame ());
160+ // We are jumping over LeaveStubFrame so restore LR state to match one
161+ // at the jump point.
162+ __ set_lr_state (compiler::LRState::OnEntry ().EnterFrame ());
151163#endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
152- // Throw FieldAccessError
153- __ Bind (&throw_since_no_isolate_is_present);
154- __ PushObject (NullObject ()); // Make room for (unused) result.
155- __ PushRegister (kFieldReg );
156- __ CallRuntime (kStaticFieldAccessedWithoutIsolateErrorRuntimeEntry ,
157- /* argument_count=*/ 1 );
158- __ Breakpoint ();
159- }
164+ // Throw FieldAccessError
165+ __ Bind (&throw_since_no_isolate_is_present);
166+ __ PushObject (NullObject ()); // Make room for (unused) result.
167+ __ PushRegister (kFieldReg );
168+ __ CallRuntime (kStaticFieldAccessedWithoutIsolateErrorRuntimeEntry ,
169+ /* argument_count=*/ 1 );
170+ __ Breakpoint ();
160171 }
161172}
162173
@@ -172,10 +183,6 @@ void StubCodeCompiler::GenerateInitSharedLateStaticFieldStub() {
172183 GenerateInitLateStaticFieldStub (/* is_final=*/ false , /* is_shared=*/ true );
173184}
174185
175- void StubCodeCompiler::GenerateInitSharedLateFinalStaticFieldStub () {
176- GenerateInitLateStaticFieldStub (/* is_final=*/ true , /* is_shared=*/ true );
177- }
178-
179186void StubCodeCompiler::GenerateInitInstanceFieldStub () {
180187 __ EnterStubFrame ();
181188 __ PushObject (NullObject ()); // Make room for result.
0 commit comments