[wasm] Add WasmCodeRefScope for printing

Add a WasmCodeRefScope around _v8_internal_Print_Code() because that
is needed for debugging.

R=clemensh@chromium.org

Change-Id: Ifdb7a32695163e0a109567ec00a52196e79e03db
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585844
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61047}
This commit is contained in:
Ben L. Titzer 2019-04-26 14:34:06 +02:00 committed by Commit Bot
parent 6ccec5ce6d
commit cbc34149db

View File

@ -2741,12 +2741,15 @@ V8_EXPORT_PRIVATE extern void _v8_internal_Print_Code(void* object) {
i::Address address = reinterpret_cast<i::Address>(object);
i::Isolate* isolate = i::Isolate::Current();
i::wasm::WasmCode* wasm_code =
isolate->wasm_engine()->code_manager()->LookupCode(address);
if (wasm_code) {
i::StdoutStream os;
wasm_code->Disassemble(nullptr, os, address);
return;
{
i::wasm::WasmCodeRefScope scope;
i::wasm::WasmCode* wasm_code =
isolate->wasm_engine()->code_manager()->LookupCode(address);
if (wasm_code) {
i::StdoutStream os;
wasm_code->Disassemble(nullptr, os, address);
return;
}
}
if (!isolate->heap()->InSpaceSlow(address, i::CODE_SPACE) &&