Chromium Code Reviews| 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; |
| } |
| } |