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

Issue 1313783003: dart2js cps: Generate interceptors at use-site and share afterwards. (Closed)

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

Description

dart2js cps: Generate interceptors at use-site and share afterwards. Previously, interceptors were generated at the definition-site to ensure sharing, and sometimes sunk to its use-site if desirable. Now they are (again) generated at use-site, then pulled out of loops, and replaced by dominating calls to getInterceptor. This means interceptors are only computed if they really are needed, but on the other hand, they are sometimes computed more than once, when there are uses that don't have a common dominator. Interceptor constants are currently not shared/hoisted as it is not clear when this is beneficial. R=kmillikin@google.com Committed: https://github.com/dart-lang/sdk/commit/ade4822108cc1e61dea7120da46e2bb8518715c4

Patch Set 1 #

Total comments: 3

Patch Set 2 : Merge #

Patch Set 3 : Also share/hoist interceptor constants #

Patch Set 4 : Revert patch #3. I read Golem results backwards. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+230 lines, -298 lines) Patch
M pkg/compiler/lib/src/cps_ir/let_sinking.dart View 2 chunks +1 line, -139 lines 0 comments Download
A + pkg/compiler/lib/src/cps_ir/loop_hierarchy.dart View 2 chunks +7 lines, -111 lines 0 comments Download
A pkg/compiler/lib/src/cps_ir/loop_invariant_code_motion.dart View 3 1 chunk +134 lines, -0 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/optimizers.dart View 1 chunk +2 lines, -0 lines 0 comments Download
A pkg/compiler/lib/src/cps_ir/share_interceptors.dart View 3 1 chunk +42 lines, -0 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/task.dart View 1 chunk +2 lines, -0 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/unsugar.dart View 1 2 chunks +41 lines, -48 lines 0 comments Download
M tests/compiler/dart2js_extra/dart2js_extra.status View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
asgerf
https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extra/dart2js_extra.status File tests/compiler/dart2js_extra/dart2js_extra.status (right): https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extra/dart2js_extra.status#newcode73 tests/compiler/dart2js_extra/dart2js_extra.status:73: 23432_test: RuntimeError # Issue 23432 It sort of passed ...
5 years, 3 months ago (2015-08-25 14:00:43 UTC) #2
Kevin Millikin (Google)
LGTM.
5 years, 3 months ago (2015-08-28 11:27:28 UTC) #3
asgerf
Committed patchset #4 (id:60001) manually as ade4822108cc1e61dea7120da46e2bb8518715c4 (presubmit successful).
5 years, 3 months ago (2015-08-28 14:02:21 UTC) #4
sra1
https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extra/dart2js_extra.status File tests/compiler/dart2js_extra/dart2js_extra.status (right): https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extra/dart2js_extra.status#newcode73 tests/compiler/dart2js_extra/dart2js_extra.status:73: 23432_test: RuntimeError # Issue 23432 On 2015/08/25 14:00:42, asgerf ...
5 years, 3 months ago (2015-08-31 18:12:08 UTC) #6
asgerf
https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extra/dart2js_extra.status File tests/compiler/dart2js_extra/dart2js_extra.status (right): https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extra/dart2js_extra.status#newcode73 tests/compiler/dart2js_extra/dart2js_extra.status:73: 23432_test: RuntimeError # Issue 23432 On 2015/08/31 18:12:07, sra1 ...
5 years, 3 months ago (2015-08-31 18:23:05 UTC) #7
sra1
5 years, 3 months ago (2015-08-31 18:45:18 UTC) #8
Message was sent while issue was closed.
On 2015/08/31 18:23:05, asgerf wrote:
>
https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extr...
> File tests/compiler/dart2js_extra/dart2js_extra.status (right):
> 
>
https://codereview.chromium.org/1313783003/diff/1/tests/compiler/dart2js_extr...
> tests/compiler/dart2js_extra/dart2js_extra.status:73: 23432_test: RuntimeError
#
> Issue 23432
> On 2015/08/31 18:12:07, sra1 wrote:
> > On 2015/08/25 14:00:42, asgerf wrote:
> > > It sort of passed for the wrong reason, and also seems to pass for the
wrong
> > > reason in the SSA backend.
> > 
> > What is the wrong reason?
> 
> Ah, right. I was trying to get to the bottom of things, but then got
> side-tracked.
> 
> There is a call to getInterceptor that gets a numeric argument, but JSNumber
is
> not an intercepted class because numbers don't respond to that selector. The
> call intentionally fails at runtime.
> 
> In CPS, the getInterceptor call returns the number itself, and the resulting
> exception message is not rewritten into a nice exception message. It says
> something like "getInterceptor(x).blah" is not a method where it was supposed
to
> say something like "12345 does not have a method blah".
> 
> In SSA, the getInterceptor call has a case for UnknownJavaScriptObject which
is
> only there because the program contains a try/catch. The number is (on
purpose?)
> classified as such an unknown object. The unknown object's method table then
> responds to the message by throwing a nice-looking exception message and
passes
> the test.
> 
> The UnknownJavaScriptObject case seems to go away if there is no try/catch.
> 
> I can make SSA generate just as bad error messages by removing all try/catches
> from the program, but we can't make a test case for it because it needs a
> try/catch to inspect the error message.
> 
> I don't know the official strategy for getting nice-looking exception message.
> Having the UnknownJavaScriptObject case isn't such a bad idea for handling
> negative cases, but the condition under which that happens in the SSA is
weird.

Thanks for the details. I want to revisit the area of generating useful errors
and make it more consistent.
The current situation in SSA is, as you say, weird.

Powered by Google App Engine
This is Rietveld 408576698