Revert "[parsing] Improve elision of hole checks for default parameters"
This reverts commit e8d865973f
.
Reason for revert: crbug.com/981701
Original change's description:
> [parsing] Improve elision of hole checks for default parameters
>
> Use the position of the next parameter to be declared as the end of the
> initializer for default parameters, so that hole checks can be elided
> for initializers using previous parameters in arrow functions.
>
> This fixes a source of bytecode mismatches when collecting source
> positions lazily.
>
> Bug: chromium:980422, v8:8510
> Change-Id: I5ab074231248b661156e7d8e47c01685448b56d5
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1683267
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Dan Elphick <delphick@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62525}
TBR=verwaest@chromium.org,delphick@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:980422, v8:8510
Change-Id: I3abd70a1fb00967e58b46177655a0078e24db720
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1697242
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62630}
This commit is contained in:
parent
371dd417be
commit
a61ce8a0d0
@ -694,15 +694,9 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
|
||||
}
|
||||
}
|
||||
|
||||
auto var_it = this->variable_list()->begin();
|
||||
int initializer_position = this->parser()->end_position();
|
||||
for (auto declaration : *result->declarations()) {
|
||||
// If it's not the last variable, then use the position of the next
|
||||
// variable. For the last one, use the end position of the arrow head.
|
||||
int end_position = var_it + 1 == this->variable_list()->end()
|
||||
? this->parser()->end_position()
|
||||
: (*(var_it + 1))->position();
|
||||
declaration->var()->set_initializer_position(end_position);
|
||||
var_it++;
|
||||
declaration->var()->set_initializer_position(initializer_position);
|
||||
}
|
||||
if (uses_this_) result->UsesThis();
|
||||
return result;
|
||||
|
@ -1,24 +0,0 @@
|
||||
// Copyright 2019 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --enable-lazy-source-positions
|
||||
try {
|
||||
(function () {
|
||||
((d, e = d) => {
|
||||
throw new Error();
|
||||
})();
|
||||
})();
|
||||
} catch (ex) {
|
||||
print(ex.stack);
|
||||
}
|
||||
|
||||
try {
|
||||
(function () {
|
||||
((d, e = f, f = d) => {
|
||||
// Won't get here as the initializers will cause a ReferenceError
|
||||
})();
|
||||
})();
|
||||
} catch (ex) {
|
||||
print(ex.stack);
|
||||
}
|
Loading…
Reference in New Issue
Block a user