| 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_(ParameterizedType::null()), | 16 function_interface_(Type::null()), |
| 17 number_interface_(ParameterizedType::null()), | 17 number_interface_(Type::null()), |
| 18 int_interface_(ParameterizedType::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_(ParameterizedType::null()), | 22 double_interface_(Type::null()), |
| 23 double_class_(Class::null()), | 23 double_class_(Class::null()), |
| 24 string_interface_(ParameterizedType::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 external_one_byte_string_class_(Class::null()), | 28 external_one_byte_string_class_(Class::null()), |
| 29 external_two_byte_string_class_(Class::null()), | 29 external_two_byte_string_class_(Class::null()), |
| 30 external_four_byte_string_class_(Class::null()), | 30 external_four_byte_string_class_(Class::null()), |
| 31 bool_interface_(ParameterizedType::null()), | 31 bool_interface_(Type::null()), |
| 32 bool_class_(Class::null()), | 32 bool_class_(Class::null()), |
| 33 list_interface_(ParameterizedType::null()), | 33 list_interface_(Type::null()), |
| 34 array_class_(Class::null()), | 34 array_class_(Class::null()), |
| 35 immutable_array_class_(Class::null()), | 35 immutable_array_class_(Class::null()), |
| 36 byte_buffer_class_(Class::null()), | 36 byte_buffer_class_(Class::null()), |
| 37 unhandled_exception_class_(Class::null()), | 37 unhandled_exception_class_(Class::null()), |
| 38 stacktrace_class_(Class::null()), | 38 stacktrace_class_(Class::null()), |
| 39 jsregexp_class_(Class::null()), | 39 jsregexp_class_(Class::null()), |
| 40 true_value_(Bool::null()), | 40 true_value_(Bool::null()), |
| 41 false_value_(Bool::null()), | 41 false_value_(Bool::null()), |
| 42 empty_array_(Array::null()), | 42 empty_array_(Array::null()), |
| 43 symbol_table_(Array::null()), | 43 symbol_table_(Array::null()), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return kUnhandledExceptionClass; | 132 return kUnhandledExceptionClass; |
| 133 } else if (raw_class == stacktrace_class_) { | 133 } else if (raw_class == stacktrace_class_) { |
| 134 return kStacktraceClass; | 134 return kStacktraceClass; |
| 135 } else if (raw_class == jsregexp_class_) { | 135 } else if (raw_class == jsregexp_class_) { |
| 136 return kJSRegExpClass; | 136 return kJSRegExpClass; |
| 137 } | 137 } |
| 138 return kInvalidIndex; | 138 return kInvalidIndex; |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 RawParameterizedType* ObjectStore::GetType(int index) { | 142 RawType* ObjectStore::GetType(int index) { |
| 143 switch (index) { | 143 switch (index) { |
| 144 case kObjectType: return object_type(); | 144 case kObjectType: return object_type(); |
| 145 case kNullType: return null_type(); | 145 case kNullType: return null_type(); |
| 146 case kDynamicType: return dynamic_type(); | 146 case kDynamicType: return dynamic_type(); |
| 147 case kVoidType: return void_type(); | 147 case kVoidType: return void_type(); |
| 148 case kFunctionInterface: return function_interface(); | 148 case kFunctionInterface: return function_interface(); |
| 149 case kNumberInterface: return number_interface(); | 149 case kNumberInterface: return number_interface(); |
| 150 case kDoubleInterface: return double_interface(); | 150 case kDoubleInterface: return double_interface(); |
| 151 case kIntInterface: return int_interface(); | 151 case kIntInterface: return int_interface(); |
| 152 case kBoolInterface: return bool_interface(); | 152 case kBoolInterface: return bool_interface(); |
| 153 case kStringInterface: return string_interface(); | 153 case kStringInterface: return string_interface(); |
| 154 case kListInterface: return list_interface(); | 154 case kListInterface: return list_interface(); |
| 155 default: break; | 155 default: break; |
| 156 } | 156 } |
| 157 UNREACHABLE(); | 157 UNREACHABLE(); |
| 158 return ParameterizedType::null(); | 158 return Type::null(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 int ObjectStore::GetTypeIndex(const RawParameterizedType* raw_type) { | 162 int ObjectStore::GetTypeIndex(const RawType* raw_type) { |
| 163 ASSERT(raw_type->IsHeapObject()); | 163 ASSERT(raw_type->IsHeapObject()); |
| 164 if (raw_type == object_type()) { | 164 if (raw_type == object_type()) { |
| 165 return kObjectType; | 165 return kObjectType; |
| 166 } else if (raw_type == null_type()) { | 166 } else if (raw_type == null_type()) { |
| 167 return kNullType; | 167 return kNullType; |
| 168 } else if (raw_type == dynamic_type()) { | 168 } else if (raw_type == dynamic_type()) { |
| 169 return kDynamicType; | 169 return kDynamicType; |
| 170 } else if (raw_type == void_type()) { | 170 } else if (raw_type == void_type()) { |
| 171 return kVoidType; | 171 return kVoidType; |
| 172 } else if (raw_type == function_interface()) { | 172 } else if (raw_type == function_interface()) { |
| 173 return kFunctionInterface; | 173 return kFunctionInterface; |
| 174 } else if (raw_type == number_interface()) { | 174 } else if (raw_type == number_interface()) { |
| 175 return kNumberInterface; | 175 return kNumberInterface; |
| 176 } else if (raw_type == double_interface()) { | 176 } else if (raw_type == double_interface()) { |
| 177 return kDoubleInterface; | 177 return kDoubleInterface; |
| 178 } else if (raw_type == int_interface()) { | 178 } else if (raw_type == int_interface()) { |
| 179 return kIntInterface; | 179 return kIntInterface; |
| 180 } else if (raw_type == bool_interface()) { | 180 } else if (raw_type == bool_interface()) { |
| 181 return kBoolInterface; | 181 return kBoolInterface; |
| 182 } else if (raw_type == string_interface()) { | 182 } else if (raw_type == string_interface()) { |
| 183 return kStringInterface; | 183 return kStringInterface; |
| 184 } else if (raw_type == list_interface()) { | 184 } else if (raw_type == list_interface()) { |
| 185 return kListInterface; | 185 return kListInterface; |
| 186 } | 186 } |
| 187 return kInvalidIndex; | 187 return kInvalidIndex; |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace dart | 190 } // namespace dart |
| OLD | NEW |