Closed Bug 1342553 Opened 3 years ago Closed 3 years ago

Use try-catch for IteratorClose in for-of.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox53 --- fixed
firefox54 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(2 files)

separated from bug 1331092.

for-of currently uses JSTRY_ITERCLOSE note to handle IteratorClose.
for-await-of needs to use try-catch to handle AsyncIteratorClose, and it should be better unifying them.

using try-catch in for-of shows no notable regression for normal execution case , and some improvement/regression for abrupt cases (results in bug 1331092 comment #38).

patches are already attached to bug 1331092 comment #39 and bug 1331092 comment #53.
I'll land them for this bug, to make it easier to track any breakage etc.
Blocks: 1331092
from bug 1331092.
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Attachment #8841140 - Flags: review+
separated CodeGenerator::{IsCallable,IsConstructor} logic into CodeGenerator::emitIsCallableOrConstructor.

CodeGenerator::visitCheckIsCallable now uses emitIsCallableOrConstructor for object case, and jumps to CheckIsCallable function for non-callable or proxy cases.
Attachment #8841141 - Flags: review?(shu)
Comment on attachment 8841141 [details] [diff] [review]
Part 0.2: Support JSOP_CHECKISCALLABLE in JIT.

Review of attachment 8841141 [details] [diff] [review]:
-----------------------------------------------------------------

Oo, refactored IsConstructor too. Thank you for always going above and beyond.

::: js/src/jit/MIR.h
@@ +13484,5 @@
> +    public BoxInputsPolicy::Data
> +{
> +    uint8_t checkKind_;
> +
> +    explicit MCheckIsCallable(MDefinition* toCheck, uint8_t checkKind)

Doesn't need to be explicit.

@@ +13485,5 @@
> +{
> +    uint8_t checkKind_;
> +
> +    explicit MCheckIsCallable(MDefinition* toCheck, uint8_t checkKind)
> +      : MUnaryInstruction(toCheck), checkKind_(checkKind)

nit: checkKind_(checkKind) on its own line

::: js/src/jit/shared/LIR-shared.h
@@ +8962,5 @@
> +    LIR_HEADER(CheckIsCallable)
> +
> +    static const size_t CheckValue = 0;
> +
> +    explicit LCheckIsCallable(const LBoxAllocation& value, const LDefinition& temp) {

Doesn't need to be explicit.
Attachment #8841141 - Flags: review?(shu) → review+
https://hg.mozilla.org/mozilla-central/rev/ba3d6be51e34
https://hg.mozilla.org/mozilla-central/rev/712e84866cf5
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Depends on: 1343072
Summary: Use try-carch for IteratorClose in for-of. → Use try-catch for IteratorClose in for-of.
Depends on: 1344753
You need to log in before you can comment on or make changes to this bug.