Bug 133832

Summary: Parser statementDepth accounting needs to account for when a function body excludes its braces
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: fpizlo, ggaren, mhahnenberg, mmirman, msaboff, oliver, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
work in progress. The layout test needs some refinement. It is not currently detecting the regression because the harness is not sensitive to it.
none
perf run 1
none
perf run 2: (inversed) new patch as Conf#1, baseline as Conf#2.
none
perf run 3
none
patch 2: fixed tests so that they are more expressive, and can detect the issue in this bug. Still need to look into the JSRegress perf issue.
oliver: review-
patch 3: undo result rephrasing to minimize the diff. Will work on the perf regression next.
none
patch 4: rebased + Oliver's suggested string change.
oliver: review+
perf run 4
none
perf run 5
none
perf run 6
none
perf run 7: inversed (new code first followed by baseline)
none
perf run 8: inversed (new code first followed by a 2nd build of the baseline) none

Mark Lam
Reported 2014-06-12 17:12:36 PDT
In some cases (e.g. when a Function object is instantiated from a string), the function body source may not include its braces. The parser needs to account for this when calculating its statementDepth.
Attachments
work in progress. The layout test needs some refinement. It is not currently detecting the regression because the harness is not sensitive to it. (14.92 KB, patch)
2014-06-12 18:30 PDT, Mark Lam
no flags
perf run 1 (41.73 KB, text/plain)
2014-06-12 18:34 PDT, Mark Lam
no flags
perf run 2: (inversed) new patch as Conf#1, baseline as Conf#2. (41.74 KB, text/plain)
2014-06-12 18:34 PDT, Mark Lam
no flags
perf run 3 (41.61 KB, text/plain)
2014-06-12 18:35 PDT, Mark Lam
no flags
patch 2: fixed tests so that they are more expressive, and can detect the issue in this bug. Still need to look into the JSRegress perf issue. (99.78 KB, patch)
2014-06-13 01:41 PDT, Mark Lam
oliver: review-
patch 3: undo result rephrasing to minimize the diff. Will work on the perf regression next. (46.93 KB, patch)
2014-06-15 13:30 PDT, Mark Lam
no flags
patch 4: rebased + Oliver's suggested string change. (46.96 KB, patch)
2014-06-16 15:42 PDT, Mark Lam
oliver: review+
perf run 4 (40.92 KB, text/plain)
2014-06-16 15:43 PDT, Mark Lam
no flags
perf run 5 (41.32 KB, text/plain)
2014-06-16 15:43 PDT, Mark Lam
no flags
perf run 6 (41.05 KB, text/plain)
2014-06-16 15:43 PDT, Mark Lam
no flags
perf run 7: inversed (new code first followed by baseline) (41.28 KB, text/plain)
2014-06-16 15:44 PDT, Mark Lam
no flags
perf run 8: inversed (new code first followed by a 2nd build of the baseline) (41.39 KB, text/plain)
2014-06-16 15:45 PDT, Mark Lam
no flags
Mark Lam
Comment 1 2014-06-12 17:13:32 PDT
Mark Lam
Comment 2 2014-06-12 18:30:46 PDT
Created attachment 233016 [details] work in progress. The layout test needs some refinement. It is not currently detecting the regression because the harness is not sensitive to it. This is a work in progress. The layout test needs some refinement. Please feel free to provide feedback if so inclined. The benchmark tests shows that the perf is about the same in aggregate. However, in 3 separate runs, I'm seeing JSRegress' array-with-double-mul-add showing about a 10% regression. I will post benchmark results soon, and will investigate the regressions later.
Mark Lam
Comment 3 2014-06-12 18:34:16 PDT
Created attachment 233017 [details] perf run 1
Mark Lam
Comment 4 2014-06-12 18:34:59 PDT
Created attachment 233018 [details] perf run 2: (inversed) new patch as Conf#1, baseline as Conf#2.
Mark Lam
Comment 5 2014-06-12 18:35:17 PDT
Created attachment 233019 [details] perf run 3
Mark Lam
Comment 6 2014-06-13 01:41:04 PDT
Created attachment 233033 [details] patch 2: fixed tests so that they are more expressive, and can detect the issue in this bug. Still need to look into the JSRegress perf issue.
Oliver Hunt
Comment 7 2014-06-13 16:49:22 PDT
Comment on attachment 233033 [details] patch 2: fixed tests so that they are more expressive, and can detect the issue in this bug. Still need to look into the JSRegress perf issue. View in context: https://bugs.webkit.org/attachment.cgi?id=233033&action=review r- due to tests and apparent perf issue > Source/JavaScriptCore/parser/Parser.cpp:1129 > + failIfFalseIfStrict(m_statementDepth == 1, "In strict mode, functions may only be declared at top level or immediately within another function"); "Strict mode does not allow function declarations in a lexically nested statement" > LayoutTests/ChangeLog:4 > + Parser statementDepth accounting needs to account for when a function body excludes its braces. > + <https://webkit.org/b/133832> Please do the rephrasing in a second patch as it's currently obscuring your meaningful tests invalid vs. valid is fine in our other tests so this rephrasing isn't critical to this patch.
Mark Lam
Comment 8 2014-06-15 13:30:49 PDT
Created attachment 233146 [details] patch 3: undo result rephrasing to minimize the diff. Will work on the perf regression next.
Mark Lam
Comment 9 2014-06-16 12:09:05 PDT
(In reply to comment #8) > Created an attachment (id=233146) [details] > patch 3: undo result rephrasing to minimize the diff. Will work on the perf regression next. The perf issue appears to be a red herring. I reverted all the "Source" changes and the 10% on array-with-double-mil-add still manifests. I will rebuild the baseline and redo the test.
Mark Lam
Comment 10 2014-06-16 15:42:38 PDT
Created attachment 233192 [details] patch 4: rebased + Oliver's suggested string change. Perf runs shows that the perf is effectively neutral. The previously supposed regression is just noise. I'll upload perf results shortly.
Mark Lam
Comment 11 2014-06-16 15:43:13 PDT
Created attachment 233193 [details] perf run 4
Mark Lam
Comment 12 2014-06-16 15:43:33 PDT
Created attachment 233194 [details] perf run 5
Mark Lam
Comment 13 2014-06-16 15:43:53 PDT
Created attachment 233195 [details] perf run 6
Mark Lam
Comment 14 2014-06-16 15:44:36 PDT
Created attachment 233196 [details] perf run 7: inversed (new code first followed by baseline)
Mark Lam
Comment 15 2014-06-16 15:45:14 PDT
Created attachment 233197 [details] perf run 8: inversed (new code first followed by a 2nd build of the baseline)
Mark Lam
Comment 16 2014-06-16 16:04:47 PDT
In these new runs of the benchmarks (4 thru 7), the benchmark component that is consistently showing a regression is now bitops-nsieve-bits (in LongSpider) which claims to have about a 1.8x regression. However, if I do another build of the baseline and run against that (run 8), bitops-nsieve-bits is no longer definitely slower. If I run just LongSpider, bitops-nsieve-bits shows no difference in perf.
Oliver Hunt
Comment 17 2014-06-16 16:09:55 PDT
Comment on attachment 233192 [details] patch 4: rebased + Oliver's suggested string change. r-, please remove the changes to logging in the parser test
Mark Lam
Comment 18 2014-06-16 16:22:49 PDT
Thanks. Landed in r170034: <http://trac.webkit.org/r170034>. The logging changes in the parser test was necessary to detect the issues in this bug. Per Oliver (offline), we'll take the changes as is this time, but in the future, we'll make changes like this in a separate test.
Note You need to log in before you can comment on or make changes to this bug.