• Joyee Cheung's avatar
    Reland "[class] implement reparsing of class instance member initializers" · 0e07eb53
    Joyee Cheung authored
    This is a reland of 91f08378
    
    When the class scope does not need a context, the deserialized
    outer scope of the initializer scope would not be the class scope,
    and we should not and do not need to use it to fix up the allocation
    information of the context-allocated variables. The original patch
    did not consider this case and resulted in a regression when we
    tried to reparse the initializer function to look for destructuring
    assignment errors. This fixes the regression by not deserializing
    the class scope that's going to be reparsed, and using the positions
    of the scopes to tell whether the scope info matches the reparsed
    scope and can be used to fix up the allocation info.
    
    Original change's description:
    > [class] implement reparsing of class instance member initializers
    >
    > Previously, since the source code for the synthetic class instance
    > member initializer function was recorded as the span from the first
    > initializer to the last initializer, there was no way to reparse the
    > class and recompile the initializer function. It was working for
    > most use cases because the code for the initializer function was
    > generated eagarly and it was usually alive as long as the class was
    > alive, so the initializer wouldn't normally be lazily parsed. This
    > didn't work, however, when the class was snapshotted with
    > v8::SnapshotCreator::FunctionCodeHandling::kClear,
    > becuase then we needed to recompile the initializer when the class
    > was instantiated. This patch implements the reparsing so that
    > these classes can work with FunctionCodeHandling::kClear.
    >
    > This patch refactors ParserBase::ParseClassLiteral() so that we can
    > reuse it for both parsing the class body normally and reparsing it
    > to collect initializers. When reparsing the synthetic initializer
    > function, we rewind the scanner to the beginning of the class, and
    > parse the class body to collect the initializers. During the
    > reparsing, field initializers are parsed with the full parser while
    > methods of the class are pre-parsed.
    >
    > A few notable changes:
    >
    > - Extended the source range of the initializer function to cover the
    >   entire class so that we can rewind the scanner to parse the class
    >   body to collect initializers (previously, it starts from the first
    >   field initializer and ends at the last initializer). This resulted
    >   some expectation changes in the debugger tests, though the
    >   initializers remain debuggable.
    > - A temporary ClassScope is created during reparsing. After the class
    >   is reparsed, we use the information from the ScopeInfo to update
    >   the allocated indices of the variables in the ClassScope.
    >
    > Bug: v8:10704
    > Change-Id: Ifb6431a1447d8844f2a548283d59158742fe9027
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2988830
    > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    > Commit-Queue: Joyee Cheung <joyee@igalia.com>
    > Cr-Commit-Position: refs/heads/main@{#78299}
    
    Bug: chromium:1278086, chromium:1278085, v8:10704
    Change-Id: Iea4f1f6dc398846cbe322adc16f6fffd6d2dfdf3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3325912Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#78745}
    0e07eb53
Name
Last commit
Last update
..
resources Loading commit data...
asm-js-breakpoint-before-exec-expected.txt Loading commit data...
asm-js-breakpoint-before-exec.js Loading commit data...
asm-js-breakpoint-during-exec-expected.txt Loading commit data...
asm-js-breakpoint-during-exec.js Loading commit data...
asm-js-stack-expected.txt Loading commit data...
asm-js-stack.js Loading commit data...
async-chains-expected.txt Loading commit data...
async-chains.js Loading commit data...
async-console-count-doesnt-crash-expected.txt Loading commit data...
async-console-count-doesnt-crash.js Loading commit data...
async-for-await-of-promise-stack-expected.txt Loading commit data...
async-for-await-of-promise-stack.js Loading commit data...
async-function-step-out-expected.txt Loading commit data...
async-function-step-out.js Loading commit data...
async-instrumentation-expected.txt Loading commit data...
async-instrumentation.js Loading commit data...
async-promise-late-then-expected.txt Loading commit data...
async-promise-late-then.js Loading commit data...
async-set-timeout-expected.txt Loading commit data...
async-set-timeout.js Loading commit data...
async-stack-await-expected.txt Loading commit data...
async-stack-await.js Loading commit data...
async-stack-created-frame-expected.txt Loading commit data...
async-stack-created-frame.js Loading commit data...
async-stack-for-promise-expected.txt Loading commit data...
async-stack-for-promise.js Loading commit data...
async-stack-load-more-expected.txt Loading commit data...
async-stack-load-more.js Loading commit data...
break-location-function-calls-expected.txt Loading commit data...
break-location-function-calls.js Loading commit data...
break-locations-await-expected.txt Loading commit data...
break-locations-await.js Loading commit data...
break-locations-var-init-expected.txt Loading commit data...
break-locations-var-init.js Loading commit data...
break-on-exception-and-step-expected.txt Loading commit data...
break-on-exception-and-step.js Loading commit data...
break-on-exception-compiler-errors-expected.txt Loading commit data...
break-on-exception-compiler-errors.js Loading commit data...
break-on-exception-expected.txt Loading commit data...
break-on-exception.js Loading commit data...
breakpoints-and-side-effects-expected.txt Loading commit data...
breakpoints-and-side-effects.js Loading commit data...
breakpoints-expected.txt Loading commit data...
breakpoints.js Loading commit data...
call-frame-function-location-expected.txt Loading commit data...
call-frame-function-location.js Loading commit data...
call-frame-url-expected.txt Loading commit data...
call-frame-url.js Loading commit data...
caught-exception-from-framework-inside-async-expected.txt Loading commit data...
caught-exception-from-framework-inside-async.js Loading commit data...
caught-uncaught-exceptions-expected.txt Loading commit data...
caught-uncaught-exceptions.js Loading commit data...
change-return-value-expected.txt Loading commit data...
change-return-value.js Loading commit data...
class-fields-scopes-expected.txt Loading commit data...
class-fields-scopes.js Loading commit data...
class-private-fields-scopes-expected.txt Loading commit data...
class-private-fields-scopes.js Loading commit data...
class-private-methods-empty-inner-expected.txt Loading commit data...
class-private-methods-empty-inner.js Loading commit data...
class-private-methods-expected.txt Loading commit data...
class-private-methods-preview-expected.txt Loading commit data...
class-private-methods-preview.js Loading commit data...
class-private-methods-static-expected.txt Loading commit data...
class-private-methods-static-nested-expected.txt Loading commit data...
class-private-methods-static-nested.js Loading commit data...
class-private-methods-static-preview-expected.txt Loading commit data...
class-private-methods-static-preview.js Loading commit data...
class-private-methods-static.js Loading commit data...
class-private-methods-unused-expected.txt Loading commit data...
class-private-methods-unused.js Loading commit data...
class-private-methods.js Loading commit data...
clear-breakpoints-on-disable-expected.txt Loading commit data...
clear-breakpoints-on-disable.js Loading commit data...
collect-obsolete-async-tasks-expected.txt Loading commit data...
collect-obsolete-async-tasks.js Loading commit data...
collect-old-async-call-chains-expected.txt Loading commit data...
collect-old-async-call-chains.js Loading commit data...
command-line-api-with-arrow-function-expected.txt Loading commit data...
command-line-api-with-arrow-function.js Loading commit data...
command-line-api-with-bound-function-expected.txt Loading commit data...
command-line-api-with-bound-function.js Loading commit data...
continue-to-location-expected.txt Loading commit data...
continue-to-location-target-call-frames-expected.txt Loading commit data...
continue-to-location-target-call-frames.js Loading commit data...
continue-to-location.js Loading commit data...
debugger-statement-expected.txt Loading commit data...
debugger-statement.js Loading commit data...
destroy-in-break-program-expected.txt Loading commit data...
destroy-in-break-program.js Loading commit data...
destroy-in-break-program2-expected.txt Loading commit data...
destroy-in-break-program2.js Loading commit data...
destructuring-expected.txt Loading commit data...
destructuring.js Loading commit data...
disable-agent-on-pause-expected.txt Loading commit data...
disable-agent-on-pause.js Loading commit data...
doesnt-step-into-injected-script-expected.txt Loading commit data...
doesnt-step-into-injected-script.js Loading commit data...
es6-module-liveedit-expected.txt Loading commit data...
es6-module-liveedit.js Loading commit data...
es6-module-script-parsed-expected.txt Loading commit data...
es6-module-script-parsed.js Loading commit data...
eval-scopes-expected.txt Loading commit data...
eval-scopes.js Loading commit data...
eval-without-codegen-expected.txt Loading commit data...
eval-without-codegen.js Loading commit data...
evaluate-at-first-module-line-expected.txt Loading commit data...
evaluate-at-first-module-line.js Loading commit data...
evaluate-on-call-frame-expected.txt Loading commit data...
evaluate-on-call-frame-in-module-expected.txt Loading commit data...
evaluate-on-call-frame-in-module.js Loading commit data...
evaluate-on-call-frame-return-values-expected.txt Loading commit data...
evaluate-on-call-frame-return-values.js Loading commit data...
evaluate-on-call-frame-timeout-expected.txt Loading commit data...
evaluate-on-call-frame-timeout.js Loading commit data...
evaluate-on-call-frame.js Loading commit data...
evaluate-with-await-on-breakpoint-expected.txt Loading commit data...
evaluate-with-await-on-breakpoint.js Loading commit data...
external-stack-trace-expected.txt Loading commit data...
external-stack-trace.js Loading commit data...
for-of-loops-expected.txt Loading commit data...
for-of-loops.js Loading commit data...
framework-break-expected.txt Loading commit data...
framework-break.js Loading commit data...
framework-nested-scheduled-break-expected.txt Loading commit data...
framework-nested-scheduled-break.js Loading commit data...
framework-precise-ranges-expected.txt Loading commit data...
framework-precise-ranges.js Loading commit data...
framework-stepping-expected.txt Loading commit data...
framework-stepping.js Loading commit data...
get-possible-breakpoints-after-gc-expected.txt Loading commit data...
get-possible-breakpoints-after-gc.js Loading commit data...
get-possible-breakpoints-array-literal-expected.txt Loading commit data...
get-possible-breakpoints-array-literal.js Loading commit data...
get-possible-breakpoints-class-fields-expected.txt Loading commit data...
get-possible-breakpoints-class-fields.js Loading commit data...
get-possible-breakpoints-expected.txt Loading commit data...
get-possible-breakpoints-lazy-error-expected.txt Loading commit data...
get-possible-breakpoints-lazy-error.js Loading commit data...
get-possible-breakpoints-main-expected.txt Loading commit data...
get-possible-breakpoints-main.js Loading commit data...
get-possible-breakpoints-restrict-to-function-expected.txt Loading commit data...
get-possible-breakpoints-restrict-to-function.js Loading commit data...
get-possible-breakpoints.js Loading commit data...
get-properties-paused-expected.txt Loading commit data...
get-properties-paused.js Loading commit data...
inspector-break-api-expected.txt Loading commit data...
inspector-break-api.js Loading commit data...
limit-size-of-collected-scripts-expected.txt Loading commit data...
limit-size-of-collected-scripts.js Loading commit data...
max-async-call-chain-depth-expected.txt Loading commit data...
max-async-call-chain-depth.js Loading commit data...
max-async-call-stack-depth-changed-expected.txt Loading commit data...
max-async-call-stack-depth-changed.js Loading commit data...
not-hold-promises-expected.txt Loading commit data...
not-hold-promises.js Loading commit data...
object-preview-internal-properties-expected.txt Loading commit data...
object-preview-internal-properties.js Loading commit data...
other-pause-reasons-expected.txt Loading commit data...
other-pause-reasons.js Loading commit data...
pause-at-negative-offset-expected.txt Loading commit data...
pause-at-negative-offset.js Loading commit data...
pause-expected.txt Loading commit data...
pause-inside-blackboxed-optimized-expected.txt Loading commit data...
pause-inside-blackboxed-optimized.js Loading commit data...
pause-on-async-call-expected.txt Loading commit data...
pause-on-async-call-set-timeout-expected.txt Loading commit data...
pause-on-async-call-set-timeout.js Loading commit data...
pause-on-async-call.js Loading commit data...
pause-on-oom-expected.txt Loading commit data...
pause-on-oom-extrawide-expected.txt Loading commit data...
pause-on-oom-extrawide.js Loading commit data...
pause-on-oom-wide-expected.txt Loading commit data...
pause-on-oom-wide.js Loading commit data...
pause-on-oom.js Loading commit data...
pause-on-promise-rejections-expected.txt Loading commit data...
pause-on-promise-rejections.js Loading commit data...
pause.js Loading commit data...
promise-chain-when-limit-hit-expected.txt Loading commit data...
promise-chain-when-limit-hit.js Loading commit data...
protocol-string-to-double-locale-expected.txt Loading commit data...
protocol-string-to-double-locale.js Loading commit data...
provisional-breakpoint-for-anonymous-script-expected.txt Loading commit data...
provisional-breakpoint-for-anonymous-script.js Loading commit data...
regress-1125934-expected.txt Loading commit data...
regress-1125934.js Loading commit data...
regress-1190290-expected.txt Loading commit data...
regress-1190290.js Loading commit data...
regress-crbug-481896-expected.txt Loading commit data...
regress-crbug-481896.js Loading commit data...
regression-1185540-expected.txt Loading commit data...
regression-1185540.js Loading commit data...
regression-1853-expected.txt Loading commit data...
regression-1853.js Loading commit data...
regression-419663-expected.txt Loading commit data...
regression-419663.js Loading commit data...
regression-424142-expected.txt Loading commit data...
regression-424142.js Loading commit data...
remove-breakpoint-at-breakpoint-expected.txt Loading commit data...
remove-breakpoint-at-breakpoint.js Loading commit data...
resource-name-to-url-expected.txt Loading commit data...
resource-name-to-url.js Loading commit data...
restart-frame-expected.txt Loading commit data...
restart-frame.js Loading commit data...
restore-breakpoint-expected.txt Loading commit data...
restore-breakpoint.js Loading commit data...
return-break-locations-expected.txt Loading commit data...
return-break-locations.js Loading commit data...
scope-skip-variables-with-empty-name-expected.txt Loading commit data...
scope-skip-variables-with-empty-name.js Loading commit data...
script-end-location-expected.txt Loading commit data...
script-end-location.js Loading commit data...
script-on-after-compile-expected.txt Loading commit data...
script-on-after-compile-snapshot-expected.txt Loading commit data...
script-on-after-compile-snapshot.js Loading commit data...
script-on-after-compile.js Loading commit data...
script-origin-stack-expected.txt Loading commit data...
script-origin-stack.js Loading commit data...
script-parsed-for-runtime-evaluate-expected.txt Loading commit data...
script-parsed-for-runtime-evaluate.js Loading commit data...
script-parsed-hash-expected.txt Loading commit data...
script-parsed-hash.js Loading commit data...
script-unique-hash-expected.txt Loading commit data...
script-unique-hash.js Loading commit data...
set-async-call-stack-depth-expected.txt Loading commit data...
set-async-call-stack-depth.js Loading commit data...
set-blackbox-patterns-expected.txt Loading commit data...
set-blackbox-patterns.js Loading commit data...
set-breakpoint-after-gc-expected.txt Loading commit data...
set-breakpoint-after-gc.js Loading commit data...
set-breakpoint-after-liveedit-expected.txt Loading commit data...
set-breakpoint-after-liveedit.js Loading commit data...
set-breakpoint-at-last-line-expected.txt Loading commit data...
set-breakpoint-at-last-line.js Loading commit data...
set-breakpoint-before-enabling-expected.txt Loading commit data...
set-breakpoint-before-enabling.js Loading commit data...
set-breakpoint-breaks-on-first-breakable-location-expected.txt Loading commit data...
set-breakpoint-breaks-on-first-breakable-location.js Loading commit data...
set-breakpoint-expected.txt Loading commit data...
set-breakpoint-ignore-hint-when-no-location-expected.txt Loading commit data...
set-breakpoint-ignore-hint-when-no-location.js Loading commit data...
set-breakpoint-in-class-initializer-expected.txt Loading commit data...
set-breakpoint-in-class-initializer.js Loading commit data...
set-breakpoint-inline-function-expected.txt Loading commit data...
set-breakpoint-inline-function.js Loading commit data...
set-breakpoint-on-function-call-expected.txt Loading commit data...
set-breakpoint-on-function-call.js Loading commit data...
set-breakpoint-url-regex-expected.txt Loading commit data...
set-breakpoint-url-regex.js Loading commit data...
set-breakpoint.js Loading commit data...
set-instrumentation-breakpoint-expected.txt Loading commit data...
set-instrumentation-breakpoint.js Loading commit data...
set-script-source-exception-expected.txt Loading commit data...
set-script-source-exception.js Loading commit data...
set-script-source-expected.txt Loading commit data...
set-script-source-unchanged-expected.txt Loading commit data...
set-script-source-unchanged.js Loading commit data...
set-script-source.js Loading commit data...
set-skip-all-pauses-expected.txt Loading commit data...
set-skip-all-pauses.js Loading commit data...
set-variable-value-expected.txt Loading commit data...
set-variable-value.js Loading commit data...
side-effect-free-coverage-enabled-expected.txt Loading commit data...
side-effect-free-coverage-enabled.js Loading commit data...
side-effect-free-debug-evaluate-expected.txt Loading commit data...
side-effect-free-debug-evaluate.js Loading commit data...
step-into-break-on-async-call-expected.txt Loading commit data...
step-into-break-on-async-call.js Loading commit data...
step-into-expected.txt Loading commit data...
step-into-external-async-task-expected.txt Loading commit data...
step-into-external-async-task-same-context-expected.txt Loading commit data...
step-into-external-async-task-same-context.js Loading commit data...
step-into-external-async-task.js Loading commit data...
step-into-nested-arrow-expected.txt Loading commit data...
step-into-nested-arrow.js Loading commit data...
step-into-next-script-expected.txt Loading commit data...
step-into-next-script.js Loading commit data...
step-into-optimized-blackbox-expected.txt Loading commit data...
step-into-optimized-blackbox.js Loading commit data...
step-into-out-expected.txt Loading commit data...
step-into-out.js Loading commit data...
step-into.js Loading commit data...
step-out-async-await-expected.txt Loading commit data...
step-out-async-await.js Loading commit data...
step-over-another-context-group-expected.txt Loading commit data...
step-over-another-context-group.js Loading commit data...
step-over-caught-exception-expected.txt Loading commit data...
step-over-caught-exception.js Loading commit data...
step-snapshot-expected.txt Loading commit data...
step-snapshot.js Loading commit data...
stepping-after-get-possible-breakpoints-expected.txt Loading commit data...
stepping-after-get-possible-breakpoints.js Loading commit data...
stepping-and-break-program-api-expected.txt Loading commit data...
stepping-and-break-program-api.js Loading commit data...
stepping-async-generator-expected.txt Loading commit data...
stepping-async-generator.js Loading commit data...
stepping-generator-expected.txt Loading commit data...
stepping-generator-parameters-expected.txt Loading commit data...
stepping-generator-parameters.js Loading commit data...
stepping-generator.js Loading commit data...
stepping-tail-call-expected.txt Loading commit data...
stepping-tail-call.js Loading commit data...
stepping-with-blackboxed-ranges-expected.txt Loading commit data...
stepping-with-blackboxed-ranges.js Loading commit data...
stepping-with-natives-and-frameworks-expected.txt Loading commit data...
stepping-with-natives-and-frameworks.js Loading commit data...
stepping-with-skiplist-expected.txt Loading commit data...
stepping-with-skiplist.js Loading commit data...
suspended-generator-scopes-expected.txt Loading commit data...
suspended-generator-scopes.js Loading commit data...
tdz-modules-scopes-expected.txt Loading commit data...
tdz-modules-scopes.js Loading commit data...
tdz-scopes-expected.txt Loading commit data...
tdz-scopes.js Loading commit data...
terminate-execution-on-pause-expected.txt Loading commit data...
terminate-execution-on-pause.js Loading commit data...
this-in-arrow-function-expected.txt Loading commit data...
this-in-arrow-function.js Loading commit data...
update-call-frame-scopes-expected.txt Loading commit data...
update-call-frame-scopes.js Loading commit data...
wasm-breakpoint-reset-on-debugger-restart-expected.txt Loading commit data...
wasm-breakpoint-reset-on-debugger-restart.js Loading commit data...
wasm-conditional-breakpoints-expected.txt Loading commit data...
wasm-conditional-breakpoints.js Loading commit data...
wasm-debug-command-expected.txt Loading commit data...
wasm-debug-command.js Loading commit data...
wasm-evaluate-on-call-frame-expected.txt Loading commit data...
wasm-evaluate-on-call-frame.js Loading commit data...
wasm-externref-global-expected.txt Loading commit data...
wasm-externref-global.js Loading commit data...
wasm-gc-breakpoints-expected.txt Loading commit data...
wasm-gc-breakpoints.js Loading commit data...
wasm-gc-in-debug-break-expected.txt Loading commit data...
wasm-gc-in-debug-break.js Loading commit data...
wasm-get-breakable-locations-byte-offsets-expected.txt Loading commit data...
wasm-get-breakable-locations-byte-offsets.js Loading commit data...
wasm-global-names-expected.txt Loading commit data...
wasm-global-names.js Loading commit data...
wasm-imports-expected.txt Loading commit data...
wasm-imports.js Loading commit data...
wasm-inspect-many-registers-expected.txt Loading commit data...
wasm-inspect-many-registers.js Loading commit data...
wasm-instrumentation-breakpoint-expected.txt Loading commit data...
wasm-instrumentation-breakpoint.js Loading commit data...
wasm-memory-names-expected.txt Loading commit data...
wasm-memory-names.js Loading commit data...
wasm-regress-10957-expected.txt Loading commit data...
wasm-regress-10957.js Loading commit data...
wasm-remove-breakpoint-expected.txt Loading commit data...
wasm-remove-breakpoint.js Loading commit data...
wasm-reset-context-group-expected.txt Loading commit data...
wasm-reset-context-group.js Loading commit data...
wasm-scope-info-expected.txt Loading commit data...
wasm-scope-info.js Loading commit data...
wasm-script-code-offset-expected.txt Loading commit data...
wasm-script-code-offset-streaming-expected.txt Loading commit data...
wasm-script-code-offset-streaming.js Loading commit data...
wasm-script-code-offset.js Loading commit data...
wasm-scripts-expected.txt Loading commit data...
wasm-scripts-with-name-expected.txt Loading commit data...
wasm-scripts-with-name.js Loading commit data...
wasm-scripts.js Loading commit data...
wasm-set-breakpoint-breaks-on-first-breakable-location-expected.txt Loading commit data...
wasm-set-breakpoint-breaks-on-first-breakable-location.js Loading commit data...
wasm-set-breakpoint-expected.txt Loading commit data...
wasm-set-breakpoint.js Loading commit data...
wasm-side-effect-free-debug-evaluate-expected.txt Loading commit data...
wasm-side-effect-free-debug-evaluate.js Loading commit data...
wasm-source-expected.txt Loading commit data...
wasm-source.js Loading commit data...
wasm-stack-check-expected.txt Loading commit data...
wasm-stack-check.js Loading commit data...
wasm-stack-expected.txt Loading commit data...
wasm-stack.js Loading commit data...
wasm-step-a-lot-expected.txt Loading commit data...
wasm-step-a-lot.js Loading commit data...
wasm-step-after-trap-expected.txt Loading commit data...
wasm-step-after-trap.js Loading commit data...
wasm-step-from-non-breakable-position-expected.txt Loading commit data...
wasm-step-from-non-breakable-position.js Loading commit data...
wasm-stepping-expected.txt Loading commit data...
wasm-stepping-in-from-js-expected.txt Loading commit data...
wasm-stepping-in-from-js.js Loading commit data...
wasm-stepping-no-opcode-merging-expected.txt Loading commit data...
wasm-stepping-no-opcode-merging.js Loading commit data...
wasm-stepping-out-from-js-expected.txt Loading commit data...
wasm-stepping-out-from-js.js Loading commit data...
wasm-stepping-to-js-expected.txt Loading commit data...
wasm-stepping-to-js.js Loading commit data...
wasm-stepping-with-skiplist-expected.txt Loading commit data...
wasm-stepping-with-skiplist.js Loading commit data...
wasm-stepping-with-source-map-expected.txt Loading commit data...
wasm-stepping-with-source-map.js Loading commit data...
wasm-stepping.js Loading commit data...
wasm-unnamed-function-names-expected.txt Loading commit data...
wasm-unnamed-function-names.js Loading commit data...