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

Issue 1355563002: Abandon type inference on closures that (potentially) flow into Function.apply. (Closed)

Created:
5 years, 3 months ago by herhut
Modified:
5 years, 3 months ago
CC:
reviews_dartlang.org, Siggi Cherem (dart-lang)
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Abandon type inference on closures that (potentially) flow into Function.apply. Type inference uses the closure tracer to decide whether it has sufficient global information to compute an actual type on a closure. If tracing fails, it will abandon type inference for that closure. However, we no longer fail tracing just because a closure flows into Function.apply, as this still means that we have seen all use sites. Unfortunately, type inference does not understand that Function.apply is actually a call site (and we lack other information to make this knowledge worthwhile). So it concludes that the closure is never called. With this fix, it now correctly abandons inference again. The second issue was that we only take default values into account when looking at a call site (so that we only use them if they are actually used). This can be decided statically unless we loose track or there is a call to Function.apply. I have added an extra edge to the use-graph so that there now always is a use edge from a default to the parameter. While this is conservative, it will only affect tracing and thus only the types of traced entities that are used as default should be impacted. BUG= http://dartbug.com/24297 R=sigmund@google.com, sra@google.com Committed: https://github.com/dart-lang/sdk/commit/75b48722bc041e41f9a703531e5ce6913a1667c0

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -16 lines) Patch
M pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M pkg/compiler/lib/src/inferrer/type_graph_nodes.dart View 5 chunks +22 lines, -6 lines 0 comments Download
M tests/compiler/dart2js/dart2js.status View 1 chunk +0 lines, -6 lines 0 comments Download
M tests/compiler/dart2js/simple_inferrer_const_closure_default_test.dart View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
herhut
5 years, 3 months ago (2015-09-17 12:37:34 UTC) #1
sra1
lgtm LGTM. Thanks!
5 years, 3 months ago (2015-09-17 15:49:50 UTC) #2
Siggi Cherem (dart-lang)
lgtm
5 years, 3 months ago (2015-09-17 19:45:38 UTC) #4
herhut
5 years, 3 months ago (2015-09-18 08:13:40 UTC) #5
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
75b48722bc041e41f9a703531e5ce6913a1667c0 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698