| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 closure_functions_(GrowableObjectArray::null()), | 79 closure_functions_(GrowableObjectArray::null()), |
| 80 pending_classes_(GrowableObjectArray::null()), | 80 pending_classes_(GrowableObjectArray::null()), |
| 81 pending_deferred_loads_(GrowableObjectArray::null()), | 81 pending_deferred_loads_(GrowableObjectArray::null()), |
| 82 resume_capabilities_(GrowableObjectArray::null()), | 82 resume_capabilities_(GrowableObjectArray::null()), |
| 83 exit_listeners_(GrowableObjectArray::null()), | 83 exit_listeners_(GrowableObjectArray::null()), |
| 84 error_listeners_(GrowableObjectArray::null()), | 84 error_listeners_(GrowableObjectArray::null()), |
| 85 empty_context_(Context::null()), | 85 empty_context_(Context::null()), |
| 86 stack_overflow_(Instance::null()), | 86 stack_overflow_(Instance::null()), |
| 87 out_of_memory_(Instance::null()), | 87 out_of_memory_(Instance::null()), |
| 88 preallocated_unhandled_exception_(UnhandledException::null()), | 88 preallocated_unhandled_exception_(UnhandledException::null()), |
| 89 preallocated_stack_trace_(Stacktrace::null()), | 89 preallocated_stack_trace_(StackTrace::null()), |
| 90 lookup_port_handler_(Function::null()), | 90 lookup_port_handler_(Function::null()), |
| 91 empty_uint32_array_(TypedData::null()), | 91 empty_uint32_array_(TypedData::null()), |
| 92 handle_message_function_(Function::null()), | 92 handle_message_function_(Function::null()), |
| 93 simple_instance_of_function_(Function::null()), | 93 simple_instance_of_function_(Function::null()), |
| 94 simple_instance_of_true_function_(Function::null()), | 94 simple_instance_of_true_function_(Function::null()), |
| 95 simple_instance_of_false_function_(Function::null()), | 95 simple_instance_of_false_function_(Function::null()), |
| 96 library_load_error_table_(Array::null()), | 96 library_load_error_table_(Array::null()), |
| 97 unique_dynamic_targets_(Array::null()), | 97 unique_dynamic_targets_(Array::null()), |
| 98 token_objects_(GrowableObjectArray::null()), | 98 token_objects_(GrowableObjectArray::null()), |
| 99 token_objects_map_(Array::null()), | 99 token_objects_map_(Array::null()), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 #endif // !PRODUCT | 142 #endif // !PRODUCT |
| 143 | 143 |
| 144 | 144 |
| 145 RawError* ObjectStore::PreallocateObjects() { | 145 RawError* ObjectStore::PreallocateObjects() { |
| 146 Thread* thread = Thread::Current(); | 146 Thread* thread = Thread::Current(); |
| 147 Isolate* isolate = thread->isolate(); | 147 Isolate* isolate = thread->isolate(); |
| 148 Zone* zone = thread->zone(); | 148 Zone* zone = thread->zone(); |
| 149 ASSERT(isolate != NULL && isolate->object_store() == this); | 149 ASSERT(isolate != NULL && isolate->object_store() == this); |
| 150 if (this->stack_overflow() != Instance::null()) { | 150 if (this->stack_overflow() != Instance::null()) { |
| 151 ASSERT(this->out_of_memory() != Instance::null()); | 151 ASSERT(this->out_of_memory() != Instance::null()); |
| 152 ASSERT(this->preallocated_stack_trace() != Stacktrace::null()); | 152 ASSERT(this->preallocated_stack_trace() != StackTrace::null()); |
| 153 return Error::null(); | 153 return Error::null(); |
| 154 } | 154 } |
| 155 ASSERT(this->stack_overflow() == Instance::null()); | 155 ASSERT(this->stack_overflow() == Instance::null()); |
| 156 ASSERT(this->out_of_memory() == Instance::null()); | 156 ASSERT(this->out_of_memory() == Instance::null()); |
| 157 ASSERT(this->preallocated_stack_trace() == Stacktrace::null()); | 157 ASSERT(this->preallocated_stack_trace() == StackTrace::null()); |
| 158 | 158 |
| 159 this->pending_deferred_loads_ = GrowableObjectArray::New(); | 159 this->pending_deferred_loads_ = GrowableObjectArray::New(); |
| 160 | 160 |
| 161 this->closure_functions_ = GrowableObjectArray::New(); | 161 this->closure_functions_ = GrowableObjectArray::New(); |
| 162 this->resume_capabilities_ = GrowableObjectArray::New(); | 162 this->resume_capabilities_ = GrowableObjectArray::New(); |
| 163 this->exit_listeners_ = GrowableObjectArray::New(); | 163 this->exit_listeners_ = GrowableObjectArray::New(); |
| 164 this->error_listeners_ = GrowableObjectArray::New(); | 164 this->error_listeners_ = GrowableObjectArray::New(); |
| 165 | 165 |
| 166 Object& result = Object::Handle(); | 166 Object& result = Object::Handle(); |
| 167 const Library& library = Library::Handle(Library::CoreLibrary()); | 167 const Library& library = Library::Handle(Library::CoreLibrary()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 179 Symbols::Dot(), Object::empty_array()); | 179 Symbols::Dot(), Object::empty_array()); |
| 180 if (result.IsError()) { | 180 if (result.IsError()) { |
| 181 return Error::Cast(result).raw(); | 181 return Error::Cast(result).raw(); |
| 182 } | 182 } |
| 183 set_out_of_memory(Instance::Cast(result)); | 183 set_out_of_memory(Instance::Cast(result)); |
| 184 | 184 |
| 185 // Allocate pre-allocated unhandled exception object initialized with the | 185 // Allocate pre-allocated unhandled exception object initialized with the |
| 186 // pre-allocated OutOfMemoryError. | 186 // pre-allocated OutOfMemoryError. |
| 187 const UnhandledException& unhandled_exception = | 187 const UnhandledException& unhandled_exception = |
| 188 UnhandledException::Handle(UnhandledException::New( | 188 UnhandledException::Handle(UnhandledException::New( |
| 189 Instance::Cast(result), Stacktrace::Handle(zone))); | 189 Instance::Cast(result), StackTrace::Handle(zone))); |
| 190 set_preallocated_unhandled_exception(unhandled_exception); | 190 set_preallocated_unhandled_exception(unhandled_exception); |
| 191 | 191 |
| 192 const Array& code_array = Array::Handle( | 192 const Array& code_array = Array::Handle( |
| 193 zone, Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 193 zone, Array::New(StackTrace::kPreallocatedStackdepth, Heap::kOld)); |
| 194 const Array& pc_offset_array = Array::Handle( | 194 const Array& pc_offset_array = Array::Handle( |
| 195 zone, Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 195 zone, Array::New(StackTrace::kPreallocatedStackdepth, Heap::kOld)); |
| 196 const Stacktrace& stack_trace = | 196 const StackTrace& stack_trace = |
| 197 Stacktrace::Handle(zone, Stacktrace::New(code_array, pc_offset_array)); | 197 StackTrace::Handle(zone, StackTrace::New(code_array, pc_offset_array)); |
| 198 // Expansion of inlined functions requires additional memory at run time, | 198 // Expansion of inlined functions requires additional memory at run time, |
| 199 // avoid it. | 199 // avoid it. |
| 200 stack_trace.set_expand_inlined(false); | 200 stack_trace.set_expand_inlined(false); |
| 201 set_preallocated_stack_trace(stack_trace); | 201 set_preallocated_stack_trace(stack_trace); |
| 202 | 202 |
| 203 return Error::null(); | 203 return Error::null(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 | 206 |
| 207 RawFunction* ObjectStore::PrivateObjectLookup(const String& name) { | 207 RawFunction* ObjectStore::PrivateObjectLookup(const String& name) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 simple_instance_of_function_ = | 250 simple_instance_of_function_ = |
| 251 PrivateObjectLookup(Symbols::_simpleInstanceOf()); | 251 PrivateObjectLookup(Symbols::_simpleInstanceOf()); |
| 252 simple_instance_of_true_function_ = | 252 simple_instance_of_true_function_ = |
| 253 PrivateObjectLookup(Symbols::_simpleInstanceOfTrue()); | 253 PrivateObjectLookup(Symbols::_simpleInstanceOfTrue()); |
| 254 simple_instance_of_false_function_ = | 254 simple_instance_of_false_function_ = |
| 255 PrivateObjectLookup(Symbols::_simpleInstanceOfFalse()); | 255 PrivateObjectLookup(Symbols::_simpleInstanceOfFalse()); |
| 256 #endif | 256 #endif |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace dart | 259 } // namespace dart |
| OLD | NEW |