OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/dart_api_message.h" | 5 #include "vm/dart_api_message.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/snapshot_ids.h" | 7 #include "vm/snapshot_ids.h" |
8 #include "vm/symbols.h" | 8 #include "vm/symbols.h" |
9 #include "vm/unicode.h" | 9 #include "vm/unicode.h" |
10 | 10 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 Dart_CObject* ApiMessageReader::ReadVMSymbol(intptr_t object_id) { | 217 Dart_CObject* ApiMessageReader::ReadVMSymbol(intptr_t object_id) { |
218 if (Symbols::IsVMSymbolId(object_id)) { | 218 if (Symbols::IsVMSymbolId(object_id)) { |
219 intptr_t symbol_id = object_id - kMaxPredefinedObjectIds; | 219 intptr_t symbol_id = object_id - kMaxPredefinedObjectIds; |
220 Dart_CObject* object; | 220 Dart_CObject* object; |
221 if (vm_symbol_references_ != NULL && | 221 if (vm_symbol_references_ != NULL && |
222 (object = vm_symbol_references_[symbol_id]) != NULL) { | 222 (object = vm_symbol_references_[symbol_id]) != NULL) { |
223 return object; | 223 return object; |
224 } | 224 } |
225 | 225 |
226 if (vm_symbol_references_ == NULL) { | 226 if (vm_symbol_references_ == NULL) { |
227 intptr_t size = sizeof(*vm_symbol_references_) * Symbols::kMaxId; | 227 intptr_t size = |
| 228 (sizeof(*vm_symbol_references_) * Symbols::kMaxPredefinedId); |
228 vm_symbol_references_ = | 229 vm_symbol_references_ = |
229 reinterpret_cast<Dart_CObject**>(alloc_(NULL, 0, size)); | 230 reinterpret_cast<Dart_CObject**>(alloc_(NULL, 0, size)); |
230 memset(vm_symbol_references_, 0, size); | 231 memset(vm_symbol_references_, 0, size); |
231 } | 232 } |
232 | 233 |
233 RawOneByteString* str = | 234 RawOneByteString* str = |
234 reinterpret_cast<RawOneByteString*>(Symbols::GetVMSymbol(object_id)); | 235 reinterpret_cast<RawOneByteString*>(Symbols::GetVMSymbol(object_id)); |
235 intptr_t len = Smi::Value(str->ptr()->length_); | 236 intptr_t len = Smi::Value(str->ptr()->length_); |
236 object = AllocateDartCObjectString(len); | 237 object = AllocateDartCObjectString(len); |
237 char* p = object->value.as_string; | 238 char* p = object->value.as_string; |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 if (!success) { | 898 if (!success) { |
898 UnmarkAllCObjects(object); | 899 UnmarkAllCObjects(object); |
899 return false; | 900 return false; |
900 } | 901 } |
901 } | 902 } |
902 UnmarkAllCObjects(object); | 903 UnmarkAllCObjects(object); |
903 return true; | 904 return true; |
904 } | 905 } |
905 | 906 |
906 } // namespace dart | 907 } // namespace dart |
OLD | NEW |