OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_DART_H_ | 5 #ifndef VM_DART_H_ |
6 #define VM_DART_H_ | 6 #define VM_DART_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // Forward declarations. | 13 // Forward declarations. |
14 class DebugInfo; | 14 class DebugInfo; |
15 class Isolate; | 15 class Isolate; |
16 class RawError; | 16 class RawError; |
17 class ThreadPool; | 17 class ThreadPool; |
18 | 18 |
19 // Object observing code creation events. Used by external profilers and | |
20 // debuggers to map address ranges to function names. | |
21 class CodeObserver { | |
Ivan Posva
2012/11/27 09:11:20
I am not certain whether this belongs into this fi
Vyacheslav Egorov (Google)
2012/11/27 16:26:12
Moved all code observers related code to a separat
| |
22 public: | |
23 virtual ~CodeObserver() { } | |
24 | |
25 // Returns true if this observer is active and should be notified | |
26 // about newly created code objects. | |
27 virtual bool IsActive() const = 0; | |
28 | |
29 // Notify code observer about newly created code object with the | |
Ivan Posva
2012/11/27 09:11:20
about a newly
Vyacheslav Egorov (Google)
2012/11/27 16:26:12
Done.
| |
30 // given properties. | |
31 virtual void Notify(const char* name, | |
32 uword base, | |
33 uword prologue_offset, | |
34 uword size, | |
35 bool optimized) = 0; | |
36 }; | |
37 | |
19 class Dart : public AllStatic { | 38 class Dart : public AllStatic { |
20 public: | 39 public: |
21 static const char* InitOnce(Dart_IsolateCreateCallback create, | 40 static const char* InitOnce(Dart_IsolateCreateCallback create, |
22 Dart_IsolateInterruptCallback interrupt, | 41 Dart_IsolateInterruptCallback interrupt, |
23 Dart_IsolateShutdownCallback shutdown); | 42 Dart_IsolateShutdownCallback shutdown); |
24 | 43 |
25 static Isolate* CreateIsolate(const char* name_prefix); | 44 static Isolate* CreateIsolate(const char* name_prefix); |
26 static RawError* InitializeIsolate(const uint8_t* snapshot, void* data); | 45 static RawError* InitializeIsolate(const uint8_t* snapshot, void* data); |
27 static void ShutdownIsolate(); | 46 static void ShutdownIsolate(); |
28 | 47 |
(...skipping 12 matching lines...) Expand all Loading... | |
41 } | 60 } |
42 static DebugInfo* pprof_symbol_generator() { return pprof_symbol_generator_; } | 61 static DebugInfo* pprof_symbol_generator() { return pprof_symbol_generator_; } |
43 | 62 |
44 static void set_flow_graph_writer(Dart_FileWriterFunction writer_function) { | 63 static void set_flow_graph_writer(Dart_FileWriterFunction writer_function) { |
45 flow_graph_writer_ = writer_function; | 64 flow_graph_writer_ = writer_function; |
46 } | 65 } |
47 static Dart_FileWriterFunction flow_graph_writer() { | 66 static Dart_FileWriterFunction flow_graph_writer() { |
48 return flow_graph_writer_; | 67 return flow_graph_writer_; |
49 } | 68 } |
50 | 69 |
70 static void RegisterCodeObserver(CodeObserver* observer); | |
71 | |
72 // Notify all active code observers about newly created code object. | |
73 static void NotifyCodeObservers(const char* name, | |
74 uword base, | |
75 uword prologue_offset, | |
76 uword size, | |
77 bool optimized); | |
78 | |
79 // Returns true if there is at least one active code observer. | |
80 static bool AreCodeObserversActive(); | |
81 | |
51 private: | 82 private: |
83 static void RegisterDefaultCodeObservers(); | |
84 | |
52 static Isolate* vm_isolate_; | 85 static Isolate* vm_isolate_; |
53 static ThreadPool* thread_pool_; | 86 static ThreadPool* thread_pool_; |
54 static Dart_FileWriterFunction perf_events_writer_; | 87 static Dart_FileWriterFunction perf_events_writer_; |
55 static DebugInfo* pprof_symbol_generator_; | 88 static DebugInfo* pprof_symbol_generator_; |
56 static Dart_FileWriterFunction flow_graph_writer_; | 89 static Dart_FileWriterFunction flow_graph_writer_; |
90 | |
91 static intptr_t code_observers_length_; | |
92 static CodeObserver** code_observers_; | |
57 }; | 93 }; |
58 | 94 |
59 } // namespace dart | 95 } // namespace dart |
60 | 96 |
61 #endif // VM_DART_H_ | 97 #endif // VM_DART_H_ |
OLD | NEW |