OLD | NEW |
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/object_store.h" | 5 #include "vm/object_store.h" |
6 | 6 |
7 #include "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 root_library_(Library::null()), | 72 root_library_(Library::null()), |
73 typed_data_library_(Library::null()), | 73 typed_data_library_(Library::null()), |
74 vmservice_library_(Library::null()), | 74 vmservice_library_(Library::null()), |
75 libraries_(GrowableObjectArray::null()), | 75 libraries_(GrowableObjectArray::null()), |
76 closure_functions_(GrowableObjectArray::null()), | 76 closure_functions_(GrowableObjectArray::null()), |
77 pending_classes_(GrowableObjectArray::null()), | 77 pending_classes_(GrowableObjectArray::null()), |
78 pending_deferred_loads_(GrowableObjectArray::null()), | 78 pending_deferred_loads_(GrowableObjectArray::null()), |
79 resume_capabilities_(GrowableObjectArray::null()), | 79 resume_capabilities_(GrowableObjectArray::null()), |
80 exit_listeners_(GrowableObjectArray::null()), | 80 exit_listeners_(GrowableObjectArray::null()), |
81 error_listeners_(GrowableObjectArray::null()), | 81 error_listeners_(GrowableObjectArray::null()), |
| 82 sticky_error_(Error::null()), |
82 empty_context_(Context::null()), | 83 empty_context_(Context::null()), |
83 stack_overflow_(Instance::null()), | 84 stack_overflow_(Instance::null()), |
84 out_of_memory_(Instance::null()), | 85 out_of_memory_(Instance::null()), |
85 preallocated_unhandled_exception_(UnhandledException::null()), | 86 preallocated_unhandled_exception_(UnhandledException::null()), |
86 preallocated_stack_trace_(Stacktrace::null()), | 87 preallocated_stack_trace_(Stacktrace::null()), |
87 lookup_port_handler_(Function::null()), | 88 lookup_port_handler_(Function::null()), |
88 empty_uint32_array_(TypedData::null()), | 89 empty_uint32_array_(TypedData::null()), |
89 handle_message_function_(Function::null()), | 90 handle_message_function_(Function::null()), |
90 library_load_error_table_(Array::null()), | 91 library_load_error_table_(Array::null()), |
91 compile_time_constants_(Array::null()), | 92 compile_time_constants_(Array::null()), |
92 unique_dynamic_targets_(Array::null()), | 93 unique_dynamic_targets_(Array::null()), |
93 token_objects_(GrowableObjectArray::null()), | 94 token_objects_(GrowableObjectArray::null()), |
94 token_objects_map_(Array::null()), | 95 token_objects_map_(Array::null()), |
95 megamorphic_cache_table_(GrowableObjectArray::null()), | 96 megamorphic_cache_table_(GrowableObjectArray::null()), |
96 megamorphic_miss_code_(Code::null()), | 97 megamorphic_miss_code_(Code::null()), |
97 megamorphic_miss_function_(Function::null()) { | 98 megamorphic_miss_function_(Function::null()) { |
98 for (RawObject** current = from(); current <= to(); current++) { | 99 for (RawObject** current = from(); current <= to(); current++) { |
99 ASSERT(*current == Object::null()); | 100 ASSERT(*current == Object::null()); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 | 104 |
104 ObjectStore::~ObjectStore() { | 105 ObjectStore::~ObjectStore() { |
105 } | 106 } |
106 | 107 |
107 | 108 |
| 109 void ObjectStore::SetStickyErrorFromThread(const Thread* thread) { |
| 110 ASSERT(thread->IsMutatorThread()); |
| 111 if (thread->sticky_error() == Error::null()) { |
| 112 return; |
| 113 } |
| 114 // Protect overwriting valid error. |
| 115 ASSERT(sticky_error_ == Error::null()); |
| 116 sticky_error_ = thread->sticky_error(); |
| 117 } |
| 118 |
| 119 |
108 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 120 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
109 ASSERT(visitor != NULL); | 121 ASSERT(visitor != NULL); |
110 visitor->VisitPointers(from(), to()); | 122 visitor->VisitPointers(from(), to()); |
111 } | 123 } |
112 | 124 |
113 | 125 |
114 void ObjectStore::Init(Isolate* isolate) { | 126 void ObjectStore::Init(Isolate* isolate) { |
115 ASSERT(isolate->object_store() == NULL); | 127 ASSERT(isolate->object_store() == NULL); |
116 ObjectStore* store = new ObjectStore(); | 128 ObjectStore* store = new ObjectStore(); |
117 isolate->set_object_store(store); | 129 isolate->set_object_store(store); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 cls = async_lib.LookupClass(Symbols::StreamIterator()); | 212 cls = async_lib.LookupClass(Symbols::StreamIterator()); |
201 ASSERT(!cls.IsNull()); | 213 ASSERT(!cls.IsNull()); |
202 set_stream_iterator_class(cls); | 214 set_stream_iterator_class(cls); |
203 | 215 |
204 const Library& internal_lib = Library::Handle(internal_library()); | 216 const Library& internal_lib = Library::Handle(internal_library()); |
205 cls = internal_lib.LookupClass(Symbols::Symbol()); | 217 cls = internal_lib.LookupClass(Symbols::Symbol()); |
206 set_symbol_class(cls); | 218 set_symbol_class(cls); |
207 } | 219 } |
208 | 220 |
209 } // namespace dart | 221 } // namespace dart |
OLD | NEW |