Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Issue 2971303002: VM(CoreLib): Work around JIT optimization issue revealed by cec963f028198ec5871840491ba78b096ad0b819 (Closed)

Created:
3 years, 5 months ago by Vyacheslav Egorov (Google)
Modified:
3 years, 5 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM(CoreLib): Work around JIT optimization issue revealed by cec963f028198ec5871840491ba78b096ad0b819 Array Bounds Check Generalization pass attempts to hoist CheckArrayBound instructions out of loops by generalizing them: for example in the loop like for (var i = 0; i < L; i++) { // a[i] CheckArrayBound(i, a.length) LoadIndexed(a, i) } we hoist CheckArrayBound(i, a.length) by turning it into CheckArrayBound(L - 1, a.length): CheckArrayBound(L - 1, a.length) for (var i = 0; i < L; i++) { // a[i] LoadIndexed(a, i) } However this leads to deoptimizations if the loop never executes: e.g. if L = 0 then L - 1 is -1 which does not pass generalized bounds check. We prevent repeated deoptimizations by disabling this optimization if any of the generalized bounds checks deoptimizes. However this does not work as intended because we only check this flag on an outermost function, so if function with a problematic bounds check get inlined into a lot of places it ends up causing a lot of deoptimizations in different places. This is why cec963f028198ec5871840491ba78b096ad0b819 caused performance issues in dartdoc: _GrowableList._grow is now called with length == 0 whenever we add an element to an empty list. This causes deoptimization in a lot of different functions in dartdoc because _GrowableList._grow ends up inlined into a lot of different places. Fixes https://github.com/dart-lang/sdk/issues/30090 This CL will be reverted once a better solution for the underlying problem is in place (tracked by https://github.com/dart-lang/sdk/issues/30102) BUG= R=askesc@google.com, erikcorry@google.com Committed: https://github.com/dart-lang/sdk/commit/d24040af02d13264c198ced6774c5ce32e75188a

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -4 lines) Patch
M runtime/lib/growable_array.dart View 1 chunk +15 lines, -4 lines 0 comments Download

Messages

Total messages: 10 (5 generated)
Vyacheslav Egorov (Google)
PTAL
3 years, 5 months ago (2017-07-07 12:19:40 UTC) #2
erikcorry
3 years, 5 months ago (2017-07-07 12:22:24 UTC) #4
erikcorry
lgtm
3 years, 5 months ago (2017-07-07 12:22:40 UTC) #5
Aske Simon Christensen
lgtm
3 years, 5 months ago (2017-07-07 12:30:59 UTC) #8
Vyacheslav Egorov (Google)
3 years, 5 months ago (2017-07-07 12:34:56 UTC) #10
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
d24040af02d13264c198ced6774c5ce32e75188a (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698