Add counters for the different code generators.
authorerik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 27 Jan 2010 11:08:32 +0000 (11:08 +0000)
committererik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 27 Jan 2010 11:08:32 +0000 (11:08 +0000)
Review URL: http://codereview.chromium.org/552184

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3714 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/codegen.cc
src/full-codegen.cc
src/v8-counters.h

index 3620e22f961961d5f6f420c8d42b7c8d7dfda8e9..aa2a2b82dffc79e2344859e7d63b99e4a80fbe13 100644 (file)
@@ -217,6 +217,10 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(FunctionLiteral* fun,
 Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* fun,
                                      Handle<Script> script,
                                      bool is_eval) {
+  if (!script->IsUndefined() && !script->source()->IsUndefined()) {
+    int len = String::cast(script->source())->length();
+    Counters::total_old_codegen_source_size.Increment(len);
+  }
   MakeCodePrologue(fun);
   // Generate code.
   const int kInitialBufferSize = 4 * KB;
index 17b94045288ee0e3a23a2e9ca9728c36ba572023..4bda3648efc4bb7bb8fb03e7875498610fea2f4f 100644 (file)
@@ -488,6 +488,10 @@ void FullCodeGenSyntaxChecker::VisitThisFunction(ThisFunction* expr) {
 Handle<Code> FullCodeGenerator::MakeCode(FunctionLiteral* fun,
                                          Handle<Script> script,
                                          bool is_eval) {
+  if (!script->IsUndefined() && !script->source()->IsUndefined()) {
+    int len = String::cast(script->source())->length();
+    Counters::total_full_codegen_source_size.Increment(len);
+  }
   CodeGenerator::MakeCodePrologue(fun);
   const int kInitialBufferSize = 4 * KB;
   MacroAssembler masm(NULL, kInitialBufferSize);
index fb1e9265e70dc93b93c01aac4ed8f38e217b0859..7397c3044c5b983212b37d4c464092e41dcb7104 100644 (file)
@@ -60,40 +60,44 @@ namespace internal {
 // lines) rather than one macro (of length about 80 lines) to work around
 // this problem.  Please avoid using recursive macros of this length when
 // possible.
-#define STATS_COUNTER_LIST_1(SC)                                 \
-  /* Global Handle Count*/                                       \
-  SC(global_handles, V8.GlobalHandles)                           \
-  /* Mallocs from PCRE */                                        \
-  SC(pcre_mallocs, V8.PcreMallocCount)                           \
-  /* OS Memory allocated */                                      \
-  SC(memory_allocated, V8.OsMemoryAllocated)                     \
-  SC(props_to_dictionary, V8.ObjectPropertiesToDictionary)       \
-  SC(elements_to_dictionary, V8.ObjectElementsToDictionary)      \
-  SC(alive_after_last_gc, V8.AliveAfterLastGC)                   \
-  SC(objs_since_last_young, V8.ObjsSinceLastYoung)               \
-  SC(objs_since_last_full, V8.ObjsSinceLastFull)                 \
-  SC(symbol_table_capacity, V8.SymbolTableCapacity)              \
-  SC(number_of_symbols, V8.NumberOfSymbols)                      \
-  SC(script_wrappers, V8.ScriptWrappers)                         \
-  SC(call_initialize_stubs, V8.CallInitializeStubs)              \
-  SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs)      \
-  SC(call_normal_stubs, V8.CallNormalStubs)                      \
-  SC(call_megamorphic_stubs, V8.CallMegamorphicStubs)            \
-  SC(arguments_adaptors, V8.ArgumentsAdaptors)                   \
-  SC(compilation_cache_hits, V8.CompilationCacheHits)            \
-  SC(compilation_cache_misses, V8.CompilationCacheMisses)        \
-  SC(regexp_cache_hits, V8.RegExpCacheHits)                      \
-  SC(regexp_cache_misses, V8.RegExpCacheMisses)                  \
-  /* Amount of evaled source code. */                            \
-  SC(total_eval_size, V8.TotalEvalSize)                          \
-  /* Amount of loaded source code. */                            \
-  SC(total_load_size, V8.TotalLoadSize)                          \
-  /* Amount of parsed source code. */                            \
-  SC(total_parse_size, V8.TotalParseSize)                        \
-  /* Amount of source code skipped over using preparsing. */     \
-  SC(total_preparse_skipped, V8.TotalPreparseSkipped)            \
-  /* Amount of compiled source code. */                          \
-  SC(total_compile_size, V8.TotalCompileSize)
+#define STATS_COUNTER_LIST_1(SC)                                      \
+  /* Global Handle Count*/                                            \
+  SC(global_handles, V8.GlobalHandles)                                \
+  /* Mallocs from PCRE */                                             \
+  SC(pcre_mallocs, V8.PcreMallocCount)                                \
+  /* OS Memory allocated */                                           \
+  SC(memory_allocated, V8.OsMemoryAllocated)                          \
+  SC(props_to_dictionary, V8.ObjectPropertiesToDictionary)            \
+  SC(elements_to_dictionary, V8.ObjectElementsToDictionary)           \
+  SC(alive_after_last_gc, V8.AliveAfterLastGC)                        \
+  SC(objs_since_last_young, V8.ObjsSinceLastYoung)                    \
+  SC(objs_since_last_full, V8.ObjsSinceLastFull)                      \
+  SC(symbol_table_capacity, V8.SymbolTableCapacity)                   \
+  SC(number_of_symbols, V8.NumberOfSymbols)                           \
+  SC(script_wrappers, V8.ScriptWrappers)                              \
+  SC(call_initialize_stubs, V8.CallInitializeStubs)                   \
+  SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs)           \
+  SC(call_normal_stubs, V8.CallNormalStubs)                           \
+  SC(call_megamorphic_stubs, V8.CallMegamorphicStubs)                 \
+  SC(arguments_adaptors, V8.ArgumentsAdaptors)                        \
+  SC(compilation_cache_hits, V8.CompilationCacheHits)                 \
+  SC(compilation_cache_misses, V8.CompilationCacheMisses)             \
+  SC(regexp_cache_hits, V8.RegExpCacheHits)                           \
+  SC(regexp_cache_misses, V8.RegExpCacheMisses)                       \
+  /* Amount of evaled source code. */                                 \
+  SC(total_eval_size, V8.TotalEvalSize)                               \
+  /* Amount of loaded source code. */                                 \
+  SC(total_load_size, V8.TotalLoadSize)                               \
+  /* Amount of parsed source code. */                                 \
+  SC(total_parse_size, V8.TotalParseSize)                             \
+  /* Amount of source code skipped over using preparsing. */          \
+  SC(total_preparse_skipped, V8.TotalPreparseSkipped)                 \
+  /* Amount of compiled source code. */                               \
+  SC(total_compile_size, V8.TotalCompileSize)                         \
+  /* Amount of source code compiled with the old codegen. */          \
+  SC(total_old_codegen_source_size, V8.TotalOldCodegenSourceSize)     \
+  /* Amount of source code compiled with the full codegen. */         \
+  SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize)
 
 
 #define STATS_COUNTER_LIST_2(SC)                                    \