| 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/isolate.h" | 7 #include "vm/isolate.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/raw_object.h" | 9 #include "vm/raw_object.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 ObjectStore::ObjectStore() | 14 ObjectStore::ObjectStore() |
| 15 : object_class_(Class::null()), | 15 : object_class_(Class::null()), |
| 16 function_interface_(Type::null()), | 16 function_interface_(Type::null()), |
| 17 number_interface_(Type::null()), | 17 number_interface_(Type::null()), |
| 18 int_interface_(Type::null()), | 18 int_interface_(Type::null()), |
| 19 smi_class_(Class::null()), | 19 smi_class_(Class::null()), |
| 20 mint_class_(Class::null()), | 20 mint_class_(Class::null()), |
| 21 bigint_class_(Class::null()), | 21 bigint_class_(Class::null()), |
| 22 double_interface_(Type::null()), | 22 double_interface_(Type::null()), |
| 23 double_class_(Class::null()), | 23 double_class_(Class::null()), |
| 24 string_interface_(Type::null()), | 24 string_interface_(Type::null()), |
| 25 one_byte_string_class_(Class::null()), | 25 one_byte_string_class_(Class::null()), |
| 26 two_byte_string_class_(Class::null()), | 26 two_byte_string_class_(Class::null()), |
| 27 four_byte_string_class_(Class::null()), | 27 four_byte_string_class_(Class::null()), |
| 28 bool_interface_(Type::null()), | 28 bool_interface_(Type::null()), |
| 29 bool_class_(Class::null()), | 29 bool_class_(Class::null()), |
| 30 list_interface_(Type::null()), |
| 30 array_class_(Class::null()), | 31 array_class_(Class::null()), |
| 31 immutable_array_class_(Class::null()), | 32 immutable_array_class_(Class::null()), |
| 32 unhandled_exception_class_(Class::null()), | 33 unhandled_exception_class_(Class::null()), |
| 33 stacktrace_class_(Class::null()), | 34 stacktrace_class_(Class::null()), |
| 34 jsregexp_class_(Class::null()), | 35 jsregexp_class_(Class::null()), |
| 35 true_value_(Bool::null()), | 36 true_value_(Bool::null()), |
| 36 false_value_(Bool::null()), | 37 false_value_(Bool::null()), |
| 37 empty_array_(Array::null()), | 38 empty_array_(Array::null()), |
| 38 symbol_table_(Array::null()), | 39 symbol_table_(Array::null()), |
| 39 core_library_(Library::null()), | 40 core_library_(Library::null()), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 case kObjectType: return object_type(); | 127 case kObjectType: return object_type(); |
| 127 case kNullType: return null_type(); | 128 case kNullType: return null_type(); |
| 128 case kDynamicType: return dynamic_type(); | 129 case kDynamicType: return dynamic_type(); |
| 129 case kVoidType: return void_type(); | 130 case kVoidType: return void_type(); |
| 130 case kFunctionInterface: return function_interface(); | 131 case kFunctionInterface: return function_interface(); |
| 131 case kNumberInterface: return number_interface(); | 132 case kNumberInterface: return number_interface(); |
| 132 case kDoubleInterface: return double_interface(); | 133 case kDoubleInterface: return double_interface(); |
| 133 case kIntInterface: return int_interface(); | 134 case kIntInterface: return int_interface(); |
| 134 case kBoolInterface: return bool_interface(); | 135 case kBoolInterface: return bool_interface(); |
| 135 case kStringInterface: return string_interface(); | 136 case kStringInterface: return string_interface(); |
| 137 case kListInterface: return list_interface(); |
| 136 default: break; | 138 default: break; |
| 137 } | 139 } |
| 138 UNREACHABLE(); | 140 UNREACHABLE(); |
| 139 return Type::null(); | 141 return Type::null(); |
| 140 } | 142 } |
| 141 | 143 |
| 142 | 144 |
| 143 int ObjectStore::GetTypeIndex(const RawType* raw_type) { | 145 int ObjectStore::GetTypeIndex(const RawType* raw_type) { |
| 144 ASSERT(raw_type->IsHeapObject()); | 146 ASSERT(raw_type->IsHeapObject()); |
| 145 if (raw_type == object_type()) { | 147 if (raw_type == object_type()) { |
| 146 return kObjectType; | 148 return kObjectType; |
| 147 } else if (raw_type == null_type()) { | 149 } else if (raw_type == null_type()) { |
| 148 return kNullType; | 150 return kNullType; |
| 149 } else if (raw_type == dynamic_type()) { | 151 } else if (raw_type == dynamic_type()) { |
| 150 return kDynamicType; | 152 return kDynamicType; |
| 151 } else if (raw_type == void_type()) { | 153 } else if (raw_type == void_type()) { |
| 152 return kVoidType; | 154 return kVoidType; |
| 153 } else if (raw_type == function_interface()) { | 155 } else if (raw_type == function_interface()) { |
| 154 return kFunctionInterface; | 156 return kFunctionInterface; |
| 155 } else if (raw_type == number_interface()) { | 157 } else if (raw_type == number_interface()) { |
| 156 return kNumberInterface; | 158 return kNumberInterface; |
| 157 } else if (raw_type == double_interface()) { | 159 } else if (raw_type == double_interface()) { |
| 158 return kDoubleInterface; | 160 return kDoubleInterface; |
| 159 } else if (raw_type == int_interface()) { | 161 } else if (raw_type == int_interface()) { |
| 160 return kIntInterface; | 162 return kIntInterface; |
| 161 } else if (raw_type == bool_interface()) { | 163 } else if (raw_type == bool_interface()) { |
| 162 return kBoolInterface; | 164 return kBoolInterface; |
| 163 } else if (raw_type == string_interface()) { | 165 } else if (raw_type == string_interface()) { |
| 164 return kStringInterface; | 166 return kStringInterface; |
| 167 } else if (raw_type == list_interface()) { |
| 168 return kListInterface; |
| 165 } | 169 } |
| 166 return kInvalidIndex; | 170 return kInvalidIndex; |
| 167 } | 171 } |
| 168 | 172 |
| 169 } // namespace dart | 173 } // namespace dart |
| OLD | NEW |