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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 RawObject* raw = VmIsolateSnapshotObject(id); | 204 RawObject* raw = VmIsolateSnapshotObject(id); |
205 intptr_t cid = raw->GetClassId(); | 205 intptr_t cid = raw->GetClassId(); |
206 switch (cid) { | 206 switch (cid) { |
207 case kOneByteStringCid: { | 207 case kOneByteStringCid: { |
208 RawOneByteString* raw_str = reinterpret_cast<RawOneByteString*>(raw); | 208 RawOneByteString* raw_str = reinterpret_cast<RawOneByteString*>(raw); |
209 const char* str = reinterpret_cast<const char*>(raw_str->ptr()->data()); | 209 const char* str = reinterpret_cast<const char*>(raw_str->ptr()->data()); |
210 ASSERT(str != NULL); | 210 ASSERT(str != NULL); |
211 Dart_CObject* object = NULL; | 211 Dart_CObject* object = NULL; |
212 for (intptr_t i = 0; i < vm_isolate_references_.length(); i++) { | 212 for (intptr_t i = 0; i < vm_isolate_references_.length(); i++) { |
213 object = vm_isolate_references_.At(i); | 213 object = vm_isolate_references_.At(i); |
214 if ((object->type == Dart_CObject_kString)) { | 214 if (object->type == Dart_CObject_kString) { |
215 if (strcmp(str, const_cast<char*>(object->value.as_string)) == 0) { | 215 if (strcmp(str, const_cast<char*>(object->value.as_string)) == 0) { |
216 return object; | 216 return object; |
217 } | 217 } |
218 } | 218 } |
219 } | 219 } |
220 object = CreateDartCObjectString(raw); | 220 object = CreateDartCObjectString(raw); |
221 vm_isolate_references_.Add(object); | 221 vm_isolate_references_.Add(object); |
222 return object; | 222 return object; |
223 } | 223 } |
224 | 224 |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 if (!success) { | 1303 if (!success) { |
1304 UnmarkAllCObjects(object); | 1304 UnmarkAllCObjects(object); |
1305 return false; | 1305 return false; |
1306 } | 1306 } |
1307 } | 1307 } |
1308 UnmarkAllCObjects(object); | 1308 UnmarkAllCObjects(object); |
1309 return true; | 1309 return true; |
1310 } | 1310 } |
1311 | 1311 |
1312 } // namespace dart | 1312 } // namespace dart |
OLD | NEW |