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

Issue 10855170: Track types for arguments passed to calls to static functions (Closed)

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

Description

Track types for arguments passed to calls to static functions This uses the same mechanism as is currently used for tracking the types of arguments passed to non-static functions. The type collection has been refactored to support both. For static functions the type information for a function is invalidated if the function is used for anything else than a direct call. The test LibTest/core/int/operator_truncating_division_A01_t01 now has the "problem" that the statement Expect.isTrue(actual is int); never fails even though actual might not be an int in the generated JavaScript even though the inferred type for actual is int. R=floitsch@google.com, kasperl@google.com Committed: https://code.google.com/p/dart/source/detail?r=10726

Patch Set 1 #

Total comments: 18
Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -136 lines) Patch
M lib/compiler/implementation/js_backend/backend.dart View 5 chunks +119 lines, -59 lines 10 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 2 chunks +17 lines, -0 lines 6 comments Download
M lib/compiler/implementation/ssa/optimize.dart View 1 chunk +1 line, -0 lines 2 comments Download
M tests/co19/co19-leg.status View 1 chunk +1 line, -1 line 0 comments Download
A + tests/compiler/dart2js/call_site_type_inferer_static_test.dart View 2 chunks +26 lines, -76 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Gjesse
8 years, 4 months ago (2012-08-15 07:59:59 UTC) #1
floitsch
LGTM. http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js_backend/backend.dart#newcode10 lib/compiler/implementation/js_backend/backend.dart:10: InvocationInfo(HInvoke node) : compiledFunctions = new List<Element>() { ...
8 years, 4 months ago (2012-08-15 09:11:59 UTC) #2
Søren Gjesse
8 years, 4 months ago (2012-08-15 12:17:10 UTC) #3
http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js...
File lib/compiler/implementation/js_backend/backend.dart (right):

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js...
lib/compiler/implementation/js_backend/backend.dart:10: InvocationInfo(HInvoke
node) : compiledFunctions = new List<Element>() {
On 2012/08/15 09:11:59, floitsch wrote:
> nit: move the init into a separate line.

Done.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js...
lib/compiler/implementation/js_backend/backend.dart:13: if (node == null)
return;
On 2012/08/15 09:11:59, floitsch wrote:
> named constructor: InvocationInfo.withoutType() ?

Good point, done.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js...
lib/compiler/implementation/js_backend/backend.dart:247: recompile(Element
element) {
On 2012/08/15 09:11:59, floitsch wrote:
> void recompile(Element element) {

Done.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js...
lib/compiler/implementation/js_backend/backend.dart:251: }
On 2012/08/15 09:11:59, floitsch wrote:
> new line after function declarations.

Done.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/js...
lib/compiler/implementation/js_backend/backend.dart:279: void
registerNonCallStaticUse(HStatic node) {
On 2012/08/15 09:11:59, floitsch wrote:
> where is the same functionality for dynamic calls?

We don't have it, and its a bug. I have filed
http://code.google.com/p/dart/issues/detail?id=4515.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/ss...
File lib/compiler/implementation/ssa/codegen.dart (right):

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/ss...
lib/compiler/implementation/ssa/codegen.dart:1481: // Register this invocation
to collect the types used at all call sites.
On 2012/08/15 09:11:59, floitsch wrote:
> assert that the typeCode is the one you expect it to be.
> I would add a static STATIC_CALL_TYPECODE constant in the HInvokeStatic class,
> and use that one in its typeCode and here. You might even want to remove all
the
> is checks and just use the typeCode.

Done.

We should look into giving named constants to all type codes. Currently they are
just integer literals.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/ss...
lib/compiler/implementation/ssa/codegen.dart:1482: if
(Elements.isStaticOrTopLevelFunction(node.element)) {
On 2012/08/15 09:11:59, floitsch wrote:
> redundant if.

Removed.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/ss...
lib/compiler/implementation/ssa/codegen.dart:1906: if (instr is !HInvokeStatic
|| instr.target !== node) {
On 2012/08/15 09:11:59, floitsch wrote:
> not enough:
> foo(foo);

Good catch!

Added check that the HStatic is also not any of the other inputs if is is the
target.

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/ss...
File lib/compiler/implementation/ssa/optimize.dart (right):

http://codereview.chromium.org/10855170/diff/1/lib/compiler/implementation/ss...
lib/compiler/implementation/ssa/optimize.dart:566: if (field.getLibrary() !==
work.element.getLibrary()) return node;
On 2012/08/15 09:11:59, floitsch wrote:
> if (field.getLibrary() !== work.element.getLibrary() && node.name.isPrivate())
> return node;
> 
> I would prefer this change in a separate CL.

Moved to http://codereview.chromium.org/10830331/

Powered by Google App Engine
This is Rietveld 408576698