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/bigint_operations.h" | 5 #include "vm/bigint_operations.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 intptr_t object_id, | 2380 intptr_t object_id, |
2381 Snapshot::Kind kind) { | 2381 Snapshot::Kind kind) { |
2382 UNREACHABLE(); // DartFunction is an abstract class. | 2382 UNREACHABLE(); // DartFunction is an abstract class. |
2383 } | 2383 } |
2384 | 2384 |
2385 | 2385 |
2386 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, | 2386 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, |
2387 intptr_t object_id, | 2387 intptr_t object_id, |
2388 intptr_t tags, | 2388 intptr_t tags, |
2389 Snapshot::Kind kind) { | 2389 Snapshot::Kind kind) { |
2390 UNIMPLEMENTED(); | 2390 if (kind == Snapshot::kFull) { |
| 2391 Stacktrace& result = Stacktrace::ZoneHandle(reader->isolate(), |
| 2392 reader->NewStacktrace()); |
| 2393 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 2394 |
| 2395 // There are no non object pointer fields. |
| 2396 |
| 2397 // Read all the object pointer fields. |
| 2398 Array& array = Array::Handle(reader->isolate()); |
| 2399 array ^= reader->ReadObjectRef(); |
| 2400 result.set_function_array(array); |
| 2401 array ^= reader->ReadObjectRef(); |
| 2402 result.set_code_array(array); |
| 2403 array ^= reader->ReadObjectRef(); |
| 2404 result.set_pc_offset_array(array); |
| 2405 return result.raw(); |
| 2406 } |
| 2407 UNREACHABLE(); // Stacktraces are not sent in a snapshot. |
2391 return Stacktrace::null(); | 2408 return Stacktrace::null(); |
2392 } | 2409 } |
2393 | 2410 |
2394 | 2411 |
2395 void RawStacktrace::WriteTo(SnapshotWriter* writer, | 2412 void RawStacktrace::WriteTo(SnapshotWriter* writer, |
2396 intptr_t object_id, | 2413 intptr_t object_id, |
2397 Snapshot::Kind kind) { | 2414 Snapshot::Kind kind) { |
2398 UNIMPLEMENTED(); | 2415 if (kind == Snapshot::kFull) { |
| 2416 ASSERT(writer != NULL); |
| 2417 ASSERT(this == Isolate::Current()->object_store()-> |
| 2418 preallocated_stack_trace()); |
| 2419 |
| 2420 // Write out the serialization header value for this object. |
| 2421 writer->WriteInlinedObjectHeader(object_id); |
| 2422 |
| 2423 // Write out the class and tags information. |
| 2424 writer->WriteIndexedObject(kStacktraceCid); |
| 2425 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2426 |
| 2427 // There are no non object pointer fields. |
| 2428 |
| 2429 // Write out all the object pointer fields. |
| 2430 SnapshotWriterVisitor visitor(writer); |
| 2431 visitor.VisitPointers(from(), to()); |
| 2432 } else { |
| 2433 UNREACHABLE(); // Stacktraces are not supported for other snapshot forms. |
| 2434 } |
2399 } | 2435 } |
2400 | 2436 |
2401 | 2437 |
2402 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, | 2438 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, |
2403 intptr_t object_id, | 2439 intptr_t object_id, |
2404 intptr_t tags, | 2440 intptr_t tags, |
2405 Snapshot::Kind kind) { | 2441 Snapshot::Kind kind) { |
2406 ASSERT(reader != NULL); | 2442 ASSERT(reader != NULL); |
2407 ASSERT(kind == Snapshot::kMessage); | 2443 ASSERT(kind == Snapshot::kMessage); |
2408 | 2444 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2489 // Write out the class and tags information. | 2525 // Write out the class and tags information. |
2490 writer->WriteIndexedObject(kWeakPropertyCid); | 2526 writer->WriteIndexedObject(kWeakPropertyCid); |
2491 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2527 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2492 | 2528 |
2493 // Write out all the other fields. | 2529 // Write out all the other fields. |
2494 writer->Write<RawObject*>(ptr()->key_); | 2530 writer->Write<RawObject*>(ptr()->key_); |
2495 writer->Write<RawObject*>(ptr()->value_); | 2531 writer->Write<RawObject*>(ptr()->value_); |
2496 } | 2532 } |
2497 | 2533 |
2498 } // namespace dart | 2534 } // namespace dart |
OLD | NEW |