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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
11 #include "vm/json_stream.h" | 11 #include "vm/json_stream.h" |
12 #include "vm/bitmap.h" | 12 #include "vm/bitmap.h" |
13 #include "vm/dart.h" | 13 #include "vm/dart.h" |
14 #include "vm/globals.h" | 14 #include "vm/globals.h" |
15 #include "vm/handles.h" | 15 #include "vm/handles.h" |
16 #include "vm/heap.h" | 16 #include "vm/heap.h" |
17 #include "vm/isolate.h" | 17 #include "vm/isolate.h" |
18 #include "vm/os.h" | 18 #include "vm/os.h" |
19 #include "vm/raw_object.h" | 19 #include "vm/raw_object.h" |
20 #include "vm/scanner.h" | 20 #include "vm/scanner.h" |
21 #include "vm/tags.h" | |
21 | 22 |
22 namespace dart { | 23 namespace dart { |
23 | 24 |
24 // Forward declarations. | 25 // Forward declarations. |
25 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 26 #define DEFINE_FORWARD_DECLARATION(clazz) \ |
26 class clazz; | 27 class clazz; |
27 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 28 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
28 #undef DEFINE_FORWARD_DECLARATION | 29 #undef DEFINE_FORWARD_DECLARATION |
29 class Api; | 30 class Api; |
30 class ArgumentsDescriptor; | 31 class ArgumentsDescriptor; |
(...skipping 2608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2639 | 2640 |
2640 static RawLibrary* AsyncLibrary(); | 2641 static RawLibrary* AsyncLibrary(); |
2641 static RawLibrary* CoreLibrary(); | 2642 static RawLibrary* CoreLibrary(); |
2642 static RawLibrary* CollectionLibrary(); | 2643 static RawLibrary* CollectionLibrary(); |
2643 static RawLibrary* InternalLibrary(); | 2644 static RawLibrary* InternalLibrary(); |
2644 static RawLibrary* IsolateLibrary(); | 2645 static RawLibrary* IsolateLibrary(); |
2645 static RawLibrary* MathLibrary(); | 2646 static RawLibrary* MathLibrary(); |
2646 static RawLibrary* MirrorsLibrary(); | 2647 static RawLibrary* MirrorsLibrary(); |
2647 static RawLibrary* NativeWrappersLibrary(); | 2648 static RawLibrary* NativeWrappersLibrary(); |
2648 static RawLibrary* TypedDataLibrary(); | 2649 static RawLibrary* TypedDataLibrary(); |
2650 static RawLibrary* ProfilerLibrary(); | |
2649 | 2651 |
2650 // Eagerly compile all classes and functions in the library. | 2652 // Eagerly compile all classes and functions in the library. |
2651 static RawError* CompileAll(); | 2653 static RawError* CompileAll(); |
2652 | 2654 |
2653 // Checks function fingerprints. Prints mismatches and aborts if | 2655 // Checks function fingerprints. Prints mismatches and aborts if |
2654 // mismatch found. | 2656 // mismatch found. |
2655 static void CheckFunctionFingerprints(); | 2657 static void CheckFunctionFingerprints(); |
2656 | 2658 |
2657 static bool IsPrivate(const String& name); | 2659 static bool IsPrivate(const String& name); |
2658 // Construct the full name of a corelib member. | 2660 // Construct the full name of a corelib member. |
(...skipping 3976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6635 static intptr_t InstanceSize() { | 6637 static intptr_t InstanceSize() { |
6636 return RoundedAllocationSize(sizeof(RawMirrorReference)); | 6638 return RoundedAllocationSize(sizeof(RawMirrorReference)); |
6637 } | 6639 } |
6638 | 6640 |
6639 private: | 6641 private: |
6640 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance); | 6642 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance); |
6641 friend class Class; | 6643 friend class Class; |
6642 }; | 6644 }; |
6643 | 6645 |
6644 | 6646 |
6647 class UserTag : public Instance { | |
6648 public: | |
6649 intptr_t tag() const { return raw_ptr()->tag(); } | |
6650 void set_tag(intptr_t t) const { | |
6651 ASSERT(t >= UserTagHelper::kUserTagIdOffset); | |
6652 ASSERT(t < UserTagHelper::kUserTagIdOffset + UserTagHelper::kMaxUserTags); | |
6653 raw_ptr()->tag_ = t; | |
6654 }; | |
6655 | |
6656 RawString* label() const { | |
6657 return raw_ptr()->label_; | |
6658 } | |
6659 | |
6660 void make_active(); | |
srdjan
2014/04/09 17:08:18
MakeActive
Cutch
2014/04/09 20:28:54
Done.
| |
6661 | |
6662 static intptr_t InstanceSize() { | |
6663 return RoundedAllocationSize(sizeof(RawUserTag)); | |
6664 } | |
6665 | |
6666 static RawUserTag* New(const String& label, | |
6667 Heap::Space space = Heap::kOld); | |
6668 | |
6669 static bool TagTableFull(Isolate* isolate); | |
srdjan
2014/04/09 17:08:18
TagTableIsFull ?
Cutch
2014/04/09 20:28:54
Done.
| |
6670 | |
6671 private: | |
6672 static RawUserTag* FindTagInIsolate(Isolate* isolate, const String& label); | |
6673 static void AddTagToIsolate(Isolate* isolate, const UserTag& tag); | |
6674 | |
6675 static intptr_t FindAvailableTagId(Isolate* isolate); | |
6676 void set_label(const String& tag_label) const { | |
6677 StorePointer(&raw_ptr()->label_, tag_label.raw()); | |
6678 } | |
6679 | |
6680 FINAL_HEAP_OBJECT_IMPLEMENTATION(UserTag, Instance); | |
6681 friend class Class; | |
6682 }; | |
6683 | |
6684 | |
6645 // Breaking cycles and loops. | 6685 // Breaking cycles and loops. |
6646 RawClass* Object::clazz() const { | 6686 RawClass* Object::clazz() const { |
6647 uword raw_value = reinterpret_cast<uword>(raw_); | 6687 uword raw_value = reinterpret_cast<uword>(raw_); |
6648 if ((raw_value & kSmiTagMask) == kSmiTag) { | 6688 if ((raw_value & kSmiTagMask) == kSmiTag) { |
6649 return Smi::Class(); | 6689 return Smi::Class(); |
6650 } | 6690 } |
6651 return Isolate::Current()->class_table()->At(raw()->GetClassId()); | 6691 return Isolate::Current()->class_table()->At(raw()->GetClassId()); |
6652 } | 6692 } |
6653 | 6693 |
6654 | 6694 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6775 | 6815 |
6776 | 6816 |
6777 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6817 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6778 intptr_t index) { | 6818 intptr_t index) { |
6779 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6819 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6780 } | 6820 } |
6781 | 6821 |
6782 } // namespace dart | 6822 } // namespace dart |
6783 | 6823 |
6784 #endif // VM_OBJECT_H_ | 6824 #endif // VM_OBJECT_H_ |
OLD | NEW |