• Leszek Swirski's avatar
    [destructuring] Elide coercible check for simple keys · 1fba0441
    Leszek Swirski authored
    Simple object destructuring, such as `let {a,b} = o`, is less efficient
    than the equivalent assignments `let a = o.a; let b = o.b`. This is
    because it does a nil check of `o` before the assignments. However, this
    nil check is not strictly necessary for simple (i.e. non-computed) names,
    as there will be an equivalent nil check on the first access to o in
    `o.a`. For computed names the computation is unfortunately obervable.
    
    So, we can elide the nil check when the first property (if any) of the
    destructuring target is a non-computed name. This messes a bit with our
    error messages, so we re-use the CallPrinter to also find destructuring
    assignment based errors, and fiddle with the error message there. As
    a side-effect, we also get out the object name in the AST, so we can
    output a slightly nicer error message.
    
    Change-Id: Iafa858e27ed771a146cd3ba57903cc73bb46951d
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1773254Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
    Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#63453}
    1fba0441
Name
Last commit
Last update
..
array-binding-pattern-await1.js Loading commit data...
array-binding-pattern-await1.out Loading commit data...
arrow-bare-rest-param.js Loading commit data...
arrow-bare-rest-param.out Loading commit data...
arrow-formal-parameters.js Loading commit data...
arrow-formal-parameters.out Loading commit data...
arrow-invalid-rest-2.js Loading commit data...
arrow-invalid-rest-2.out Loading commit data...
arrow-invalid-rest.js Loading commit data...
arrow-invalid-rest.out Loading commit data...
arrow-missing.js Loading commit data...
arrow-missing.out Loading commit data...
arrow-param-after-rest-2.js Loading commit data...
arrow-param-after-rest-2.out Loading commit data...
arrow-param-after-rest.js Loading commit data...
arrow-param-after-rest.out Loading commit data...
arrow-strict-eval-bare-parameter.js Loading commit data...
arrow-strict-eval-bare-parameter.out Loading commit data...
arrow-two-rest-params.js Loading commit data...
arrow-two-rest-params.out Loading commit data...
async-arrow-invalid-rest-2.js Loading commit data...
async-arrow-invalid-rest-2.out Loading commit data...
async-arrow-invalid-rest.js Loading commit data...
async-arrow-invalid-rest.out Loading commit data...
async-arrow-param-after-rest.js Loading commit data...
async-arrow-param-after-rest.out Loading commit data...
await-non-async.js Loading commit data...
await-non-async.out Loading commit data...
call-async.js Loading commit data...
call-async.out Loading commit data...
call-await.js Loading commit data...
call-await.out Loading commit data...
call-expression.js Loading commit data...
call-expression.out Loading commit data...
call-let.js Loading commit data...
call-let.out Loading commit data...
call-non-constructable.js Loading commit data...
call-non-constructable.out Loading commit data...
call-primitive-constructor.js Loading commit data...
call-primitive-constructor.out Loading commit data...
call-primitive-function.js Loading commit data...
call-primitive-function.out Loading commit data...
call-static.js Loading commit data...
call-static.out Loading commit data...
call-undeclared-constructor.js Loading commit data...
call-undeclared-constructor.out Loading commit data...
call-undeclared-function.js Loading commit data...
call-undeclared-function.out Loading commit data...
call-yield.js Loading commit data...
call-yield.out Loading commit data...
class-constructor-accessor.js Loading commit data...
class-constructor-accessor.out Loading commit data...
class-constructor-generator.js Loading commit data...
class-constructor-generator.out Loading commit data...
class-field-constructor.js Loading commit data...
class-field-constructor.out Loading commit data...
class-field-static-constructor.js Loading commit data...
class-field-static-constructor.out Loading commit data...
class-field-static-prototype.js Loading commit data...
class-field-static-prototype.out Loading commit data...
class-fields-computed.js Loading commit data...
class-fields-computed.out Loading commit data...
class-fields-private-class-in-function.js Loading commit data...
class-fields-private-class-in-function.out Loading commit data...
class-fields-private-outside-class.js Loading commit data...
class-fields-private-outside-class.out Loading commit data...
class-fields-private-source-positions.js Loading commit data...
class-fields-private-source-positions.out Loading commit data...
class-fields-private-throw-early-2.js Loading commit data...
class-fields-private-throw-early-2.out Loading commit data...
class-fields-private-throw-early.js Loading commit data...
class-fields-private-throw-early.out Loading commit data...
class-fields-private-throw-in-module.mjs Loading commit data...
class-fields-private-throw-in-module.out Loading commit data...
class-fields-private-throw-read.js Loading commit data...
class-fields-private-throw-read.out Loading commit data...
class-fields-private-throw-write.js Loading commit data...
class-fields-private-throw-write.out Loading commit data...
class-fields-private-undeclared-lazy-class.js Loading commit data...
class-fields-private-undeclared-lazy-class.out Loading commit data...
class-fields-private-undefined-inner-class.js Loading commit data...
class-fields-private-undefined-inner-class.out Loading commit data...
class-fields-static-throw.js Loading commit data...
class-fields-static-throw.out Loading commit data...
class-fields-throw.js Loading commit data...
class-fields-throw.out Loading commit data...
class-methods-private-throw-write.js Loading commit data...
class-methods-private-throw-write.out Loading commit data...
class-spread-property.js Loading commit data...
class-spread-property.out Loading commit data...
computed-prop-fni.js Loading commit data...
computed-prop-fni.out Loading commit data...
console.js Loading commit data...
console.out Loading commit data...
const-decl-no-init-sloppy.out Loading commit data...
const-decl-no-init.js Loading commit data...
const-decl-no-init.out Loading commit data...
const-decl-no-init2.js Loading commit data...
const-decl-no-init2.out Loading commit data...
default-parameter-tdz-arrow.js Loading commit data...
default-parameter-tdz-arrow.out Loading commit data...
default-parameter-tdz.js Loading commit data...
default-parameter-tdz.out Loading commit data...
destructuring-array-non-iterable-number.js Loading commit data...
destructuring-array-non-iterable-number.out Loading commit data...
destructuring-array-non-iterable-object-literal-complex.js Loading commit data...
destructuring-array-non-iterable-object-literal-complex.out Loading commit data...
destructuring-array-non-iterable-object-literal.js Loading commit data...
destructuring-array-non-iterable-object-literal.out Loading commit data...
destructuring-array-non-iterable-object.js Loading commit data...
destructuring-array-non-iterable-object.out Loading commit data...
destructuring-array-non-iterable-undefined.js Loading commit data...
destructuring-array-non-iterable-undefined.out Loading commit data...
destructuring-decl-no-init-array.js Loading commit data...
destructuring-decl-no-init-array.out Loading commit data...
destructuring-decl-no-init-array2.js Loading commit data...
destructuring-decl-no-init-array2.out Loading commit data...
destructuring-decl-no-init-obj.js Loading commit data...
destructuring-decl-no-init-obj.out Loading commit data...
destructuring-decl-no-init-obj2.js Loading commit data...
destructuring-decl-no-init-obj2.out Loading commit data...
destructuring-function-non-iterable.js Loading commit data...
destructuring-function-non-iterable.out Loading commit data...
destructuring-modify-const.js Loading commit data...
destructuring-modify-const.out Loading commit data...
destructuring-new-callable-non-iterable.js Loading commit data...
destructuring-new-callable-non-iterable.out Loading commit data...
destructuring-non-function-non-iterable.js Loading commit data...
destructuring-non-function-non-iterable.out Loading commit data...
destructuring-object-private-name.js Loading commit data...
destructuring-object-private-name.out Loading commit data...
destructuring-undefined-computed-property.js Loading commit data...
destructuring-undefined-computed-property.out Loading commit data...
destructuring-undefined-number-property.js Loading commit data...
destructuring-undefined-number-property.out Loading commit data...
destructuring-undefined-string-property.js Loading commit data...
destructuring-undefined-string-property.out Loading commit data...
directive.js Loading commit data...
directive.out Loading commit data...
dynamic-import-missing-specifier.js Loading commit data...
dynamic-import-missing-specifier.out Loading commit data...
export-duplicate-as.mjs Loading commit data...
export-duplicate-as.out Loading commit data...
export-duplicate-default.mjs Loading commit data...
export-duplicate-default.out Loading commit data...
export-duplicate.mjs Loading commit data...
export-duplicate.out Loading commit data...
for-in-let-loop-initializers-strict.js Loading commit data...
for-in-let-loop-initializers-strict.out Loading commit data...
for-in-loop-initializers-destructuring.js Loading commit data...
for-in-loop-initializers-destructuring.out Loading commit data...
for-in-loop-initializers-strict.js Loading commit data...
for-in-loop-initializers-strict.out Loading commit data...
for-loop-invalid-lhs.js Loading commit data...
for-loop-invalid-lhs.out Loading commit data...
for-of-let-loop-initializers.js Loading commit data...
for-of-let-loop-initializers.out Loading commit data...
for-of-loop-initializers-sloppy.js Loading commit data...
for-of-loop-initializers-sloppy.out Loading commit data...
for-of-loop-initializers-strict.js Loading commit data...
for-of-loop-initializers-strict.out Loading commit data...
for-of-non-iterable.js Loading commit data...
for-of-non-iterable.out Loading commit data...
for-of-throw-in-body.js Loading commit data...
for-of-throw-in-body.out Loading commit data...
formal-parameters-bad-rest.js Loading commit data...
formal-parameters-bad-rest.out Loading commit data...
formal-parameters-strict-body.js Loading commit data...
formal-parameters-strict-body.out Loading commit data...
formal-parameters-trailing-comma.js Loading commit data...
formal-parameters-trailing-comma.out Loading commit data...
func-name-inferrer-arg-1.js Loading commit data...
func-name-inferrer-arg-1.out Loading commit data...
func-name-inferrer-arg.js Loading commit data...
func-name-inferrer-arg.out Loading commit data...
function-param-after-rest.js Loading commit data...
function-param-after-rest.out Loading commit data...
generators-throw1.js Loading commit data...
generators-throw1.out Loading commit data...
generators-throw2.js Loading commit data...
generators-throw2.out Loading commit data...
get-iterator-return-non-receiver.js Loading commit data...
get-iterator-return-non-receiver.out Loading commit data...
get-iterator1.js Loading commit data...
get-iterator1.out Loading commit data...
import-as-eval.mjs Loading commit data...
import-as-eval.out Loading commit data...
import-as-redeclaration.mjs Loading commit data...
import-as-redeclaration.out Loading commit data...
import-as-reserved-word.mjs Loading commit data...
import-as-reserved-word.out Loading commit data...
import-blah-module.mjs Loading commit data...
import-blah-module.out Loading commit data...
import-blah-script.js Loading commit data...
import-blah-script.out Loading commit data...
import-eval.mjs Loading commit data...
import-eval.out Loading commit data...
import-redeclaration.mjs Loading commit data...
import-redeclaration.out Loading commit data...
import-reserved-word.mjs Loading commit data...
import-reserved-word.out Loading commit data...
import-script.js Loading commit data...
import-script.out Loading commit data...
instanceof-noncallable.js Loading commit data...
instanceof-noncallable.out Loading commit data...
instanceof-nonobject.js Loading commit data...
instanceof-nonobject.out Loading commit data...
invalid-spread-2.js Loading commit data...
invalid-spread-2.out Loading commit data...
invalid-spread.js Loading commit data...
invalid-spread.out Loading commit data...
json-stringify-circular-ellipsis.js Loading commit data...
json-stringify-circular-ellipsis.out Loading commit data...
json-stringify-circular-max-display-depth.js Loading commit data...
json-stringify-circular-max-display-depth.out Loading commit data...
json-stringify-circular-proxy.js Loading commit data...
json-stringify-circular-proxy.out Loading commit data...
json-stringify-circular-substructure.js Loading commit data...
json-stringify-circular-substructure.out Loading commit data...
json-stringify-circular.js Loading commit data...
json-stringify-circular.out Loading commit data...
let-lexical-declaration-destructuring-brace-in-single-statement.js Loading commit data...
let-lexical-declaration-destructuring-brace-in-single-statement.out Loading commit data...
let-lexical-declaration-destructuring-in-single-statement.js Loading commit data...
let-lexical-declaration-destructuring-in-single-statement.out Loading commit data...
let-lexical-declaration-in-single-statement.js Loading commit data...
let-lexical-declaration-in-single-statement.out Loading commit data...
let-lexical-name-in-array-prohibited.js Loading commit data...
let-lexical-name-in-array-prohibited.out Loading commit data...
let-lexical-name-in-object-prohibited.js Loading commit data...
let-lexical-name-in-object-prohibited.out Loading commit data...
let-lexical-name-prohibited.js Loading commit data...
let-lexical-name-prohibited.out Loading commit data...
map-arg-non-iterable.js Loading commit data...
map-arg-non-iterable.out Loading commit data...
missing-function-name.js Loading commit data...
missing-function-name.out Loading commit data...
modules-cycle1.mjs Loading commit data...
modules-cycle1.out Loading commit data...
modules-cycle2.mjs Loading commit data...
modules-cycle2.out Loading commit data...
modules-cycle3.mjs Loading commit data...
modules-cycle3.out Loading commit data...
modules-cycle4.mjs Loading commit data...
modules-cycle4.out Loading commit data...
modules-cycle5.mjs Loading commit data...
modules-cycle5.out Loading commit data...
modules-cycle6.mjs Loading commit data...
modules-cycle6.out Loading commit data...
modules-duplicate-export1.mjs Loading commit data...
modules-duplicate-export1.out Loading commit data...
modules-duplicate-export2.mjs Loading commit data...
modules-duplicate-export2.out Loading commit data...
modules-duplicate-export3.mjs Loading commit data...
modules-duplicate-export3.out Loading commit data...
modules-duplicate-export4.mjs Loading commit data...
modules-duplicate-export4.out Loading commit data...
modules-duplicate-export5.mjs Loading commit data...
modules-duplicate-export5.out Loading commit data...
modules-export-illformed-class.mjs Loading commit data...
modules-export-illformed-class.out Loading commit data...
modules-import-redeclare1.mjs Loading commit data...
modules-import-redeclare1.out Loading commit data...
modules-import-redeclare2.mjs Loading commit data...
modules-import-redeclare2.out Loading commit data...
modules-import-redeclare3.mjs Loading commit data...
modules-import-redeclare3.out Loading commit data...
modules-import1.mjs Loading commit data...
modules-import1.out Loading commit data...
modules-import2.mjs Loading commit data...
modules-import2.out Loading commit data...
modules-import3.mjs Loading commit data...
modules-import3.out Loading commit data...
modules-import4.mjs Loading commit data...
modules-import4.out Loading commit data...
modules-import5.mjs Loading commit data...
modules-import5.out Loading commit data...
modules-import6.mjs Loading commit data...
modules-import6.out Loading commit data...
modules-skip-cycle2.mjs Loading commit data...
modules-skip-cycle3.mjs Loading commit data...
modules-skip-cycle5.mjs Loading commit data...
modules-skip-cycle6.mjs Loading commit data...
modules-star-conflict1.mjs Loading commit data...
modules-star-conflict1.out Loading commit data...
modules-star-conflict2.mjs Loading commit data...
modules-star-conflict2.out Loading commit data...
modules-star-default.mjs Loading commit data...
modules-star-default.out Loading commit data...
modules-undefined-export1.mjs Loading commit data...
modules-undefined-export1.out Loading commit data...
modules-undefined-export2.mjs Loading commit data...
modules-undefined-export2.out Loading commit data...
new-target-assignment.js Loading commit data...
new-target-assignment.out Loading commit data...
new-target-escaped.js Loading commit data...
new-target-escaped.out Loading commit data...
new-target-for-loop.js Loading commit data...
new-target-for-loop.out Loading commit data...
new-target-postfix-op.js Loading commit data...
new-target-postfix-op.out Loading commit data...
new-target-prefix-op.js Loading commit data...
new-target-prefix-op.out Loading commit data...
nf-yield-in-generator.js Loading commit data...
nf-yield-in-generator.out Loading commit data...
nf-yield-strict-in-generator.js Loading commit data...
nf-yield-strict-in-generator.out Loading commit data...
nf-yield-strict.js Loading commit data...
nf-yield-strict.out Loading commit data...
nfe-yield-generator.js Loading commit data...
nfe-yield-generator.out Loading commit data...
nfe-yield-strict.js Loading commit data...
nfe-yield-strict.out Loading commit data...
non-alphanum.js Loading commit data...
non-alphanum.out Loading commit data...
object-binding-pattern-await1.js Loading commit data...
object-binding-pattern-await1.out Loading commit data...
object-rest-assignment-pattern.js Loading commit data...
object-rest-assignment-pattern.out Loading commit data...
object-rest-binding-pattern.js Loading commit data...
object-rest-binding-pattern.out Loading commit data...
octal-template-literal.js Loading commit data...
octal-template-literal.out Loading commit data...
overwritten-builtins.js Loading commit data...
overwritten-builtins.out Loading commit data...
param-arrow-redeclaration-as-let.js Loading commit data...
param-arrow-redeclaration-as-let.out Loading commit data...
param-async-arrow-redeclaration-as-let.js Loading commit data...
param-async-arrow-redeclaration-as-let.out Loading commit data...
param-async-function-redeclaration-as-let.js Loading commit data...
param-async-function-redeclaration-as-let.out Loading commit data...
param-function-redeclaration-as-let.js Loading commit data...
param-function-redeclaration-as-let.out Loading commit data...
paren_in_arg_string.js Loading commit data...
paren_in_arg_string.out Loading commit data...
redeclaration1.js Loading commit data...
redeclaration1.out Loading commit data...
redeclaration2.js Loading commit data...
redeclaration2.out Loading commit data...
redeclaration3.js Loading commit data...
redeclaration3.out Loading commit data...
redeclaration4.js Loading commit data...
redeclaration4.out Loading commit data...
redeclaration5.mjs Loading commit data...
redeclaration5.out Loading commit data...
replacement-marker-as-argument.js Loading commit data...
replacement-marker-as-argument.out Loading commit data...
rest-param-class-setter-strict.js Loading commit data...
rest-param-class-setter-strict.out Loading commit data...
rest-param-object-setter-sloppy.js Loading commit data...
rest-param-object-setter-sloppy.out Loading commit data...
rest-param-object-setter-strict.js Loading commit data...
rest-param-object-setter-strict.out Loading commit data...
settimeout.js Loading commit data...
settimeout.out Loading commit data...
simple-throw.js Loading commit data...
simple-throw.out Loading commit data...
strict-formal-parameters.js Loading commit data...
strict-formal-parameters.out Loading commit data...
strict-octal-number.js Loading commit data...
strict-octal-number.out Loading commit data...
strict-octal-string.js Loading commit data...
strict-octal-string.out Loading commit data...
strict-octal-use-strict-after.js Loading commit data...
strict-octal-use-strict-after.out Loading commit data...
strict-octal-use-strict-before.js Loading commit data...
strict-octal-use-strict-before.out Loading commit data...
strict-with.js Loading commit data...
strict-with.out Loading commit data...
super-constructor-extra-statement.js Loading commit data...
super-constructor-extra-statement.out Loading commit data...
super-constructor.js Loading commit data...
super-constructor.out Loading commit data...
super-in-function.js Loading commit data...
super-in-function.out Loading commit data...
tonumber-symbol.js Loading commit data...
tonumber-symbol.out Loading commit data...
try-catch-finally-throw-in-catch-and-finally.js Loading commit data...
try-catch-finally-throw-in-catch-and-finally.out Loading commit data...
try-catch-finally-throw-in-catch.js Loading commit data...
try-catch-finally-throw-in-catch.out Loading commit data...
try-catch-finally-throw-in-finally.js Loading commit data...
try-catch-finally-throw-in-finally.out Loading commit data...
try-catch-lexical-conflict-preparser.js Loading commit data...
try-catch-lexical-conflict-preparser.out Loading commit data...
try-catch-lexical-conflict.js Loading commit data...
try-catch-lexical-conflict.out Loading commit data...
try-catch-variable-conflict.js Loading commit data...
try-catch-variable-conflict.out Loading commit data...
try-finally-throw-in-finally.js Loading commit data...
try-finally-throw-in-finally.out Loading commit data...
try-finally-throw-in-try-and-finally.js Loading commit data...
try-finally-throw-in-try-and-finally.out Loading commit data...
try-finally-throw-in-try.js Loading commit data...
try-finally-throw-in-try.out Loading commit data...
typedarray.js Loading commit data...
typedarray.out Loading commit data...
undefined-keyed-property.js Loading commit data...
undefined-keyed-property.out Loading commit data...
unicode-escape-invalid-2.js Loading commit data...
unicode-escape-invalid-2.out Loading commit data...
unicode-escape-invalid.js Loading commit data...
unicode-escape-invalid.out Loading commit data...
unicode-escape-undefined.js Loading commit data...
unicode-escape-undefined.out Loading commit data...
unparenthesized-exponentiation-expression.js Loading commit data...
unparenthesized-exponentiation-expression.out Loading commit data...
unterminated-arg-list.js Loading commit data...
unterminated-arg-list.out Loading commit data...
var-conflict-in-with.js Loading commit data...
var-conflict-in-with.out Loading commit data...
wasm-async-compile-fail.js Loading commit data...
wasm-async-compile-fail.out Loading commit data...
wasm-async-instantiate-fail.js Loading commit data...
wasm-async-instantiate-fail.out Loading commit data...
wasm-exception-rethrow.js Loading commit data...
wasm-exception-rethrow.out Loading commit data...
wasm-exception-throw.js Loading commit data...
wasm-exception-throw.out Loading commit data...
wasm-function-name.js Loading commit data...
wasm-function-name.out Loading commit data...
wasm-module-and-function-name.js Loading commit data...
wasm-module-and-function-name.out Loading commit data...
wasm-module-name.js Loading commit data...
wasm-module-name.out Loading commit data...
wasm-no-name.js Loading commit data...
wasm-no-name.out Loading commit data...
wasm-streaming-compile-fail.js Loading commit data...
wasm-streaming-compile-fail.out Loading commit data...
wasm-streaming-instantiate-fail.js Loading commit data...
wasm-streaming-instantiate-fail.out Loading commit data...
wasm-sync-compile-fail.js Loading commit data...
wasm-sync-compile-fail.out Loading commit data...
wasm-trap.js Loading commit data...
wasm-trap.out Loading commit data...
weak-refs-finalizationgroup1.js Loading commit data...
weak-refs-finalizationgroup1.out Loading commit data...
weak-refs-finalizationgroup2.js Loading commit data...
weak-refs-finalizationgroup2.out Loading commit data...
weak-refs-register1.js Loading commit data...
weak-refs-register1.out Loading commit data...
weak-refs-register2.js Loading commit data...
weak-refs-register2.out Loading commit data...
weak-refs-unregister.js Loading commit data...
weak-refs-unregister.out Loading commit data...
yield-in-arrow-param.js Loading commit data...
yield-in-arrow-param.out Loading commit data...
yield-in-generator-param.js Loading commit data...
yield-in-generator-param.out Loading commit data...