From 5fb5509786d0ae08177bd230fdb3cac26f871fa9 Mon Sep 17 00:00:00 2001 From: Peter Marshall Date: Wed, 26 Sep 2018 13:25:24 +0200 Subject: [PATCH] [API] Change GetCodeRange to match the style of GetEmbeddedCodeRange Deprecate GetCodeRange(void** start, size_t* length_in_bytes) in favor of a new signature MemoryRange GetCodeRange() which is consistent with that of GetEmbeddedCodeRange. Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: Ic5e244981422a2c75485c851ca768e54914cc539 Reviewed-on: https://chromium-review.googlesource.com/1245741 Reviewed-by: Yang Guo Commit-Queue: Peter Marshall Cr-Commit-Position: refs/heads/master@{#56241} --- include/v8.h | 4 +++- src/api.cc | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/v8.h b/include/v8.h index 340baa74ab..219f024218 100644 --- a/include/v8.h +++ b/include/v8.h @@ -8113,7 +8113,9 @@ class V8_EXPORT Isolate { * * https://code.google.com/p/v8/issues/detail?id=3598 */ - void GetCodeRange(void** start, size_t* length_in_bytes); + V8_DEPRECATE_SOON("Use MemoryRange GetCodeRange()", + void GetCodeRange(void** start, size_t* length_in_bytes)); + MemoryRange GetCodeRange(); /** * Returns a memory range containing the code for V8's embedded functions diff --git a/src/api.cc b/src/api.cc index 79efb6ef2d..a00f7c2fa3 100644 --- a/src/api.cc +++ b/src/api.cc @@ -8718,6 +8718,13 @@ void Isolate::GetCodeRange(void** start, size_t* length_in_bytes) { *length_in_bytes = code_range.size(); } +MemoryRange Isolate::GetCodeRange() { + i::Isolate* isolate = reinterpret_cast(this); + const base::AddressRegion& code_range = + isolate->heap()->memory_allocator()->code_range(); + return {reinterpret_cast(code_range.begin()), code_range.size()}; +} + MemoryRange Isolate::GetEmbeddedCodeRange() { i::Isolate* isolate = reinterpret_cast(this); return {reinterpret_cast(isolate->embedded_blob()),