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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 #if defined(DEBUG) | 536 #if defined(DEBUG) |
537 static void ValidateOverwrittenPointer(RawObject* raw); | 537 static void ValidateOverwrittenPointer(RawObject* raw); |
538 static void ValidateOverwrittenSmi(RawSmi* raw); | 538 static void ValidateOverwrittenSmi(RawSmi* raw); |
539 #endif // DEBUG | 539 #endif // DEBUG |
540 | 540 |
541 friend class Api; | 541 friend class Api; |
542 friend class Array; | 542 friend class Array; |
543 friend class ByteBuffer; | 543 friend class ByteBuffer; |
544 friend class Code; | 544 friend class Code; |
| 545 friend class Closure; |
545 friend class FreeListElement; | 546 friend class FreeListElement; |
| 547 friend class Function; |
546 friend class GCMarker; | 548 friend class GCMarker; |
547 friend class ExternalTypedData; | 549 friend class ExternalTypedData; |
548 friend class ForwardList; | 550 friend class ForwardList; |
549 friend class GrowableObjectArray; // StorePointer | 551 friend class GrowableObjectArray; // StorePointer |
550 friend class Heap; | 552 friend class Heap; |
551 friend class HeapMapAsJSONVisitor; | 553 friend class HeapMapAsJSONVisitor; |
552 friend class ClassStatsVisitor; | 554 friend class ClassStatsVisitor; |
553 friend class MarkingVisitor; | 555 friend class MarkingVisitor; |
554 friend class Object; | 556 friend class Object; |
555 friend class OneByteString; // StoreSmi | 557 friend class OneByteString; // StoreSmi |
556 friend class RawExternalTypedData; | 558 friend class RawExternalTypedData; |
557 friend class RawInstructions; | 559 friend class RawInstructions; |
558 friend class RawInstance; | 560 friend class RawInstance; |
559 friend class RawTypedData; | 561 friend class RawTypedData; |
560 friend class Scavenger; | 562 friend class Scavenger; |
561 friend class ScavengerVisitor; | 563 friend class ScavengerVisitor; |
562 friend class SizeExcludingClassVisitor; // GetClassId | 564 friend class SizeExcludingClassVisitor; // GetClassId |
563 friend class SnapshotReader; | 565 friend class SnapshotReader; |
564 friend class SnapshotWriter; | 566 friend class SnapshotWriter; |
565 friend class String; | 567 friend class String; |
566 friend class TypedData; | 568 friend class TypedData; |
567 friend class TypedDataView; | 569 friend class TypedDataView; |
568 friend class WeakProperty; // StorePointer | 570 friend class WeakProperty; // StorePointer |
| 571 friend class Instance; // StorePointer |
569 | 572 |
570 DISALLOW_ALLOCATION(); | 573 DISALLOW_ALLOCATION(); |
571 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); | 574 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); |
572 }; | 575 }; |
573 | 576 |
574 | 577 |
575 class RawClass : public RawObject { | 578 class RawClass : public RawObject { |
576 public: | 579 public: |
577 enum ClassFinalizedState { | 580 enum ClassFinalizedState { |
578 kAllocated = 0, // Initial state. | 581 kAllocated = 0, // Initial state. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); | 681 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); |
679 | 682 |
680 RawObject** from() { | 683 RawObject** from() { |
681 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); | 684 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); |
682 } | 685 } |
683 RawClass* patched_class_; | 686 RawClass* patched_class_; |
684 RawClass* source_class_; | 687 RawClass* source_class_; |
685 RawObject** to() { | 688 RawObject** to() { |
686 return reinterpret_cast<RawObject**>(&ptr()->source_class_); | 689 return reinterpret_cast<RawObject**>(&ptr()->source_class_); |
687 } | 690 } |
| 691 |
| 692 friend class Function; |
688 }; | 693 }; |
689 | 694 |
690 | 695 |
691 class RawFunction : public RawObject { | 696 class RawFunction : public RawObject { |
692 public: | 697 public: |
693 enum Kind { | 698 enum Kind { |
694 kRegularFunction, | 699 kRegularFunction, |
695 kClosureFunction, | 700 kClosureFunction, |
696 kSignatureFunction, // represents a signature only without actual code. | 701 kSignatureFunction, // represents a signature only without actual code. |
697 kGetterFunction, // represents getter functions e.g: get foo() { .. }. | 702 kGetterFunction, // represents getter functions e.g: get foo() { .. }. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 RawObject** from() { | 770 RawObject** from() { |
766 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); | 771 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); |
767 } | 772 } |
768 RawContextScope* context_scope_; | 773 RawContextScope* context_scope_; |
769 RawFunction* parent_function_; // Enclosing function of this local function. | 774 RawFunction* parent_function_; // Enclosing function of this local function. |
770 RawClass* signature_class_; | 775 RawClass* signature_class_; |
771 RawInstance* closure_; // Closure object for static implicit closures. | 776 RawInstance* closure_; // Closure object for static implicit closures. |
772 RawObject** to() { | 777 RawObject** to() { |
773 return reinterpret_cast<RawObject**>(&ptr()->closure_); | 778 return reinterpret_cast<RawObject**>(&ptr()->closure_); |
774 } | 779 } |
| 780 |
| 781 friend class Function; |
775 }; | 782 }; |
776 | 783 |
777 | 784 |
778 class RawRedirectionData : public RawObject { | 785 class RawRedirectionData : public RawObject { |
779 private: | 786 private: |
780 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); | 787 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); |
781 | 788 |
782 RawObject** from() { | 789 RawObject** from() { |
783 return reinterpret_cast<RawObject**>(&ptr()->type_); | 790 return reinterpret_cast<RawObject**>(&ptr()->type_); |
784 } | 791 } |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2176 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2170 kTypedDataInt8ArrayViewCid + 15); | 2177 kTypedDataInt8ArrayViewCid + 15); |
2171 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2178 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2172 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2179 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2173 return (kNullCid - kTypedDataInt8ArrayCid); | 2180 return (kNullCid - kTypedDataInt8ArrayCid); |
2174 } | 2181 } |
2175 | 2182 |
2176 } // namespace dart | 2183 } // namespace dart |
2177 | 2184 |
2178 #endif // VM_RAW_OBJECT_H_ | 2185 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |