Chromium Code Reviews| 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 literal_tokens_canonical_list_(Array::null()), | |
| 58 keyword_symbols_(Array::null()), | |
| 57 preallocate_objects_called_(false) { | 59 preallocate_objects_called_(false) { |
| 58 } | 60 } |
| 59 | 61 |
| 60 | 62 |
| 61 ObjectStore::~ObjectStore() { | 63 ObjectStore::~ObjectStore() { |
| 62 } | 64 } |
| 63 | 65 |
| 64 | 66 |
| 65 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 67 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 66 ASSERT(visitor != NULL); | 68 ASSERT(visitor != NULL); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 97 return false; | 99 return false; |
| 98 } | 100 } |
| 99 exception ^= result.raw(); | 101 exception ^= result.raw(); |
| 100 set_out_of_memory(exception); | 102 set_out_of_memory(exception); |
| 101 | 103 |
| 102 preallocate_objects_called_ = true; | 104 preallocate_objects_called_ = true; |
| 103 return true; | 105 return true; |
| 104 } | 106 } |
| 105 | 107 |
| 106 | 108 |
| 109 RawObject* ObjectStore::GetKeywordSymbol(int index) { | |
| 110 Array& keywords = Array::Handle(keyword_symbols()); | |
| 111 if (keywords.IsNull()) { | |
|
hausner
2012/02/25 00:41:57
Could you move the creation of this table to the i
siva
2012/02/28 19:57:31
Done.
| |
| 112 // Set up the keywords symbol array so that we can access it while scanning. | |
| 113 keywords = Array::New(Token::numKeywords, Heap::kOld); | |
| 114 ASSERT(!keywords.IsError() && !keywords.IsNull()); | |
| 115 set_keyword_symbols(keywords); | |
| 116 } | |
| 117 return keywords.At(index); | |
| 118 } | |
| 119 | |
| 120 | |
| 121 void ObjectStore::SetKeywordSymbol(int index, const String& symbol) { | |
| 122 Array& keywords = Array::Handle(keyword_symbols()); | |
| 123 ASSERT(!keywords.IsNull()); | |
| 124 keywords.SetAt(index, symbol); | |
| 125 } | |
| 126 | |
| 127 | |
| 107 RawClass* ObjectStore::GetClass(int index) { | 128 RawClass* ObjectStore::GetClass(int index) { |
| 108 switch (index) { | 129 switch (index) { |
| 109 case kObjectClass: return object_class_; | 130 case kObjectClass: return object_class_; |
| 110 case kSmiClass: return smi_class_; | 131 case kSmiClass: return smi_class_; |
| 111 case kMintClass: return mint_class_; | 132 case kMintClass: return mint_class_; |
| 112 case kBigintClass: return bigint_class_; | 133 case kBigintClass: return bigint_class_; |
| 113 case kDoubleClass: return double_class_; | 134 case kDoubleClass: return double_class_; |
| 114 case kOneByteStringClass: return one_byte_string_class_; | 135 case kOneByteStringClass: return one_byte_string_class_; |
| 115 case kTwoByteStringClass: return two_byte_string_class_; | 136 case kTwoByteStringClass: return two_byte_string_class_; |
| 116 case kFourByteStringClass: return four_byte_string_class_; | 137 case kFourByteStringClass: return four_byte_string_class_; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 return kStringInterface; | 240 return kStringInterface; |
| 220 } else if (raw_type == list_interface()) { | 241 } else if (raw_type == list_interface()) { |
| 221 return kListInterface; | 242 return kListInterface; |
| 222 } else if (raw_type == byte_array_interface()) { | 243 } else if (raw_type == byte_array_interface()) { |
| 223 return kByteArrayInterface; | 244 return kByteArrayInterface; |
| 224 } | 245 } |
| 225 return kInvalidIndex; | 246 return kInvalidIndex; |
| 226 } | 247 } |
| 227 | 248 |
| 228 } // namespace dart | 249 } // namespace dart |
| OLD | NEW |