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

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 1672853002: Move sticky_error_ from isolate to thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments addressed Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 // Processing ObjectStore::pending_classes_ occurs: 117 // Processing ObjectStore::pending_classes_ occurs:
118 // a) when bootstrap process completes (VerifyBootstrapClasses). 118 // a) when bootstrap process completes (VerifyBootstrapClasses).
119 // b) after the user classes are loaded (dart_api). 119 // b) after the user classes are loaded (dart_api).
120 bool ClassFinalizer::ProcessPendingClasses() { 120 bool ClassFinalizer::ProcessPendingClasses() {
121 Thread* thread = Thread::Current(); 121 Thread* thread = Thread::Current();
122 Isolate* isolate = thread->isolate(); 122 Isolate* isolate = thread->isolate();
123 ASSERT(isolate != NULL); 123 ASSERT(isolate != NULL);
124 HANDLESCOPE(thread); 124 HANDLESCOPE(thread);
125 ObjectStore* object_store = isolate->object_store(); 125 ObjectStore* object_store = isolate->object_store();
126 const Error& error = 126 const Error& error = Error::Handle(thread->zone(), thread->sticky_error());
127 Error::Handle(thread->zone(), object_store->sticky_error());
128 if (!error.IsNull()) { 127 if (!error.IsNull()) {
129 return false; 128 return false;
130 } 129 }
131 if (AllClassesFinalized()) { 130 if (AllClassesFinalized()) {
132 return true; 131 return true;
133 } 132 }
134 133
135 LongJumpScope jump; 134 LongJumpScope jump;
136 if (setjmp(*jump.Set()) == 0) { 135 if (setjmp(*jump.Set()) == 0) {
137 GrowableObjectArray& class_array = GrowableObjectArray::Handle(); 136 GrowableObjectArray& class_array = GrowableObjectArray::Handle();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (cls.is_finalized() || cls.is_prefinalized()) { 234 if (cls.is_finalized() || cls.is_prefinalized()) {
236 // Pre-finalized bootstrap classes must not define any fields. 235 // Pre-finalized bootstrap classes must not define any fields.
237 ASSERT(!cls.HasInstanceFields()); 236 ASSERT(!cls.HasInstanceFields());
238 } 237 }
239 } 238 }
240 239
241 // Finalize type hierarchy for types that aren't pre-finalized 240 // Finalize type hierarchy for types that aren't pre-finalized
242 // by Object::Init(). 241 // by Object::Init().
243 if (!ProcessPendingClasses()) { 242 if (!ProcessPendingClasses()) {
244 // TODO(srdjan): Exit like a real VM instead. 243 // TODO(srdjan): Exit like a real VM instead.
245 const Error& err = Error::Handle(object_store->sticky_error()); 244 const Error& err = Error::Handle(Thread::Current()->sticky_error());
246 OS::PrintErr("Could not verify bootstrap classes : %s\n", 245 OS::PrintErr("Could not verify bootstrap classes : %s\n",
247 err.ToErrorCString()); 246 err.ToErrorCString());
248 OS::Exit(255); 247 OS::Exit(255);
249 } 248 }
250 if (FLAG_trace_class_finalization) { 249 if (FLAG_trace_class_finalization) {
251 OS::Print("VerifyBootstrapClasses END.\n"); 250 OS::Print("VerifyBootstrapClasses END.\n");
252 } 251 }
253 Isolate::Current()->heap()->Verify(); 252 Isolate::Current()->heap()->Verify();
254 } 253 }
255 #endif // defined(DART_NO_SNAPSHOT). 254 #endif // defined(DART_NO_SNAPSHOT).
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3293 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3295 field ^= fields_array.At(0); 3294 field ^= fields_array.At(0);
3296 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3295 ASSERT(field.Offset() == ByteBuffer::data_offset());
3297 name ^= field.name(); 3296 name ^= field.name();
3298 expected_name ^= String::New("_data"); 3297 expected_name ^= String::New("_data");
3299 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3298 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3300 #endif 3299 #endif
3301 } 3300 }
3302 3301
3303 } // namespace dart 3302 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698