Commit Graph

4835 Commits

Author SHA1 Message Date
floitsch@google.com f60bdb707e dart2js: determine if a needed class is needed without having side-effects.
R=zarah@google.com

Review URL: https://codereview.chromium.org//866843002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43107 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 14:44:12 +00:00
kmillikin@google.com c74e16c5d5 Revert "Add a shrinking reduction for dead continuation parameters."
This reverts svn revision r43093, due to failures in dart2dart.  It
clashes with the commit just before it which has changed the type of
FunctionDefinition parameters.

Also, continuation eta-reduction can destroy a dead parameter
reduction.  In this case, it's not obvious which reduction we actually
want.  So though the fixes are simple, I will back this change out and
reevaluate it.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//869223003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43105 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 13:44:41 +00:00
floitsch@google.com 113c5baba9 dart2js: fix csp mode.
Review URL: https://codereview.chromium.org//871003002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43104 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 13:42:23 +00:00
floitsch@google.com a3d4dbc04c dart2js: store call stubs in the model.
R=zarah@google.com

Review URL: https://codereview.chromium.org//865223002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43099 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 12:29:12 +00:00
floitsch@google.com ae592134c6 dart2js: store fields in the model and make the emitters use it.
R=zarah@google.com

Review URL: https://codereview.chromium.org//869543004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43098 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 12:27:40 +00:00
floitsch@google.com d60700d96e dart2js: Don't add properties to native classes that are not needed.
This has no impact on the output, and almost no impact on the compilation time.
However, it makes it clearer, that unneeded native classes really are not needed, and don't need their nativeSpecProperty either.

I want to refactor this code in another CL, but I think it's cleaner if this if-check is already in place now, and not merged into a bigger change.

R=sra@google.com

Review URL: https://codereview.chromium.org//863353002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43096 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 10:35:48 +00:00
floitsch@google.com da94cbcbe3 dart2js: Fix getter/setter flags in the model.
It was inverting cases 10 and 11.

Here is the relevant part from model.dart:

  /// 00: Does not need any getter.
  /// 01:  function() { return this.field; }
  /// 10:  function(receiver) { return receiver.field; }
  /// 11:  function(receiver) { return this.field; }
  final int getterFlags;

  /// 00: Does not need any setter.
  /// 01:  function(value) { this.field = value; }
  /// 10:  function(receiver, value) { receiver.field = value; }
  /// 11:  function(receiver, value) { this.field = value; }
  final int setterFlags;

R=zarah@google.com

Review URL: https://codereview.chromium.org//862783002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43095 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 10:33:50 +00:00
kmillikin@google.com bdba8f356b Add a shrinking reduction for dead continuation parameters.
Continuation parameters that have no uses can be eliminated.  This is
similar to the reduction for dead values except that that continuation
invocations need to be adjusted.

Performing a dead parameter reduction can create other dead parameter
redexes, dead value redexes, or continuation eta-redexes.  Detection
of these redexes does not fit the existing model, where an entire
deleted subterm is visited after being eliminated from the whole term.
Instead, they are detected explicit as part of the reduction
implementation.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//864293004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43093 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 10:27:46 +00:00
asgerf@google.com b78959f1d7 Implement constructor bodies and initializers in CPS->JS backend.
As in the SSA backend, a constructor consists of three parts:
1. Instantiator: creates an object and sets its fields
2. Factory: evaluates field initializers, calls instantiator, then
   calls bodies.
3. Body: executes the body of a constructor.

The CreateClosureClass instruction has been replaced by CreateInstance
for invoking the instantiator for an arbitrary class.

The IrBuilderVisitor has been split into two subclasses to better
isolate the JS-specific code.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//862703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43092 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 10:19:28 +00:00
kmillikin@google.com b79e6f5905 Incorporate some code review comments.
Change the CPS IR's LetCont constructor to have single and multiple
continuation versions.  Update a pair of comments.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//819143007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43071 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 13:09:27 +00:00
herhut@google.com 10899ca02c Revert "Change signature of lookupConstructor to only require a name."
This reverts revision 43067.

BUG=
TBR=floitsch@google.com

Review URL: https://codereview.chromium.org//868643002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43068 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 10:46:18 +00:00
herhut@google.com e37fcb6489 Change signature of lookupConstructor to only require a name.
BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//812523002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43067 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 10:32:43 +00:00
floitsch@google.com ff659c8b61 dart2js: Use is-checks from the model in the old emitter.
R=zarah@google.com

Review URL: https://codereview.chromium.org//840563005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43065 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 10:25:54 +00:00
floitsch@google.com 0c562d82b9 dart2js: use model in native emitter.
R=sra@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//859843002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43064 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 10:23:41 +00:00
herhut@google.com 2260e65e5c Consider updates of locals in type promotion.
BUG= http://dartbug.com/21271
R=floitsch@google.com, karlklose@google.com

Review URL: https://codereview.chromium.org//843613004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43062 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 09:52:31 +00:00
ahe@google.com 34512168d9 Rename $dart_unsafe_eval to $dart_unsafe_incremental_support.
R=kasperl@google.com

Review URL: https://codereview.chromium.org//856333003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43061 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 09:50:07 +00:00
sra@google.com 37e2caf317 Optimize is-check to instanceof when it eliminates an interceptor
See http://dartbug.com/22016 for discussion

R=floitsch@google.com

Review URL: https://codereview.chromium.org//829913006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43058 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 02:24:00 +00:00
floitsch@google.com 7951e1675a dart2js: set needsTearOff when creating the getter/setter stubs in the new emitter.
The Method constructor requires the booleans to be set:

  Method(this.element, this.name, this.code, {this.needsTearOff}) {
    assert(needsTearOff != null);

R=zarah@google.com

Review URL: https://codereview.chromium.org//830193003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43037 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 14:01:13 +00:00
floitsch@google.com d792de5b4b dart2js: Let the emitter generate the program.
This gives the emitter the option to pass options to the builder.

R=zarah@google.com

Review URL: https://codereview.chromium.org//822593004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43035 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 12:04:52 +00:00
floitsch@google.com 094846ec40 dart2js: Don't assume fields are needed, if they are static.
R=herhut@google.com

Review URL: https://codereview.chromium.org//828083003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43034 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 11:58:03 +00:00
floitsch@google.com d98d38a5a8 dart2js: Remove obsolete comment and code.
R=sra@google.com

Review URL: https://codereview.chromium.org//855963002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43025 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 20:17:35 +00:00
floitsch@google.com 3f8c3b91b4 dart2js: Change mirror flag message.
R=sethladd@google.com

Review URL: https://codereview.chromium.org//859463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43024 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 20:16:42 +00:00
asgerf@google.com b29366b9e6 Handle super-method invocations in CPS->JS backend.
InvokeSuperMethod has been replaced by InvokeMethodDirectly. This
instruction works like InvokeMethod, except it has an explicit target
element that it always invokes, regardless of overriding.

The new instruction is easier to handle in the JS backend, it is more
amenable to inlining, and it should also be useful for calling
backend-specific methods, such as constructor bodies.

When targeting Dart, we translate it back to a 'super' at the end,
because the instruction is never used for any other purpose with
that backend.

R=karlklose@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org//861713002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43011 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 14:33:17 +00:00
herhut@google.com d7ccdf94a7 Fix computation of single type variables.
BUG=
TBR=karlklose@google.com

Review URL: https://codereview.chromium.org//859983002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43007 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 12:52:26 +00:00
herhut@google.com 814868cbc2 Do not use full substitution when only computing single type variables.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//861733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43006 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 12:01:26 +00:00
floitsch@google.com db97e89c86 dart2js: Rename functions with getter name.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//859833002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43003 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 10:33:55 +00:00
herhut@google.com 3f4e9e7918 Fix minified output for FunctionThatReturnsNull.
BUG=
TBR=sigurdm@google.com

Review URL: https://codereview.chromium.org//861723003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43002 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 10:17:18 +00:00
zarah@google.com b0e80e8374 dart2js: Only emit constructors of the native class interceptors that are used.
This change only affects CSP mode: when compiling in CSP mode we were emitting constructors and getters/setters of native classes that were potentially not needed.

R=floitsch@google.com

Committed: https://code.google.com/p/dart/source/detail?r=42944
Reverted: https://code.google.com/p/dart/source/detail?r=42950

Review URL: https://codereview.chromium.org//841993003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43001 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 09:45:26 +00:00
herhut@google.com f2a40e8c0a Use a shared function to represent type substitutions with dynamic.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//826413003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43000 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 09:42:02 +00:00
sigurdm@google.com ef57c8bdac Implement await and async for the js-ast.
Implementing a new expression 'await e' in the js mini-parser and printer.

Implementing async, async*, sync* function body modifiers.

Also implementing while, do, switch, case, labelled statement in the js mini parser.

This is in preparation for an await-desugaring transformation on the js ast.

BUG=
R=asgerf@google.com, floitsch@google.com

Review URL: https://codereview.chromium.org//858573002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42999 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 08:10:47 +00:00
floitsch@google.com 0b03d223bd dart2js: more uses of the model in the old emitter.
Some renamings.

R=ahe@google.com

Committed: https://code.google.com/p/dart/source/detail?r=42917
Reverted: https://code.google.com/p/dart/source/detail?r=42922

Committed: https://code.google.com/p/dart/source/detail?r=42934
Reverted: https://code.google.com/p/dart/source/detail?r=42939

Review URL: https://codereview.chromium.org//787233006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42995 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-19 15:07:33 +00:00
floitsch@google.com 72267dd453 dart2js: Don't reference mixins when they are only used for RTI.
BUG= http://dartbug.com/21896
R=sigurdm@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//858433005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42990 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-19 13:34:10 +00:00
floitsch@google.com a44d1c44e1 dart2js: capture type variables in closures, if they are only used in literals.
BUG= http://dartbug.com/22060
R=asgerf@google.com

Review URL: https://codereview.chromium.org//851303002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42989 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-19 13:32:00 +00:00
kmillikin@google.com 41897d3517 Reapply "Allow LetCont to bind multiple continuations."
This reapplies svn revision r42945 with bugfixes.  There was an
invalid assertion in the shrinking reduction pass and a stray left
parenthesis in one of the input IR expressions.

Some of the logic in the shrinking reduction pass has been cleaned up.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//827763003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42988 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-19 12:49:52 +00:00
herhut@google.com d953d8dbfe Compute new targets for dynamic call sites eagerly.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//858593003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42985 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-19 11:46:10 +00:00
asgerf@google.com 5e13a173b2 Dart2dart: Support for-loop variables captured in loop body.
Capture in initializer, condition, and update is still not supported.

IMO: we should postpone efforts toward full capture support in dart2dart
until benchmarks indicate that dart2dart actually benefits from the
translation through CPS (which is still an open question, yes?).

Such benchmarking should not be blocked by lack of completeness,
because real code probably never captures loop variables in the loop
header.

R=sigurdm@google.com

Review URL: https://codereview.chromium.org//846353002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42959 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 14:56:13 +00:00
floitsch@google.com 1bfba5354d dart2js: move NativeEmitter into js_emitter directory.
R=johnniwinther@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//848063003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42957 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 14:17:17 +00:00
floitsch@google.com 2daf605ba3 dart2js: use bool to track if an app has native classes.
No need to keep a list of native classes, if we only want to know if there are some.

R=zarah@google.com

Review URL: https://codereview.chromium.org//813563006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42956 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 14:16:21 +00:00
zarah@google.com 9d42a5bdf0 Revert "dart2js: Only emit constructors of the native class interceptors that are used."
This reverts commit r42944.

Review URL: https://codereview.chromium.org//857573002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42950 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 10:58:13 +00:00
sigurdm@google.com b0d465cfa0 Revert "Allow LetCont to bind multiple continuations."
This reverts commit r42945.

BUG=

Review URL: https://codereview.chromium.org//853083005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42948 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 10:09:01 +00:00
floitsch@google.com ca249bec57 dart2js: Remove (some) unused imports.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//818543003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42947 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 09:09:57 +00:00
floitsch@google.com c038db3cf5 dart2js: rename Elements.isErroneousElement to Elements.isErroneous.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//814833008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42946 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 08:58:43 +00:00
kmillikin@google.com 16d72e35e0 Allow LetCont to bind multiple continuations.
LetCont can now bind multiple continuations in the same scope.  As an
example, the 'then' and 'else' continuations of a branch are siblings
in the expression, and neither is in the scope of the other.  None of
the LetCont-bound continuations are in scope for any of the
continuation bodies.  Recursive continuations are still recursive
values, not recursive bindings, so there is no direct way to have
mutually recursive continuations.  This matches the JavaScript
semantics.

R=asgerf@google.com, sigurdm@google.com, karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//848363002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42945 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 08:55:20 +00:00
zarah@google.com 026d08fea2 dart2js: Only emit constructors of the native class interceptors that are used.
This change only affects CSP mode: when compiling in CSP mode we were emitting constructors and getters/setters of native classes that were potentially not needed.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//841993003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42944 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 08:52:43 +00:00
koda@google.com 016666613f Revert r42934.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//850343005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42939 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 22:45:26 +00:00
floitsch@google.com 20950adb02 dart2js: more uses of the model in the old emitter.
Some renamings.

R=ahe@google.com

Committed: https://code.google.com/p/dart/source/detail?r=42917
Reverted: https://code.google.com/p/dart/source/detail?r=42922

Review URL: https://codereview.chromium.org//787233006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42934 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 21:12:39 +00:00
floitsch@google.com d23f2ab1ca Revert "dart2js: more uses of the model in the old emitter."
This reverts commit r42917.

Review URL: https://codereview.chromium.org//852583003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42922 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 18:05:45 +00:00
floitsch@google.com 98a50ea6db dart2js: more uses of the model in the old emitter.
Some renamings.

R=ahe@google.com

Review URL: https://codereview.chromium.org//787233006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42917 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 16:28:30 +00:00
ahe@google.com 8319fbbfbf Add option --generate-code-with-compile-time-errors.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//854633004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42916 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 16:26:46 +00:00
ahe@google.com 6c25b15802 Error recovery broke host checked mode, fix it.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//852983002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42915 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 16:16:52 +00:00