| 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" |
| 11 #include "vm/visitor.h" | 11 #include "vm/visitor.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 ObjectStore::ObjectStore() | 15 ObjectStore::ObjectStore() |
| 16 : object_class_(Class::null()), | 16 : object_class_(Class::null()), |
| 17 function_interface_(Type::null()), | 17 function_interface_(Type::null()), |
| 18 number_interface_(Type::null()), | 18 number_interface_(Type::null()), |
| 19 int_interface_(Type::null()), | 19 int_interface_(Type::null()), |
| 20 integer_implementation_class_(Class::null()), |
| 20 smi_class_(Class::null()), | 21 smi_class_(Class::null()), |
| 21 mint_class_(Class::null()), | 22 mint_class_(Class::null()), |
| 22 bigint_class_(Class::null()), | 23 bigint_class_(Class::null()), |
| 23 double_interface_(Type::null()), | 24 double_interface_(Type::null()), |
| 24 double_class_(Class::null()), | 25 double_class_(Class::null()), |
| 25 string_interface_(Type::null()), | 26 string_interface_(Type::null()), |
| 26 one_byte_string_class_(Class::null()), | 27 one_byte_string_class_(Class::null()), |
| 27 two_byte_string_class_(Class::null()), | 28 two_byte_string_class_(Class::null()), |
| 28 four_byte_string_class_(Class::null()), | 29 four_byte_string_class_(Class::null()), |
| 29 external_one_byte_string_class_(Class::null()), | 30 external_one_byte_string_class_(Class::null()), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ASSERT(keywords.IsNull()); | 133 ASSERT(keywords.IsNull()); |
| 133 keywords = Array::New(Token::numKeywords, Heap::kOld); | 134 keywords = Array::New(Token::numKeywords, Heap::kOld); |
| 134 ASSERT(!keywords.IsError() && !keywords.IsNull()); | 135 ASSERT(!keywords.IsError() && !keywords.IsNull()); |
| 135 set_keyword_symbols(keywords); | 136 set_keyword_symbols(keywords); |
| 136 } | 137 } |
| 137 | 138 |
| 138 | 139 |
| 139 RawClass* ObjectStore::GetClass(int index) { | 140 RawClass* ObjectStore::GetClass(int index) { |
| 140 switch (index) { | 141 switch (index) { |
| 141 case kObjectClass: return object_class_; | 142 case kObjectClass: return object_class_; |
| 143 case kIntegerImplementationClass: return integer_implementation_class_; |
| 142 case kSmiClass: return smi_class_; | 144 case kSmiClass: return smi_class_; |
| 143 case kMintClass: return mint_class_; | 145 case kMintClass: return mint_class_; |
| 144 case kBigintClass: return bigint_class_; | 146 case kBigintClass: return bigint_class_; |
| 145 case kDoubleClass: return double_class_; | 147 case kDoubleClass: return double_class_; |
| 146 case kOneByteStringClass: return one_byte_string_class_; | 148 case kOneByteStringClass: return one_byte_string_class_; |
| 147 case kTwoByteStringClass: return two_byte_string_class_; | 149 case kTwoByteStringClass: return two_byte_string_class_; |
| 148 case kFourByteStringClass: return four_byte_string_class_; | 150 case kFourByteStringClass: return four_byte_string_class_; |
| 149 case kExternalOneByteStringClass: return external_one_byte_string_class_; | 151 case kExternalOneByteStringClass: return external_one_byte_string_class_; |
| 150 case kExternalTwoByteStringClass: return external_two_byte_string_class_; | 152 case kExternalTwoByteStringClass: return external_two_byte_string_class_; |
| 151 case kExternalFourByteStringClass: return external_four_byte_string_class_; | 153 case kExternalFourByteStringClass: return external_four_byte_string_class_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 179 } | 181 } |
| 180 UNREACHABLE(); | 182 UNREACHABLE(); |
| 181 return Class::null(); | 183 return Class::null(); |
| 182 } | 184 } |
| 183 | 185 |
| 184 | 186 |
| 185 int ObjectStore::GetClassIndex(const RawClass* raw_class) { | 187 int ObjectStore::GetClassIndex(const RawClass* raw_class) { |
| 186 ASSERT(raw_class->IsHeapObject()); | 188 ASSERT(raw_class->IsHeapObject()); |
| 187 if (raw_class == object_class_) { | 189 if (raw_class == object_class_) { |
| 188 return kObjectClass; | 190 return kObjectClass; |
| 191 } else if (raw_class == integer_implementation_class_) { |
| 192 return kIntegerImplementationClass; |
| 189 } else if (raw_class == smi_class_) { | 193 } else if (raw_class == smi_class_) { |
| 190 return kSmiClass; | 194 return kSmiClass; |
| 191 } else if (raw_class == mint_class_) { | 195 } else if (raw_class == mint_class_) { |
| 192 return kMintClass; | 196 return kMintClass; |
| 193 } else if (raw_class == bigint_class_) { | 197 } else if (raw_class == bigint_class_) { |
| 194 return kBigintClass; | 198 return kBigintClass; |
| 195 } else if (raw_class == double_class_) { | 199 } else if (raw_class == double_class_) { |
| 196 return kDoubleClass; | 200 return kDoubleClass; |
| 197 } else if (raw_class == one_byte_string_class_) { | 201 } else if (raw_class == one_byte_string_class_) { |
| 198 return kOneByteStringClass; | 202 return kOneByteStringClass; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 return kStringInterface; | 312 return kStringInterface; |
| 309 } else if (raw_type == list_interface()) { | 313 } else if (raw_type == list_interface()) { |
| 310 return kListInterface; | 314 return kListInterface; |
| 311 } else if (raw_type == byte_array_interface()) { | 315 } else if (raw_type == byte_array_interface()) { |
| 312 return kByteArrayInterface; | 316 return kByteArrayInterface; |
| 313 } | 317 } |
| 314 return kInvalidIndex; | 318 return kInvalidIndex; |
| 315 } | 319 } |
| 316 | 320 |
| 317 } // namespace dart | 321 } // namespace dart |
| OLD | NEW |