Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: runtime/vm/object.h

Issue 230863005: Initial UserTag and dart:profiler library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 uword tag() const { return raw_ptr()->tag(); }
6650 void set_tag(uword t) const {
6651 ASSERT(t >= UserTags::kUserTagIdOffset);
6652 ASSERT(t < UserTags::kUserTagIdOffset + UserTags::kMaxUserTags);
6653 raw_ptr()->tag_ = t;
6654 };
6655
6656 RawString* label() const {
6657 return raw_ptr()->label_;
6658 }
6659
6660 void MakeActive() const;
6661 static void ClearActive();
6662
6663 static intptr_t InstanceSize() {
6664 return RoundedAllocationSize(sizeof(RawUserTag));
6665 }
6666
6667 static RawUserTag* New(const String& label,
6668 Heap::Space space = Heap::kOld);
6669
6670 static bool TagTableIsFull(Isolate* isolate);
6671 static RawUserTag* FindTagById(uword tag_id);
6672
6673 private:
6674 static RawUserTag* FindTagInIsolate(Isolate* isolate, const String& label);
6675 static void AddTagToIsolate(Isolate* isolate, const UserTag& tag);
6676
6677 void set_label(const String& tag_label) const {
6678 StorePointer(&raw_ptr()->label_, tag_label.raw());
6679 }
6680
6681 FINAL_HEAP_OBJECT_IMPLEMENTATION(UserTag, Instance);
6682 friend class Class;
6683 };
6684
6685
6645 // Breaking cycles and loops. 6686 // Breaking cycles and loops.
6646 RawClass* Object::clazz() const { 6687 RawClass* Object::clazz() const {
6647 uword raw_value = reinterpret_cast<uword>(raw_); 6688 uword raw_value = reinterpret_cast<uword>(raw_);
6648 if ((raw_value & kSmiTagMask) == kSmiTag) { 6689 if ((raw_value & kSmiTagMask) == kSmiTag) {
6649 return Smi::Class(); 6690 return Smi::Class();
6650 } 6691 }
6651 return Isolate::Current()->class_table()->At(raw()->GetClassId()); 6692 return Isolate::Current()->class_table()->At(raw()->GetClassId());
6652 } 6693 }
6653 6694
6654 6695
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
6775 6816
6776 6817
6777 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6818 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6778 intptr_t index) { 6819 intptr_t index) {
6779 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6820 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6780 } 6821 }
6781 6822
6782 } // namespace dart 6823 } // namespace dart
6783 6824
6784 #endif // VM_OBJECT_H_ 6825 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698