v8/test/inspector/runtime/error-stack-expected.txt
Benedikt Meurer 765ca6a0d3 [inspector] Capture stack trace only once for JSError objects.
When creating a new JSError object (or using the non-standard API
`Error.captureStackTrace`) V8 would previously capture the "simple stack
trace" (as FixedArray of CallSiteInfo instances) to be used for the non-
standard `error.stack` property, and if the inspector was active also
capture the "detailed stack trace" (as FixedArray of StackFrameInfo
instances). This turns out to be quite a lot of overhead, both in terms
of execution time as well as memory pressure, especially since the
information needed for the inspector is a proper subset of the
information needed by `error.stack`.

So this CL addresses the above issue by capturing only the "simple stack
trace" (in the common case) and computing the "detailed stack trace"
from the "simple stack trace" when on demand. This is accomplished by
introducing a new ErrorStackData container that is used to store the
stack trace information on JSErrors when the inspector is active. When
capturing stack trace for a JSError object while the inspector is
active, we take the maximum of the program controlled stack trace limit
and the inspector requested stack trace limit, and memorize the program
controlled stack trace limit for later formatting (to ensure that the
presence of the inspector is not observable by the program).

On the `standalone.js` benchmark from crbug.com/1283162 (with the
default max call stack size of 200) we reduce execution time by around
16% compared to ToT. And compared to V8 9.9.4 (the version prior to the
regression in crbug.com/1280831), we are 6% faster now.

Doc: https://bit.ly/v8-cheaper-inspector-stack-traces
Bug: chromium:1280831, chromium:1278650, chromium:1258599
Bug: chromium:1280803, chromium:1280832, chromium:1280818
Fixed: chromium:1283162
Change-Id: I57dac73e0ecf7d50ea57c3eb4981067deb28133e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3366660
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78542}
2022-01-10 14:55:18 +00:00

421 lines
16 KiB
Plaintext

Checks that error.stack works correctly
Running test: testErrorStackWithRuntimeDisabled
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 4
exception : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 8
scriptId : <scriptId>
text : Uncaught
}
result : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
}
}
Running test: testErrorStackWithRuntimeEnabled
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 4
exception : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 8
scriptId : <scriptId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName :
lineNumber : 8
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 9
functionName : recurse
lineNumber : 3
scriptId : <scriptId>
url : test.js
}
[2] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[3] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[4] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[5] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[6] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[7] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[8] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[9] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[10] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[11] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[12] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[13] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[14] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[15] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[16] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[17] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[18] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[19] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[20] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[21] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[22] : {
columnNumber : 2
functionName : foo
lineNumber : 7
scriptId : <scriptId>
url : test.js
}
[23] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught
}
result : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 4
exception : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 8
scriptId : <scriptId>
text : Uncaught
}
result : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 4
exception : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 8
scriptId : <scriptId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName :
lineNumber : 8
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 9
functionName : recurse
lineNumber : 3
scriptId : <scriptId>
url : test.js
}
[2] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[3] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[4] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
]
}
text : Uncaught
}
result : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 4
exception : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 8
scriptId : <scriptId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName :
lineNumber : 8
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 9
functionName : recurse
lineNumber : 3
scriptId : <scriptId>
url : test.js
}
[2] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[3] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[4] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[5] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[6] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[7] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[8] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
[9] : {
columnNumber : 22
functionName : recurse
lineNumber : 2
scriptId : <scriptId>
url : test.js
}
]
}
text : Uncaught
}
result : {
className : Error
description : Error: Thrown from foo! at test.js:9:11 at recurse (test.js:4:10) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23) at recurse (test.js:3:23)
objectId : <objectId>
subtype : error
type : object
}
}
}