Index: src/code-events.h |
diff --git a/src/platform-posix.h b/src/code-events.h |
similarity index 57% |
copy from src/platform-posix.h |
copy to src/code-events.h |
index 7a982ed2ef3080dad77860d6f46b356a9067bf3b..8e0a7fef7d128a7596f58cb04a3308d18fc46551 100644 |
--- a/src/platform-posix.h |
+++ b/src/code-events.h |
@@ -25,15 +25,54 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#ifndef V8_PLATFORM_POSIX_H_ |
-#define V8_PLATFORM_POSIX_H_ |
+#ifndef V8_CODE_EVENTS_H_ |
+#define V8_CODE_EVENTS_H_ |
+ |
+#include "allocation.h" |
namespace v8 { |
namespace internal { |
-// Used by platform implementation files during OS::PostSetUp(). |
-void POSIXPostSetUp(); |
+class CompilationInfo; |
+ |
+class CodeEvents : public AllStatic { |
+ public: |
+ static bool is_active() { |
+ return event_handler_ != NULL; |
+ } |
+ |
+ static void set_handler(JitCodeEventHandler event_handler) { |
+ event_handler_ = event_handler; |
+ } |
+ |
+ // Code added notifications. |
+ static void AddCode(const char* name, |
+ Code* code, |
+ Script* script, |
+ CompilationInfo* info); |
+ // TODO(siggi): Remove this variant. |
+ static void AddCode(Handle<String> name, |
+ Handle<Script> script, |
+ Handle<Code> code, |
+ CompilationInfo* info); |
+ static void AddCode(String* name, Code* code); |
+ // TODO(siggi): Fold these two variants. |
+ static void AddCode(const char* name, Code* code); |
+ static void AddCode(Code* code); |
+ |
+ // Code moved notification. |
+ static void MoveCode(Address src, Address dst); |
+ |
+ // Code removed notification. |
+ static void RemoveCode(Code* code); |
+ |
+ private: |
+ static JitCodeEventHandler event_handler_; |
+}; |
+ |
+#define JIT_CODE_EVENT(action) \ |
+ do { if (CodeEvents::is_active()) CodeEvents::action; } while(0) |
} } // namespace v8::internal |
-#endif // V8_PLATFORM_POSIX_H_ |
+#endif // V8_CODE_EVENTS_H_ |