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

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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 2647
2647 static RawLibrary* AsyncLibrary(); 2648 static RawLibrary* AsyncLibrary();
2648 static RawLibrary* CoreLibrary(); 2649 static RawLibrary* CoreLibrary();
2649 static RawLibrary* CollectionLibrary(); 2650 static RawLibrary* CollectionLibrary();
2650 static RawLibrary* InternalLibrary(); 2651 static RawLibrary* InternalLibrary();
2651 static RawLibrary* IsolateLibrary(); 2652 static RawLibrary* IsolateLibrary();
2652 static RawLibrary* MathLibrary(); 2653 static RawLibrary* MathLibrary();
2653 static RawLibrary* MirrorsLibrary(); 2654 static RawLibrary* MirrorsLibrary();
2654 static RawLibrary* NativeWrappersLibrary(); 2655 static RawLibrary* NativeWrappersLibrary();
2655 static RawLibrary* TypedDataLibrary(); 2656 static RawLibrary* TypedDataLibrary();
2657 static RawLibrary* ProfilerLibrary();
2656 2658
2657 // Eagerly compile all classes and functions in the library. 2659 // Eagerly compile all classes and functions in the library.
2658 static RawError* CompileAll(); 2660 static RawError* CompileAll();
2659 2661
2660 // Checks function fingerprints. Prints mismatches and aborts if 2662 // Checks function fingerprints. Prints mismatches and aborts if
2661 // mismatch found. 2663 // mismatch found.
2662 static void CheckFunctionFingerprints(); 2664 static void CheckFunctionFingerprints();
2663 2665
2664 static bool IsPrivate(const String& name); 2666 static bool IsPrivate(const String& name);
2665 // Construct the full name of a corelib member. 2667 // Construct the full name of a corelib member.
(...skipping 3976 matching lines...) Expand 10 before | Expand all | Expand 10 after
6642 static intptr_t InstanceSize() { 6644 static intptr_t InstanceSize() {
6643 return RoundedAllocationSize(sizeof(RawMirrorReference)); 6645 return RoundedAllocationSize(sizeof(RawMirrorReference));
6644 } 6646 }
6645 6647
6646 private: 6648 private:
6647 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance); 6649 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance);
6648 friend class Class; 6650 friend class Class;
6649 }; 6651 };
6650 6652
6651 6653
6654 class UserTag : public Instance {
6655 public:
6656 uword tag() const { return raw_ptr()->tag(); }
6657 void set_tag(uword t) const {
6658 ASSERT(t >= UserTags::kUserTagIdOffset);
6659 ASSERT(t < UserTags::kUserTagIdOffset + UserTags::kMaxUserTags);
6660 raw_ptr()->tag_ = t;
6661 };
6662
6663 RawString* label() const {
6664 return raw_ptr()->label_;
6665 }
6666
6667 void MakeActive() const;
6668 static void ClearActive();
6669
6670 static intptr_t InstanceSize() {
6671 return RoundedAllocationSize(sizeof(RawUserTag));
6672 }
6673
6674 static RawUserTag* New(const String& label,
6675 Heap::Space space = Heap::kOld);
6676
6677 static bool TagTableIsFull(Isolate* isolate);
6678 static RawUserTag* FindTagById(uword tag_id);
6679
6680 private:
6681 static RawUserTag* FindTagInIsolate(Isolate* isolate, const String& label);
6682 static void AddTagToIsolate(Isolate* isolate, const UserTag& tag);
6683
6684 void set_label(const String& tag_label) const {
6685 StorePointer(&raw_ptr()->label_, tag_label.raw());
6686 }
6687
6688 FINAL_HEAP_OBJECT_IMPLEMENTATION(UserTag, Instance);
6689 friend class Class;
6690 };
6691
6692
6652 // Breaking cycles and loops. 6693 // Breaking cycles and loops.
6653 RawClass* Object::clazz() const { 6694 RawClass* Object::clazz() const {
6654 uword raw_value = reinterpret_cast<uword>(raw_); 6695 uword raw_value = reinterpret_cast<uword>(raw_);
6655 if ((raw_value & kSmiTagMask) == kSmiTag) { 6696 if ((raw_value & kSmiTagMask) == kSmiTag) {
6656 return Smi::Class(); 6697 return Smi::Class();
6657 } 6698 }
6658 return Isolate::Current()->class_table()->At(raw()->GetClassId()); 6699 return Isolate::Current()->class_table()->At(raw()->GetClassId());
6659 } 6700 }
6660 6701
6661 6702
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 6823
6783 6824
6784 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6825 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6785 intptr_t index) { 6826 intptr_t index) {
6786 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6827 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6787 } 6828 }
6788 6829
6789 } // namespace dart 6830 } // namespace dart
6790 6831
6791 #endif // VM_OBJECT_H_ 6832 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698