summaryrefslogtreecommitdiff
path: root/deps/v8/src/code-comments.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/code-comments.cc')
-rw-r--r--deps/v8/src/code-comments.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/deps/v8/src/code-comments.cc b/deps/v8/src/code-comments.cc
index 12b9f7c3a8..db5611c8dd 100644
--- a/deps/v8/src/code-comments.cc
+++ b/deps/v8/src/code-comments.cc
@@ -27,16 +27,19 @@ uint32_t CodeCommentEntry::size() const {
return kOffsetToCommentString + comment_length();
}
-CodeCommentsIterator::CodeCommentsIterator(Address code_comments_start)
+CodeCommentsIterator::CodeCommentsIterator(Address code_comments_start,
+ uint32_t code_comments_size)
: code_comments_start_(code_comments_start),
- current_entry_(code_comments_start + kOffsetToFirstCommentEntry) {}
-
-uint32_t CodeCommentsIterator::size() const {
- return code_comments_start_ != kNullAddress
- ? *reinterpret_cast<uint32_t*>(code_comments_start_)
- : 0;
+ code_comments_size_(code_comments_size),
+ current_entry_(code_comments_start + kOffsetToFirstCommentEntry) {
+ DCHECK_NE(kNullAddress, code_comments_start);
+ DCHECK_IMPLIES(
+ code_comments_size,
+ code_comments_size == *reinterpret_cast<uint32_t*>(code_comments_start_));
}
+uint32_t CodeCommentsIterator::size() const { return code_comments_size_; }
+
const char* CodeCommentsIterator::GetComment() const {
const char* comment_string =
reinterpret_cast<const char*>(current_entry_ + kOffsetToCommentString);
@@ -84,8 +87,9 @@ uint32_t CodeCommentsWriter::section_size() const {
return kOffsetToFirstCommentEntry + static_cast<uint32_t>(byte_count_);
}
-void PrintCodeCommentsSection(std::ostream& out, Address code_comments_start) {
- CodeCommentsIterator it(code_comments_start);
+void PrintCodeCommentsSection(std::ostream& out, Address code_comments_start,
+ uint32_t code_comments_size) {
+ CodeCommentsIterator it(code_comments_start, code_comments_size);
out << "CodeComments (size = " << it.size() << ")\n";
if (it.HasCurrent()) {
out << std::setw(6) << "pc" << std::setw(6) << "len"