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

Unified Diff: src/isolate.cc

Issue 16578008: Improved function entry hook coverage (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@post_fix
Patch Set: WIP: Fix X64 implementation. Created 7 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/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
old mode 100644
new mode 100755
index 6c797b252280a75680aa1f1c0f23cf58557d9f7e..176c1554e5bde7b49b52547b26f9ca7056c83193
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1754,8 +1754,10 @@ Isolate::Isolate()
date_cache_(NULL),
code_stub_interface_descriptors_(NULL),
context_exit_happened_(false),
+ initialized_from_snapshot_(false),
cpu_profiler_(NULL),
heap_profiler_(NULL),
+ function_entry_hook_(NullFunctionEntryHook),
deferred_handles_head_(NULL),
optimizing_compiler_thread_(this),
marking_thread_(NULL),
@@ -1932,6 +1934,13 @@ void Isolate::SetIsolateThreadLocals(Isolate* isolate,
}
+void Isolate::NullFunctionEntryHook(uintptr_t function,
+ uintptr_t return_addr_location) {
+ // Ignore callbacks.
+}
+
+
+
Isolate::~Isolate() {
TRACE_ISOLATE(destructor);
@@ -2081,6 +2090,14 @@ bool Isolate::Init(Deserializer* des) {
ASSERT(Isolate::Current() == this);
TRACE_ISOLATE(init);
+ // When function entry hooking is in effect, we have to create the
+ // code stubs from scratch to get entry hooks, rather than loading the
+ // previously generated stubs from disk. There need to be guards on
+ // isolate creation to
+ if (HasFunctionEntryHook()) {
+ ASSERT(des == NULL);
+ }
+
// The initialization process does not handle memory exhaustion.
DisallowAllocationFailure disallow_allocation_failure;
@@ -2151,6 +2168,7 @@ bool Isolate::Init(Deserializer* des) {
deoptimizer_data_ = new DeoptimizerData(memory_allocator_);
const bool create_heap_objects = (des == NULL);
+
danno 2013/06/13 15:33:44 Stray whitespace change?
Sigurður Ásgeirsson 2013/06/19 20:51:51 Done.
if (create_heap_objects && !heap_.CreateHeapObjects()) {
V8::FatalProcessOutOfMemory("heap object creation");
return false;
@@ -2300,6 +2318,9 @@ bool Isolate::Init(Deserializer* des) {
SystemThreadManager::PARALLEL_RECOMPILATION) == 0) {
FLAG_parallel_recompilation = false;
}
+
+ initialized_from_snapshot_ = (des != NULL);
+
return true;
}
@@ -2425,6 +2446,26 @@ HTracer* Isolate::GetHTracer() {
}
+FunctionEntryHook Isolate::GetFunctionEntryHook() {
+ if (function_entry_hook_ == NullFunctionEntryHook)
+ return NULL;
+
+ return function_entry_hook_;
+}
+
+
+void Isolate::SetFunctionEntryHook(FunctionEntryHook function_entry_hook) {
+ if (function_entry_hook == NULL && function_entry_hook_ != NULL) {
danno 2013/06/13 15:33:44 Might it be a little clearer if you can never pass
Sigurður Ásgeirsson 2013/06/19 20:51:51 I made this one-way as we'd discussed. It makes ev
+ // After an entry hook has once been set on an isolate, the injected entry
+ // hooking code can't be revoked, and we don't want it calling NULL.
+ // So instead of NULLing the function, we divert it to a no-op.
+ function_entry_hook_ = NullFunctionEntryHook;
+ } else {
+ function_entry_hook_ = function_entry_hook;
+ }
+}
+
+
Map* Isolate::get_initial_js_array_map(ElementsKind kind) {
Context* native_context = context()->native_context();
Object* maybe_map_array = native_context->js_array_maps();

Powered by Google App Engine
This is Rietveld 408576698