Commit bf066d85 authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Use "wasm-function[i]" for wasm function name

BUG=chromium:863205
R=clemensh@chromium.org

Change-Id: I15f3a09e15210a80b155def5761d9aead95d19b7
Reviewed-on: https://chromium-review.googlesource.com/1156386Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54811}
parent bfbaefd8
......@@ -675,7 +675,11 @@ Handle<String> WasmModuleObject::GetFunctionName(
MaybeHandle<String> name =
GetFunctionNameOrNull(isolate, module_object, func_index);
if (!name.is_null()) return name.ToHandleChecked();
return isolate->factory()->NewStringFromStaticChars("<WASM UNNAMED>");
EmbeddedVector<char, 32> buffer;
int length = SNPrintF(buffer, "wasm-function[%u]", func_index);
return isolate->factory()
->NewStringFromOneByte(Vector<uint8_t>::cast(buffer.SubVector(0, length)))
.ToHandleChecked();
}
Vector<const uint8_t> WasmModuleObject::GetRawFunctionName(
......
......@@ -174,8 +174,8 @@ class WasmModuleObject : public JSObject {
uint32_t func_index);
// Get the function name of the function identified by the given index.
// Returns "<WASM UNNAMED>" if the function is unnamed or the name is not a
// valid UTF-8 string.
// Returns "wasm-function[func_index]" if the function is unnamed or the
// name is not a valid UTF-8 string.
static Handle<String> GetFunctionName(Isolate*, Handle<WasmModuleObject>,
uint32_t func_index);
......
......@@ -40,7 +40,7 @@ var module = builder.instantiate();
for (var i = 0; i < names.length; ++i) {
var line = lines[i].trim();
if (names[i] === null) continue;
var printed_name = names[i] === undefined ? "<WASM UNNAMED>" : names[i]
var printed_name = names[i];
var expected_start = "at " + printed_name + " (";
assertTrue(line.startsWith(expected_start),
"should start with '" + expected_start + "': '" + line + "'");
......
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