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

Unified Diff: src/code-events.h

Issue 10795074: Add a new API V8::SetJitCodeEventHandler to push code name and location to users such as profilers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix gcc compilation. Fix HandleScope lifetime in test. Add TODOs. Remove trailing WS. Amend docs pe… Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698