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

Issue 10823389: Start inferring return types for static functions (Closed)

Created:
8 years, 4 months ago by Søren Gjesse
Modified:
8 years, 4 months ago
Reviewers:
floitsch, ngeoffray, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Start inferring return types for static functions Types propagated to the function exit are recorded in the code generator and optimisticly used at call sites. If this optimistic assumption fails the callers have to be recompiled. R=kasperl, ngeoffray, floitsch Committed: https://code.google.com/p/dart/source/detail?r=10876

Patch Set 1 #

Total comments: 14

Patch Set 2 : Addressed review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+92 lines, -17 lines) Patch
M lib/compiler/implementation/js_backend/backend.dart View 1 4 chunks +65 lines, -0 lines 0 comments Download
M lib/compiler/implementation/ssa/builder.dart View 2 chunks +7 lines, -2 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 chunk +9 lines, -0 lines 0 comments Download
A + tests/compiler/dart2js/return_type_inferer_test.dart View 1 chunk +11 lines, -15 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Søren Gjesse
8 years, 4 months ago (2012-08-17 09:29:46 UTC) #1
ngeoffray
https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/js_backend/backend.dart#newcode405 lib/compiler/implementation/js_backend/backend.dart:405: * Retreive the return type of the function [calee]. ...
8 years, 4 months ago (2012-08-17 10:02:51 UTC) #2
Søren Gjesse
https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/js_backend/backend.dart#newcode405 lib/compiler/implementation/js_backend/backend.dart:405: * Retreive the return type of the function [calee]. ...
8 years, 4 months ago (2012-08-17 10:08:53 UTC) #3
kasperl
https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/js_backend/backend.dart#newcode405 lib/compiler/implementation/js_backend/backend.dart:405: * Retreive the return type of the function [calee]. ...
8 years, 4 months ago (2012-08-17 10:11:07 UTC) #4
ngeoffray
LGTM https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/ssa/codegen.dart File lib/compiler/implementation/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implementation/ssa/codegen.dart#newcode33 lib/compiler/implementation/ssa/codegen.dart:33: if (block.last is HReturn) { On 2012/08/17 10:08:54, ...
8 years, 4 months ago (2012-08-17 10:13:29 UTC) #5
Søren Gjesse
8 years, 4 months ago (2012-08-17 10:21:04 UTC) #6
https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implement...
File lib/compiler/implementation/js_backend/backend.dart (right):

https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implement...
lib/compiler/implementation/js_backend/backend.dart:405: * Retreive the return
type of the function [calee]. The type is optimistic
On 2012/08/17 10:11:07, kasperl wrote:
> i before e except after c (Retrieve).

Done.

https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implement...
File lib/compiler/implementation/ssa/codegen.dart (right):

https://chromiumcodereview.appspot.com/10823389/diff/1/lib/compiler/implement...
lib/compiler/implementation/ssa/codegen.dart:33: if (block.last is HReturn) {
On 2012/08/17 10:13:29, ngeoffray wrote:
> On 2012/08/17 10:08:54, Søren Gjesse wrote:
> > On 2012/08/17 10:02:51, ngeoffray wrote:
> > > How about a function with multiple return?
> > 
> > This should be handled by the
> > 
> > graph.exit.predecessors.forEach((block) {
> > 
> > above.
> 
> Hmm, a HReturn block has the HExit block as a successor? Is that always true
and
> checked?
> 
> To make it simpler in the SSA, maybe we should have one HReturn and all return
> values flow into a phi in the exit block, which will contain the HReturn.

I checked the (3) places where HReturn nodes are created, which is how I got to
this in the first place. For functions which don't return a value a HGoto is
normally taking control flow to the HExit node.

Powered by Google App Engine
This is Rietveld 408576698