| 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/isolate.h" | 9 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 10 #include "vm/object.h" |
| 10 #include "vm/raw_object.h" | 11 #include "vm/raw_object.h" |
| 12 #include "vm/symbols.h" |
| 11 #include "vm/visitor.h" | 13 #include "vm/visitor.h" |
| 12 | 14 |
| 13 namespace dart { | 15 namespace dart { |
| 14 | 16 |
| 15 ObjectStore::ObjectStore() | 17 ObjectStore::ObjectStore() |
| 16 : object_class_(Class::null()), | 18 : object_class_(Class::null()), |
| 17 object_type_(Type::null()), | 19 object_type_(Type::null()), |
| 18 null_type_(Type::null()), | 20 null_type_(Type::null()), |
| 19 dynamic_type_(Type::null()), | 21 dynamic_type_(Type::null()), |
| 20 void_type_(Type::null()), | 22 void_type_(Type::null()), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 external_two_byte_string_class_(Class::null()), | 36 external_two_byte_string_class_(Class::null()), |
| 35 bool_type_(Type::null()), | 37 bool_type_(Type::null()), |
| 36 bool_class_(Class::null()), | 38 bool_class_(Class::null()), |
| 37 array_class_(Class::null()), | 39 array_class_(Class::null()), |
| 38 array_type_(Type::null()), | 40 array_type_(Type::null()), |
| 39 immutable_array_class_(Class::null()), | 41 immutable_array_class_(Class::null()), |
| 40 growable_object_array_class_(Class::null()), | 42 growable_object_array_class_(Class::null()), |
| 41 float32x4_class_(Class::null()), | 43 float32x4_class_(Class::null()), |
| 42 uint32x4_class_(Class::null()), | 44 uint32x4_class_(Class::null()), |
| 43 typed_data_classes_(Array::null()), | 45 typed_data_classes_(Array::null()), |
| 46 error_class_(Class::null()), |
| 44 stacktrace_class_(Class::null()), | 47 stacktrace_class_(Class::null()), |
| 45 jsregexp_class_(Class::null()), | 48 jsregexp_class_(Class::null()), |
| 46 weak_property_class_(Class::null()), | 49 weak_property_class_(Class::null()), |
| 47 mirror_reference_class_(Class::null()), | 50 mirror_reference_class_(Class::null()), |
| 48 symbol_table_(Array::null()), | 51 symbol_table_(Array::null()), |
| 49 canonical_type_arguments_(Array::null()), | 52 canonical_type_arguments_(Array::null()), |
| 50 async_library_(Library::null()), | 53 async_library_(Library::null()), |
| 51 builtin_library_(Library::null()), | 54 builtin_library_(Library::null()), |
| 52 core_library_(Library::null()), | 55 core_library_(Library::null()), |
| 53 isolate_library_(Library::null()), | 56 isolate_library_(Library::null()), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (this->stack_overflow() != Instance::null()) { | 99 if (this->stack_overflow() != Instance::null()) { |
| 97 ASSERT(this->out_of_memory() != Instance::null()); | 100 ASSERT(this->out_of_memory() != Instance::null()); |
| 98 ASSERT(this->preallocated_stack_trace() != Stacktrace::null()); | 101 ASSERT(this->preallocated_stack_trace() != Stacktrace::null()); |
| 99 return true; | 102 return true; |
| 100 } | 103 } |
| 101 ASSERT(this->stack_overflow() == Instance::null()); | 104 ASSERT(this->stack_overflow() == Instance::null()); |
| 102 ASSERT(this->out_of_memory() == Instance::null()); | 105 ASSERT(this->out_of_memory() == Instance::null()); |
| 103 ASSERT(this->preallocated_stack_trace() == Stacktrace::null()); | 106 ASSERT(this->preallocated_stack_trace() == Stacktrace::null()); |
| 104 | 107 |
| 105 Object& result = Object::Handle(); | 108 Object& result = Object::Handle(); |
| 109 const Library& library = Library::Handle(Library::CoreLibrary()); |
| 106 | 110 |
| 107 result = Exceptions::Create(Exceptions::kStackOverflow, | 111 result = DartLibraryCalls::InstanceCreate(library, |
| 108 Object::empty_array()); | 112 Symbols::StackOverflowError(), |
| 113 Symbols::Dot(), |
| 114 Object::empty_array()); |
| 109 if (result.IsError()) { | 115 if (result.IsError()) { |
| 110 return false; | 116 return false; |
| 111 } | 117 } |
| 112 set_stack_overflow(Instance::Cast(result)); | 118 set_stack_overflow(Instance::Cast(result)); |
| 113 | 119 |
| 114 result = Exceptions::Create(Exceptions::kOutOfMemory, Object::empty_array()); | 120 result = DartLibraryCalls::InstanceCreate(library, |
| 121 Symbols::OutOfMemoryError(), |
| 122 Symbols::Dot(), |
| 123 Object::empty_array()); |
| 115 if (result.IsError()) { | 124 if (result.IsError()) { |
| 116 return false; | 125 return false; |
| 117 } | 126 } |
| 118 set_out_of_memory(Instance::Cast(result)); | 127 set_out_of_memory(Instance::Cast(result)); |
| 119 const Array& func_array = Array::Handle( | 128 const Array& func_array = Array::Handle( |
| 120 isolate, | 129 isolate, |
| 121 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 130 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
| 122 const Array& code_array = Array::Handle( | 131 const Array& code_array = Array::Handle( |
| 123 isolate, | 132 isolate, |
| 124 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 133 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 135 void ObjectStore::InitKeywordTable() { | 144 void ObjectStore::InitKeywordTable() { |
| 136 // Set up the keywords symbol array so that we can access it while scanning. | 145 // Set up the keywords symbol array so that we can access it while scanning. |
| 137 Array& keywords = Array::Handle(keyword_symbols()); | 146 Array& keywords = Array::Handle(keyword_symbols()); |
| 138 ASSERT(keywords.IsNull()); | 147 ASSERT(keywords.IsNull()); |
| 139 keywords = Array::New(Token::numKeywords, Heap::kOld); | 148 keywords = Array::New(Token::numKeywords, Heap::kOld); |
| 140 ASSERT(!keywords.IsError() && !keywords.IsNull()); | 149 ASSERT(!keywords.IsError() && !keywords.IsNull()); |
| 141 set_keyword_symbols(keywords); | 150 set_keyword_symbols(keywords); |
| 142 } | 151 } |
| 143 | 152 |
| 144 } // namespace dart | 153 } // namespace dart |
| OLD | NEW |