Index: src/counters.h |
diff --git a/src/counters.h b/src/counters.h |
index d2870c2fd2a95a28751683f43062d9850694fcf6..9edf2f45125e4864fdee9cf825abd52aa3d1464a 100644 |
--- a/src/counters.h |
+++ b/src/counters.h |
@@ -485,6 +485,7 @@ struct RuntimeCallCounter { |
const char* name; |
int64_t count = 0; |
+ bool enabled = true; |
base::TimeDelta time; |
}; |
@@ -503,9 +504,12 @@ class RuntimeCallTimer { |
counter_->count++; |
} |
+ inline bool enabled() { return counter_ != NULL; } |
+ |
inline RuntimeCallTimer* Stop() { |
base::TimeDelta delta = timer_.Elapsed(); |
counter_->time += delta; |
+ |
if (parent_ != NULL) { |
parent_->AdjustForSubTimer(delta); |
} |
@@ -522,13 +526,171 @@ class RuntimeCallTimer { |
base::ElapsedTimer timer_; |
}; |
+#define API_COUNTER(V) \ |
+ V(Array_New) \ |
+ V(BooleanObject_BooleanValue) \ |
+ V(BooleanObject_New) \ |
+ V(Context_New) \ |
+ V(Date_DateTimeConfigurationChangeNotification) \ |
+ V(Date_New) \ |
+ V(Date_NumberValue) \ |
+ V(Error) \ |
+ V(External_New) \ |
+ V(Function_New) \ |
+ V(FunctionTemplate_New) \ |
+ V(FunctionTemplate_NewWithFastHandler) \ |
+ V(Int32Value) \ |
+ V(IntegerValue) \ |
+ V(JSON_Parse) \ |
+ V(JSON_Stringify) \ |
+ V(Map_AsArray) \ |
+ V(Map_Clear) \ |
+ V(Map_Delete) \ |
+ V(Map_Get) \ |
+ V(Map_Has) \ |
+ V(Map_New) \ |
+ V(Map_Set) \ |
+ V(NumberObject_New) \ |
+ V(NumberObject_NumberValue) \ |
+ V(NumberValue) \ |
+ V(Object_New) \ |
+ V(ObjectTemplate_New) \ |
+ V(Persistent_New) \ |
+ V(Private_New) \ |
+ V(Promise_Catch) \ |
+ V(Promise_Chain) \ |
+ V(Promise_HasRejectHandler) \ |
+ V(Promise_Resolver_New) \ |
+ V(Promise_Resolver_Resolve) \ |
+ V(Promise_Then) \ |
+ V(Proxy_New) \ |
+ V(RangeError) \ |
+ V(ReferenceError) \ |
+ V(RegExp_New) \ |
+ V(Set_Add) \ |
+ V(Set_AsArray) \ |
+ V(Set_Clear) \ |
+ V(Set_Delete) \ |
+ V(Set_Has) \ |
+ V(Set_New) \ |
+ V(String_NewExternalOneByte) \ |
+ V(String_NewExternalTwoByte) \ |
+ V(String_NewFromOneByte) \ |
+ V(String_NewFromTwoByte) \ |
+ V(String_NewFromUtf8) \ |
+ V(StringObject_New) \ |
+ V(StringObject_StringValue) \ |
+ V(String_Write) \ |
+ V(String_WriteUtf8) \ |
+ V(Symbol_New) \ |
+ V(SymbolObject_New) \ |
+ V(SymbolObject_SymbolValue) \ |
+ V(SyntaxError) \ |
+ V(ToArrayIndex) \ |
+ V(ToDetailString) \ |
+ V(ToInt32) \ |
+ V(ToInteger) \ |
+ V(ToNumber) \ |
+ V(ToObject) \ |
+ V(ToString) \ |
+ V(ToUint32) \ |
+ V(TypeError) \ |
+ V(Uint32Value) \ |
+ V(UnboundScript_GetLineNumber) \ |
+ V(UnboundScript_GetName) \ |
+ V(UnboundScript_GetSourceMappingURL) \ |
+ V(UnboundScript_GetSourceURL) \ |
+ V(v8_ArrayBuffer_Cast) \ |
+ V(v8_ArrayBuffer_Neuter) \ |
+ V(v8_ArrayBuffer_New) \ |
+ V(v8_Array_CloneElementAt) \ |
+ V(v8_DataView_New) \ |
+ V(v8_Debug_Call) \ |
+ V(v8_Debug_GetMirror) \ |
+ V(v8_Float32Array_New) \ |
+ V(v8_Float64Array_New) \ |
+ V(v8_Function_Call) \ |
+ V(v8_Function_NewInstance) \ |
+ V(v8_FunctionTemplate_GetFunction) \ |
+ V(v8_Int16Array_New) \ |
+ V(v8_Int32Array_New) \ |
+ V(v8_Int8Array_New) \ |
+ V(v8_Message_GetEndColumn) \ |
+ V(v8_Message_GetLineNumber) \ |
+ V(v8_Message_GetSourceLine) \ |
+ V(v8_Message_GetStartColumn) \ |
+ V(v8_Object_CallAsConstructor) \ |
+ V(v8_Object_CallAsFunction) \ |
+ V(v8_Object_CreateDataProperty) \ |
+ V(v8_Object_DefineOwnProperty) \ |
+ V(v8_Object_Delete) \ |
+ V(v8_Object_DeleteProperty) \ |
+ V(v8_Object_ForceSet) \ |
+ V(v8_Object_Get) \ |
+ V(v8_Object_GetOwnPropertyDescriptor) \ |
+ V(v8_Object_GetOwnPropertyNames) \ |
+ V(v8_Object_GetPropertyAttributes) \ |
+ V(v8_Object_GetPropertyNames) \ |
+ V(v8_Object_GetRealNamedProperty) \ |
+ V(v8_Object_GetRealNamedPropertyAttributes) \ |
+ V(v8_Object_GetRealNamedPropertyAttributesInPrototypeChain) \ |
+ V(v8_Object_GetRealNamedPropertyInPrototypeChain) \ |
+ V(v8_Object_HasOwnProperty) \ |
+ V(v8_Object_HasRealIndexedProperty) \ |
+ V(v8_Object_HasRealNamedCallbackProperty) \ |
+ V(v8_Object_HasRealNamedProperty) \ |
+ V(v8_Object_ObjectProtoToString) \ |
+ V(v8_Object_Set) \ |
+ V(v8_Object_SetAccessor) \ |
+ V(v8_Object_SetIntegrityLevel) \ |
+ V(v8_Object_SetPrivate) \ |
+ V(v8_Object_SetPrototype) \ |
+ V(v8_ObjectTemplate_NewInstance) \ |
+ V(v8_ScriptCompiler_Compile) \ |
+ V(v8_ScriptCompiler_CompileFunctionInContext) \ |
+ V(v8_ScriptCompiler_CompileUnbound) \ |
+ V(v8_Script_Run) \ |
+ V(v8_SharedArrayBuffer_New) \ |
+ V(v8_String_Concat) \ |
+ V(v8_TryCatch_StackTrace) \ |
+ V(v8_Uint16Array_New) \ |
+ V(v8_Uint32Array_New) \ |
+ V(v8_Uint8Array_New) \ |
+ V(v8_Uint8ClampedArray_New) \ |
+ V(v8_UnboundScript_GetId) |
+ |
+#define OTHER_COUNTER(V) \ |
+ V(AccessorGetterCallback) \ |
+ V(AccessorNameGetterCallback) \ |
+ V(AccessorNameSetterCallback) \ |
+ V(FunctionCallback) \ |
+ V(GC) \ |
+ V(GenericNamedPropertyDeleterCallback) \ |
+ V(GenericNamedPropertyQueryCallback) \ |
+ V(GenericNamedPropertySetterCallback) \ |
+ V(IndexedPropertyDeleterCallback) \ |
+ V(IndexedPropertyGetterCallback) \ |
+ V(IndexedPropertyQueryCallback) \ |
+ V(IndexedPropertySetterCallback) \ |
+ V(InvokeFunctionCallback) \ |
+ V(JS_Execution) \ |
+ V(RecompileConcurrent) \ |
+ V(RecompileSynchronous) \ |
+ V(DeoptimizeCode) \ |
+ V(OptimizeCode) \ |
+ V(CompileFullCode) \ |
+ V(CompileIgnition) \ |
+ V(CompileEval) \ |
+ V(Compile) \ |
+ V(CompileSerialize) \ |
+ V(CompileDeserialize) \ |
+ V(ParseLazy) \ |
+ V(Parse) \ |
+ V(CompileCode) \ |
+ V(PropertyCallback) \ |
+ V(UnexpectedStubMiss) |
+ |
struct RuntimeCallStats { |
- // Dummy counter for the unexpected stub miss. |
- RuntimeCallCounter UnexpectedStubMiss = |
- RuntimeCallCounter("UnexpectedStubMiss"); |
- // Counter for runtime callbacks into JavaScript. |
- RuntimeCallCounter ExternalCallback = RuntimeCallCounter("ExternalCallback"); |
- RuntimeCallCounter GC = RuntimeCallCounter("GC"); |
#define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ |
RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name); |
FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) |
@@ -537,6 +699,14 @@ struct RuntimeCallStats { |
RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name); |
BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) |
#undef CALL_BUILTIN_COUNTER |
+#define CALL_BUILTIN_COUNTER(name) \ |
+ RuntimeCallCounter API_##name = RuntimeCallCounter("API_" #name); |
+ API_COUNTER(CALL_BUILTIN_COUNTER) |
+#undef CALL_BUILTIN_COUNTER |
+#define CALL_BUILTIN_COUNTER(name) \ |
+ RuntimeCallCounter name = RuntimeCallCounter(#name); |
+ OTHER_COUNTER(CALL_BUILTIN_COUNTER) |
+#undef CALL_BUILTIN_COUNTER |
// Counter to track recursive time events. |
RuntimeCallTimer* current_timer_ = NULL; |