| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 core_library_(Library::null()), | 47 core_library_(Library::null()), |
| 48 core_impl_library_(Library::null()), | 48 core_impl_library_(Library::null()), |
| 49 native_wrappers_library_(Library::null()), | 49 native_wrappers_library_(Library::null()), |
| 50 root_library_(Library::null()), | 50 root_library_(Library::null()), |
| 51 registered_libraries_(Library::null()), | 51 registered_libraries_(Library::null()), |
| 52 pending_classes_(Array::null()), | 52 pending_classes_(Array::null()), |
| 53 sticky_error_(Error::null()), | 53 sticky_error_(Error::null()), |
| 54 empty_context_(Context::null()), | 54 empty_context_(Context::null()), |
| 55 stack_overflow_(Instance::null()), | 55 stack_overflow_(Instance::null()), |
| 56 out_of_memory_(Instance::null()), | 56 out_of_memory_(Instance::null()), |
| 57 keyword_symbols_(Array::null()), |
| 57 preallocate_objects_called_(false) { | 58 preallocate_objects_called_(false) { |
| 58 } | 59 } |
| 59 | 60 |
| 60 | 61 |
| 61 ObjectStore::~ObjectStore() { | 62 ObjectStore::~ObjectStore() { |
| 62 } | 63 } |
| 63 | 64 |
| 64 | 65 |
| 65 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 66 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 66 ASSERT(visitor != NULL); | 67 ASSERT(visitor != NULL); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 97 return false; | 98 return false; |
| 98 } | 99 } |
| 99 exception ^= result.raw(); | 100 exception ^= result.raw(); |
| 100 set_out_of_memory(exception); | 101 set_out_of_memory(exception); |
| 101 | 102 |
| 102 preallocate_objects_called_ = true; | 103 preallocate_objects_called_ = true; |
| 103 return true; | 104 return true; |
| 104 } | 105 } |
| 105 | 106 |
| 106 | 107 |
| 108 void ObjectStore::InitKeywordTable() { |
| 109 // Set up the keywords symbol array so that we can access it while scanning. |
| 110 Array& keywords = Array::Handle(keyword_symbols()); |
| 111 ASSERT(keywords.IsNull()); |
| 112 keywords = Array::New(Token::numKeywords, Heap::kOld); |
| 113 ASSERT(!keywords.IsError() && !keywords.IsNull()); |
| 114 set_keyword_symbols(keywords); |
| 115 } |
| 116 |
| 117 |
| 107 RawClass* ObjectStore::GetClass(int index) { | 118 RawClass* ObjectStore::GetClass(int index) { |
| 108 switch (index) { | 119 switch (index) { |
| 109 case kObjectClass: return object_class_; | 120 case kObjectClass: return object_class_; |
| 110 case kSmiClass: return smi_class_; | 121 case kSmiClass: return smi_class_; |
| 111 case kMintClass: return mint_class_; | 122 case kMintClass: return mint_class_; |
| 112 case kBigintClass: return bigint_class_; | 123 case kBigintClass: return bigint_class_; |
| 113 case kDoubleClass: return double_class_; | 124 case kDoubleClass: return double_class_; |
| 114 case kOneByteStringClass: return one_byte_string_class_; | 125 case kOneByteStringClass: return one_byte_string_class_; |
| 115 case kTwoByteStringClass: return two_byte_string_class_; | 126 case kTwoByteStringClass: return two_byte_string_class_; |
| 116 case kFourByteStringClass: return four_byte_string_class_; | 127 case kFourByteStringClass: return four_byte_string_class_; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return kStringInterface; | 230 return kStringInterface; |
| 220 } else if (raw_type == list_interface()) { | 231 } else if (raw_type == list_interface()) { |
| 221 return kListInterface; | 232 return kListInterface; |
| 222 } else if (raw_type == byte_array_interface()) { | 233 } else if (raw_type == byte_array_interface()) { |
| 223 return kByteArrayInterface; | 234 return kByteArrayInterface; |
| 224 } | 235 } |
| 225 return kInvalidIndex; | 236 return kInvalidIndex; |
| 226 } | 237 } |
| 227 | 238 |
| 228 } // namespace dart | 239 } // namespace dart |
| OLD | NEW |