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 #ifndef VM_SNAPSHOT_H_ | 5 #ifndef VM_SNAPSHOT_H_ |
6 #define VM_SNAPSHOT_H_ | 6 #define VM_SNAPSHOT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 void ArrayWriteTo(intptr_t object_id, | 475 void ArrayWriteTo(intptr_t object_id, |
476 intptr_t array_kind, | 476 intptr_t array_kind, |
477 intptr_t tags, | 477 intptr_t tags, |
478 RawSmi* length, | 478 RawSmi* length, |
479 RawAbstractTypeArguments* type_arguments, | 479 RawAbstractTypeArguments* type_arguments, |
480 RawObject* data[]); | 480 RawObject* data[]); |
481 | 481 |
482 ObjectStore* object_store() const { return object_store_; } | 482 ObjectStore* object_store() const { return object_store_; } |
483 | 483 |
484 private: | 484 private: |
| 485 class NoGCDuringSnapshotWriteScope : public ValueObject { |
| 486 public: |
| 487 #if defined(DEBUG) |
| 488 NoGCDuringSnapshotWriteScope() { |
| 489 Isolate::Current()->IncrementNoGCScopeDepth(); |
| 490 } |
| 491 ~NoGCDuringSnapshotWriteScope() { |
| 492 Isolate::Current()->DecrementNoGCScopeDepth(); |
| 493 } |
| 494 void Reset() const { |
| 495 Isolate::Current()->ResetNoGCScopeDepth(); |
| 496 } |
| 497 #else // defined(DEBUG) |
| 498 NoGCDuringSnapshotWriteScope() {} |
| 499 ~NoGCDuringSnapshotWriteScope() {} |
| 500 void Reset() const {} |
| 501 #endif // defined(DEBUG) |
| 502 private: |
| 503 DISALLOW_COPY_AND_ASSIGN(NoGCDuringSnapshotWriteScope); |
| 504 }; |
| 505 void ThrowIllegalArgException(const NoGCDuringSnapshotWriteScope& no_gc, |
| 506 const char* msg); |
| 507 |
485 Snapshot::Kind kind_; | 508 Snapshot::Kind kind_; |
486 ObjectStore* object_store_; // Object store for common classes. | 509 ObjectStore* object_store_; // Object store for common classes. |
487 ClassTable* class_table_; // Class table for the class index to class lookup. | 510 ClassTable* class_table_; // Class table for the class index to class lookup. |
488 GrowableArray<ForwardObjectNode*> forward_list_; | 511 GrowableArray<ForwardObjectNode*> forward_list_; |
489 | 512 |
490 friend class RawArray; | 513 friend class RawArray; |
491 friend class RawClass; | 514 friend class RawClass; |
492 friend class RawGrowableObjectArray; | 515 friend class RawGrowableObjectArray; |
493 friend class RawImmutableArray; | 516 friend class RawImmutableArray; |
494 friend class RawJSRegExp; | 517 friend class RawJSRegExp; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 private: | 597 private: |
575 SnapshotWriter* writer_; | 598 SnapshotWriter* writer_; |
576 bool as_references_; | 599 bool as_references_; |
577 | 600 |
578 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 601 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
579 }; | 602 }; |
580 | 603 |
581 } // namespace dart | 604 } // namespace dart |
582 | 605 |
583 #endif // VM_SNAPSHOT_H_ | 606 #endif // VM_SNAPSHOT_H_ |
OLD | NEW |