diff options
Diffstat (limited to 'deps/v8/src/heap/code-stats.cc')
-rw-r--r-- | deps/v8/src/heap/code-stats.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/deps/v8/src/heap/code-stats.cc b/deps/v8/src/heap/code-stats.cc index 002aa44784..66d1791c26 100644 --- a/deps/v8/src/heap/code-stats.cc +++ b/deps/v8/src/heap/code-stats.cc @@ -199,14 +199,19 @@ void CodeStatistics::CollectCommentStatistics(Isolate* isolate, // Collects code comment statistics. void CodeStatistics::CollectCodeCommentStatistics(AbstractCode obj, Isolate* isolate) { - // Bytecode objects do not contain RelocInfo. Off-heap builtins might contain - // comments but they are a part of binary so it doesn't make sense to account - // them in the stats. - // Only process code objects for code comment statistics. - PtrComprCageBase cage_base(isolate); + // Bytecode objects do not contain RelocInfo. + PtrComprCageBase cage_base{isolate}; if (!obj.IsCode(cage_base)) return; Code code = Code::cast(obj); + + // Off-heap builtins might contain comments but they are a part of binary so + // it doesn't make sense to account them in the stats. + // TODO(jgruber): We can change this to `IsBuiltin` once it's guaranteed that + // non-builtin Code objects have an instruction_stream at all times (even + // during initialization). + if (!obj.has_instruction_stream(cage_base)) return; + CodeCommentsIterator cit(code.code_comments(), code.code_comments_size()); int delta = 0; int prev_pc_offset = 0; |