Bug 143140 - IteratorClose should be called when jumping over the target for-of loop
Summary: IteratorClose should be called when jumping over the target for-of loop
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-27 12:07 PDT by Yusuke Suzuki
Modified: 2015-04-01 02:37 PDT (History)
5 users (show)

See Also:


Attachments
Patch (28.97 KB, patch)
2015-03-28 02:12 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (24.70 KB, patch)
2015-03-28 02:27 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (24.85 KB, patch)
2015-03-28 02:47 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (26.24 KB, patch)
2015-03-30 10:39 PDT, Yusuke Suzuki
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2015-03-27 12:07:40 PDT
When executing the following script,

var iter = ...;

outer: for (var i of array) {
    for (var j of iter) {
        break outer;
    }
}

iter.return should be called.
Comment 1 Yusuke Suzuki 2015-03-27 12:08:23 PDT
The patch is already submitted in https://bugs.webkit.org/show_bug.cgi?id=142575,
I'll move it to here.
Comment 2 Yusuke Suzuki 2015-03-28 02:12:12 PDT
Created attachment 249659 [details]
Patch
Comment 3 Yusuke Suzuki 2015-03-28 02:27:06 PDT
Created attachment 249660 [details]
Patch
Comment 4 Yusuke Suzuki 2015-03-28 02:47:32 PDT
Created attachment 249661 [details]
Patch
Comment 5 Yusuke Suzuki 2015-03-30 10:39:51 PDT
Created attachment 249743 [details]
Patch
Comment 6 Geoffrey Garen 2015-03-31 16:55:57 PDT
Comment on attachment 249743 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249743&action=review

r=me

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:2358
> +            } else if (finallyContext.iterator) {

This should be an else with an ASSERT. It shouldn't be possible to have a finally context without either a block of code or an iterator close.
Comment 7 Yusuke Suzuki 2015-04-01 02:35:28 PDT
Comment on attachment 249743 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249743&action=review

Thank you for your review! I'll fix and land it.

>> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:2358
>> +            } else if (finallyContext.iterator) {
> 
> This should be an else with an ASSERT. It shouldn't be possible to have a finally context without either a block of code or an iterator close.

You're right. Use else and ASSERT instead.
Comment 8 Yusuke Suzuki 2015-04-01 02:37:06 PDT
Committed r182226: <http://trac.webkit.org/changeset/182226>