summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-code-pages.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-06-08 14:04:59 +0200
committerMichaël Zasso <targos@protonmail.com>2021-06-10 11:10:13 +0200
commita7cbf19a82c75e9a65e90fb8ba4947e2fc52ef39 (patch)
treedadfaa9c63c5d8db997b7c7aacc313b04131157c /deps/v8/test/cctest/test-code-pages.cc
parent8834ec9f5c522f7d800d85b245a9806418515b7c (diff)
downloadnode-new-a7cbf19a82c75e9a65e90fb8ba4947e2fc52ef39.tar.gz
deps: update V8 to 9.1.269.36
PR-URL: https://github.com/nodejs/node/pull/38273 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
Diffstat (limited to 'deps/v8/test/cctest/test-code-pages.cc')
-rw-r--r--deps/v8/test/cctest/test-code-pages.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/deps/v8/test/cctest/test-code-pages.cc b/deps/v8/test/cctest/test-code-pages.cc
index d0ed8334a5..7d335f2174 100644
--- a/deps/v8/test/cctest/test-code-pages.cc
+++ b/deps/v8/test/cctest/test-code-pages.cc
@@ -70,18 +70,23 @@ bool PagesHasExactPage(std::vector<MemoryRange>* pages, Address search_page,
return it != pages->end();
}
-bool PagesContainsAddress(std::vector<MemoryRange>* pages,
- Address search_address) {
+bool PagesContainsRange(std::vector<MemoryRange>* pages, Address search_address,
+ size_t size) {
byte* addr = reinterpret_cast<byte*>(search_address);
auto it =
- std::find_if(pages->begin(), pages->end(), [addr](const MemoryRange& r) {
+ std::find_if(pages->begin(), pages->end(), [=](const MemoryRange& r) {
const byte* page_start = reinterpret_cast<const byte*>(r.start);
const byte* page_end = page_start + r.length_in_bytes;
- return addr >= page_start && addr < page_end;
+ return addr >= page_start && (addr + size) <= page_end;
});
return it != pages->end();
}
+bool PagesContainsAddress(std::vector<MemoryRange>* pages,
+ Address search_address) {
+ return PagesContainsRange(pages, search_address, 0);
+}
+
} // namespace
TEST(CodeRangeCorrectContents) {
@@ -99,8 +104,18 @@ TEST(CodeRangeCorrectContents) {
CHECK_EQ(2, pages->size());
CHECK(PagesHasExactPage(pages, code_range.begin(), code_range.size()));
CHECK(PagesHasExactPage(
- pages, reinterpret_cast<Address>(i_isolate->embedded_blob_code()),
- i_isolate->embedded_blob_code_size()));
+ pages, reinterpret_cast<Address>(i_isolate->CurrentEmbeddedBlobCode()),
+ i_isolate->CurrentEmbeddedBlobCodeSize()));
+ if (i_isolate->is_short_builtin_calls_enabled()) {
+ // In this case embedded blob code must be included via code_range.
+ CHECK(PagesContainsRange(
+ pages, reinterpret_cast<Address>(i_isolate->embedded_blob_code()),
+ i_isolate->embedded_blob_code_size()));
+ } else {
+ CHECK(PagesHasExactPage(
+ pages, reinterpret_cast<Address>(i_isolate->embedded_blob_code()),
+ i_isolate->embedded_blob_code_size()));
+ }
}
TEST(CodePagesCorrectContents) {