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

Unified Diff: src/log.cc

Issue 2603333002: [profiler] Log both code and bytecode in heap SFI traversal (Closed)
Patch Set: Extract common code Created 3 years, 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index e303773310ad4239816ff20bb2baa215bb807f13..277dfa42ce879eb380aa4e1b2b7581e43e56823a 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -1329,6 +1329,17 @@ void Logger::LogFailure() {
StopProfiler();
}
+static void AddFunctionAndCode(SharedFunctionInfo* sfi,
+ AbstractCode* code_object,
+ Handle<SharedFunctionInfo>* sfis,
+ Handle<AbstractCode>* code_objects, int offset) {
+ if (sfis != NULL) {
+ sfis[offset] = Handle<SharedFunctionInfo>(sfi);
+ }
+ if (code_objects != NULL) {
+ code_objects[offset] = Handle<AbstractCode>(code_object);
+ }
+}
class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor {
public:
@@ -1345,14 +1356,11 @@ class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor {
Object* maybe_script = sfi->script();
if (maybe_script->IsScript()
&& !Script::cast(maybe_script)->HasValidSource()) return;
- if (sfis_ != NULL) {
- sfis_[*count_] = Handle<SharedFunctionInfo>(sfi);
- }
- if (code_objects_ != NULL) {
- DCHECK(function->abstract_code()->kind() ==
- AbstractCode::OPTIMIZED_FUNCTION);
- code_objects_[*count_] = Handle<AbstractCode>(function->abstract_code());
- }
+
+ DCHECK(function->abstract_code()->kind() ==
+ AbstractCode::OPTIMIZED_FUNCTION);
+ AddFunctionAndCode(sfi, function->abstract_code(), sfis_, code_objects_,
+ *count_);
*count_ = *count_ + 1;
}
@@ -1377,14 +1385,19 @@ static int EnumerateCompiledFunctions(Heap* heap,
if (sfi->is_compiled()
&& (!sfi->script()->IsScript()
|| Script::cast(sfi->script())->HasValidSource())) {
- if (sfis != NULL) {
- sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi);
+ // In some cases, an SFI might have (and have executing!) both bytecode
+ // and baseline code, so check for both and add them both if needed.
+ if (sfi->HasBytecodeArray()) {
+ AddFunctionAndCode(sfi, AbstractCode::cast(sfi->bytecode_array()), sfis,
+ code_objects, compiled_funcs_count);
+ ++compiled_funcs_count;
}
- if (code_objects != NULL) {
- code_objects[compiled_funcs_count] =
- Handle<AbstractCode>(sfi->abstract_code());
+
+ if (!sfi->IsInterpreted()) {
rmcilroy 2017/01/03 12:42:08 We might want to replace this with HasBaselineCode
+ AddFunctionAndCode(sfi, AbstractCode::cast(sfi->code()), sfis,
+ code_objects, compiled_funcs_count);
+ ++compiled_funcs_count;
}
- ++compiled_funcs_count;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698