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

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: Back out unintentional changes. 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
« include/v8.h ('K') | « src/builtins.cc ('k') | src/code-events.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-events.h
diff --git a/src/code.h b/src/code-events.h
similarity index 58%
copy from src/code.h
copy to src/code-events.h
index 766c932e0f6182697670996180f5f66829751245..09e7711739e8a1b6d524772f40e0dc8255c2d00c 100644
--- a/src/code.h
+++ b/src/code-events.h
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,46 +25,52 @@
// (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_CODE_H_
-#define V8_CODE_H_
+#ifndef V8_CODE_EVENTS_H_
+#define V8_CODE_EVENTS_H_
#include "allocation.h"
namespace v8 {
namespace internal {
+class CompilationInfo;
-// Wrapper class for passing expected and actual parameter counts as
-// either registers or immediate values. Used to make sure that the
-// caller provides exactly the expected number of parameters to the
-// callee.
-class ParameterCount BASE_EMBEDDED {
+class CodeEvents : public AllStatic {
public:
- explicit ParameterCount(Register reg)
- : reg_(reg), immediate_(0) { }
- explicit ParameterCount(int immediate)
- : reg_(no_reg), immediate_(immediate) { }
-
- bool is_reg() const { return !reg_.is(no_reg); }
- bool is_immediate() const { return !is_reg(); }
-
- Register reg() const {
- ASSERT(is_reg());
- return reg_;
+ static bool is_active() {
+ return event_handler_ != NULL;
}
- int immediate() const {
- ASSERT(is_immediate());
- return immediate_;
+
+ static void set_handler(JitCodeEventHandler event_handler) {
+ event_handler_ = event_handler;
}
- private:
- const Register reg_;
- const int immediate_;
+ // Code added notifications.
+ static void AddCode(const char* name,
+ Code* code,
+ Script* script,
+ CompilationInfo* info);
+ static void AddCode(Handle<String> name,
+ Handle<Script> script,
+ Handle<Code> code,
+ CompilationInfo* info);
+ static void AddCode(String* name, Code* code);
+ static void AddCode(const char* name, Code* code);
+ static void AddCode(Code* code);
- DISALLOW_IMPLICIT_CONSTRUCTORS(ParameterCount);
+ // 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_CODE_H_
+#endif // V8_CODE_EVENTS_H_
« include/v8.h ('K') | « src/builtins.cc ('k') | src/code-events.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698