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

Unified Diff: src/api.cc

Issue 59373003: AllocationProfiler: introduce allocation_profiler flag in V8 api. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8a73877eedec4b395078d7c7f2f84b103c5df763..c76539344e0694e60dbd4406db8a9ef201bcc0b3 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -283,9 +283,12 @@ static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
static bool InitializeHelper(i::Isolate* isolate) {
- // If the isolate has a function entry hook, it needs to re-build all its
- // code stubs with entry hooks embedded, so let's deserialize a snapshot.
- if (isolate == NULL || isolate->function_entry_hook() == NULL) {
+ // If the isolate has a function entry hook or enabled allocation profiler,
+ // it needs to re-build all its code stubs with embedded entry hooks
+ // or RecordObjectAllocation calls, so let's skip snapshot deserialization.
+ if (isolate == NULL || (
+ isolate->function_entry_hook() == NULL &&
+ !isolate->is_allocation_profiler_enabled())) {
if (i::Snapshot::Initialize())
return true;
}
@@ -4993,6 +4996,20 @@ void v8::V8::SetReturnAddressLocationResolver(
}
+bool v8::V8::EnableAllocationProfiler(Isolate* ext_isolate) {
+ ASSERT(ext_isolate != NULL);
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
+ return isolate->enable_allocation_profiler();
+}
+
+
+bool v8::V8::IsAllocationProfilerEnabled(Isolate* ext_isolate) {
+ ASSERT(ext_isolate != NULL);
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
+ return isolate->is_allocation_profiler_enabled();
+}
+
+
bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate,
FunctionEntryHook entry_hook) {
ASSERT(ext_isolate != NULL);

Powered by Google App Engine
This is Rietveld 408576698