Bug 172458 - for-in bytecode generation is exponential
Summary: for-in bytecode generation is exponential
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-22 11:44 PDT by Saam Barati
Modified: 2017-05-22 14:30 PDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2017-05-22 11:44:54 PDT
we emit the loop 3 times. If we start nesting for-in loops, this is exponential. I'll verify this is indeed the case.
Comment 1 Saam Barati 2017-05-22 11:46:41 PDT
Yup. We emit 1072675 instruction words for this function:
```
function foo(o) {
    for (let i in o) {
        for (let i in o) {
            for (let i in o) {
                for (let i in o) {
                    for (let i in o) {
                        for (let i in o) {
                            for (let i in o) {
                                for (let i in o) {
                                    for (let i in o) {
                                        2+2;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

}
```