Skip to content

Commit f67b219

Browse files
osa1Commit Queue
authored and
Commit Queue
committed
[dart2wasm] Return JS string in StackTrace.current
Avoid copying JS string to Dart. The test co19/LibTest/convert/Latin1Codec_A01_t01 throws a lot of exceptions. Before this patch it runs in d8 in 4.1s, after it runs in 1.5s. Change-Id: I1b9bf06876d63e92c93a03cdbf14587e369978ad Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338400 Commit-Queue: Ömer Ağacan <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent f773c42 commit f67b219

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sdk/lib/_internal/wasm/lib/stack_trace_patch.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class StackTrace {
1616
// Note: We remove the first two frames to prevent including
1717
// `getCurrentStackTrace` and `StackTrace.current`. On Chrome, the first
1818
// line is not a frame but a line with just "Error", which we also remove.
19-
return _StringStackTrace(JS<String>(r"""() => {
19+
return _StringStackTrace(JSStringImpl(JS<WasmExternRef?>(r"""() => {
2020
let stackString = new Error().stack.toString();
2121
let frames = stackString.split('\n');
2222
let drop = 2;
2323
if (frames[0] === 'Error') {
2424
drop += 1;
2525
}
26-
return stringToDartString(frames.slice(drop).join('\n'));
27-
}"""));
26+
return frames.slice(drop).join('\n');
27+
}""")));
2828
}
2929
}

0 commit comments

Comments
 (0)