Revision: 21925
Author: [email protected]
Date: Mon Jun 23 09:46:58 2014 UTC
Log: Add a use counter API
This lets embedders track certain features of v8 and the number of times
they are used
BUG=none
[email protected], [email protected]
LOG=y
Review URL: https://codereview.chromium.org/346233002
http://code.google.com/p/v8/source/detail?r=21925
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/isolate.h
=======================================
--- /branches/bleeding_edge/include/v8.h Fri Jun 20 23:02:36 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Mon Jun 23 09:46:58 2014 UTC
@@ -4128,6 +4128,19 @@
kMinorGarbageCollection
};
+ /**
+ * Features reported via the SetUseCounterCallback callback. Do not chang
+ * assigned numbers of existing items; add new features to the end of
this
+ * list.
+ */
+ enum UseCounterFeature {
+ kUseAsm = 0
+ };
+
+ typedef void (*UseCounterCallback)(Isolate* isolate,
+ UseCounterFeature feature);
+
+
/**
* Creates a new isolate. Does not change the currently entered
* isolate.
@@ -4397,6 +4410,11 @@
*/
bool WillAutorunMicrotasks() const;
+ /**
+ * Sets a callback for counting the number of times a feature of V8 is
used.
+ */
+ void SetUseCounterCallback(UseCounterCallback callback);
+
private:
template<class K, class V, class Traits> friend class PersistentValueMap;
=======================================
--- /branches/bleeding_edge/src/api.cc Mon Jun 23 09:02:16 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Mon Jun 23 09:46:58 2014 UTC
@@ -6716,6 +6716,11 @@
bool Isolate::WillAutorunMicrotasks() const {
return reinterpret_cast<const i::Isolate*>(this)->autorun_microtasks();
}
+
+
+void Isolate::SetUseCounterCallback(UseCounterCallback callback) {
+ reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback);
+}
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
=======================================
--- /branches/bleeding_edge/src/isolate.cc Fri Jun 20 14:27:55 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc Mon Jun 23 09:46:58 2014 UTC
@@ -2341,6 +2341,19 @@
}
}
}
+
+
+void Isolate::SetUseCounterCallback(v8::Isolate::UseCounterCallback
callback) {
+ ASSERT(!use_counter_callback_);
+ use_counter_callback_ = callback;
+}
+
+
+void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) {
+ if (use_counter_callback_) {
+ use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature);
+ }
+}
bool StackLimitCheck::JsHasOverflowed() const {
=======================================
--- /branches/bleeding_edge/src/isolate.h Fri Jun 20 08:40:11 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h Mon Jun 23 09:46:58 2014 UTC
@@ -1081,6 +1081,9 @@
void EnqueueMicrotask(Handle<Object> microtask);
void RunMicrotasks();
+ void SetUseCounterCallback(v8::Isolate::UseCounterCallback callback);
+ void CountUsage(v8::Isolate::UseCounterFeature feature);
+
private:
Isolate();
@@ -1300,6 +1303,8 @@
// List of callbacks when a Call completes.
List<CallCompletedCallback> call_completed_callbacks_;
+ v8::Isolate::UseCounterCallback use_counter_callback_;
+
friend class ExecutionAccess;
friend class HandleScopeImplementer;
friend class IsolateInitializer;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.