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

Unified Diff: src/v8.cc

Issue 10706002: Implements a new API to set a function entry hook for profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Sketch ARM code stub. Created 8 years, 6 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/v8.cc
diff --git a/src/v8.cc b/src/v8.cc
index 2910a0700d92223521dddf8a072fc65fb6fa9615..96ffcd581edc69dde6a0611457dc6f81845a33c1 100644
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -60,6 +60,8 @@ static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER;
static EntropySource entropy_source;
+static FunctionEntryHook profiler_entry_hook = NULL;
+
bool V8::Initialize(Deserializer* des) {
FlagList::EnforceFlagImplications();
@@ -164,6 +166,37 @@ void V8::SetReturnAddressLocationResolver(
}
+bool V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) {
+ // We don't allow setting a new entry hook over one that's
+ // already active, as the hooks won't stack.
+ if (entry_hook != 0 && profiler_entry_hook != 0)
+ return false;
+
+ profiler_entry_hook = entry_hook;
+
+ return true;
+}
+
+
+static void EntryHookDispatcher(intptr_t function,
+ intptr_t stack_pointer,
+ uint64_t entry_time) {
+ if (profiler_entry_hook != NULL)
+ profiler_entry_hook(function, stack_pointer, entry_time);
danno 2012/07/10 09:37:13 80 col?
Sigurður Ásgeirsson 2012/07/11 14:50:34 Done.
+}
+
+
+
+const FunctionEntryHook* V8::GetFunctionEntryHookLocation() {
+ return &profiler_entry_hook;
+}
+
+
+FunctionEntryHook V8::GetFunctionEntryHookDispatcher() {
+ return EntryHookDispatcher;
+}
+
+
// Used by JavaScript APIs
uint32_t V8::Random(Context* context) {
ASSERT(context->IsGlobalContext());

Powered by Google App Engine
This is Rietveld 408576698