Commit 7ff1aa63 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix code printing for anonymous functions

Anonymous functions have no index, thus we cannot get their source
position table.
Technically, we are not even allowed to call {index()} on anonymous
functions, as this will DCHECK that {index_} contains a value.

R=mstarzinger@chromium.org

Change-Id: I9a8b07cf836671e080cc1784c1712ecd88778972
Reviewed-on: https://chromium-review.googlesource.com/880921
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50802}
parent 8bfbe25a
......@@ -212,18 +212,21 @@ void WasmCode::Disassemble(const char* name, Isolate* isolate,
instructions().start() + instruction_size, nullptr);
os << "\n";
Object* source_positions_or_undef =
owner_->compiled_module()->source_positions()->get(index());
if (!source_positions_or_undef->IsUndefined(isolate)) {
os << "Source positions:\n pc offset position\n";
for (SourcePositionTableIterator it(
ByteArray::cast(source_positions_or_undef));
!it.done(); it.Advance()) {
os << std::setw(10) << std::hex << it.code_offset() << std::dec
<< std::setw(10) << it.source_position().ScriptOffset()
<< (it.is_statement() ? " statement" : "") << "\n";
// Anonymous functions don't have source positions.
if (!IsAnonymous()) {
Object* source_positions_or_undef =
owner_->compiled_module()->source_positions()->get(index());
if (!source_positions_or_undef->IsUndefined(isolate)) {
os << "Source positions:\n pc offset position\n";
for (SourcePositionTableIterator it(
ByteArray::cast(source_positions_or_undef));
!it.done(); it.Advance()) {
os << std::setw(10) << std::hex << it.code_offset() << std::dec
<< std::setw(10) << it.source_position().ScriptOffset()
<< (it.is_statement() ? " statement" : "") << "\n";
}
os << "\n";
}
os << "\n";
}
os << "RelocInfo (size = " << reloc_size_ << ")\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment