Commit Graph

4698 Commits

Author SHA1 Message Date
floitsch@google.com 028b1d45b7 dart2js: create constants lazily in the new emitter.
R=zarah@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44326 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 16:37:01 +00:00
sra@google.com 721b99244e Remove more null receiver guards.
Sometimes when we inline methods with conditionals we have a graph
that looks like:

  t1.toString;
  if (true)  // Not actually included in output.
    t1.x = ...

This change recognizes that t1 will be 'tested' for null by t1.x, so
t1.toString can be removed.

This is the single-path version of a fix for http://dartbug.com/22577

R=floitsch@google.com, herhut@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44323 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 15:26:49 +00:00
herhut@google.com 5e5df130cc Ensure that collectedClasses always contains a [globalObject, descriptor] pair.
BUG=
R=zarah@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44322 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 15:14:45 +00:00
herhut@google.com d8bc647568 Do not update original descriptor when building new one.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44320 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 13:35:42 +00:00
herhut@google.com 10f0d0b5db Simplify index computation in reflectionDataParser.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44318 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 13:29:39 +00:00
herhut@google.com d5af6004be Force slow objects for select objects during startup.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44317 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 13:27:52 +00:00
herhut@google.com c1d7da2ffd Inline special case of inheritFrom to call site.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44316 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 13:21:55 +00:00
floitsch@google.com 1f8851987f dart2js: Allow multiple invocations of type.ensureResolved in new emitter.
R=zarah@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44315 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 10:45:18 +00:00
zarah@google.com 596bfa75c2 dart2js: split out types from metadata.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44292 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 14:23:03 +00:00
sigurdm@google.com 4bea71e030 Fix dart2js async error handling of finallies nested in finallies.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44287 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 12:48:33 +00:00
asgerf@google.com bc2b857a60 Integrity checker for CPS and Tree IR.
BUG=
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44285 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 11:27:42 +00:00
asgerf@google.com 4d178cd9c5 dart2dart: Bugfix in copy propagator and rename Assign.definition->value.
Do not copy propagate variable if:
- The variable is accessed from an inner function.
- We are inside a try block.
- The moving assignment is a declaration.

The last point could be fixed by making the new assignment a declaration
as well, but for now I focused on fixing bugs and not making improvements.

I suspect the copy propagator will disappear entirely after the new
register allocator lands, but these bugs are currently blocking the
integrity checker from landing, and I want to land that first.

BUG=
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44284 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 10:58:44 +00:00
karlklose@google.com 24eeb37c55 Implement type argument access and reification of runtime types.
R=asgerf@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44259 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 11:57:05 +00:00
johnniwinther@google.com b2a8c702b7 Put IR builder visitors in a different library than IrBuilder.
BUG=
R=asgerf@google.com, kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44258 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 11:32:22 +00:00
johnniwinther@google.com 48dd2273f3 Fix dart2dart new_backend
BUG=
R=asgerf@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44257 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 11:24:06 +00:00
karlklose@google.com 8519a8bc1b Replace use of runtime type with name of the node in the CPS IrTracer.
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44254 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 10:11:50 +00:00
johnniwinther@google.com 2182be0fc5 Support simple try in analyzer2dart.
BUG=
R=kmillikin@google.com, paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44253 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 09:13:36 +00:00
asgerf@google.com 637c5b33b2 Translate constructors without bad references.
This came up while working on integrity checks for the CPS IR.

- Empty constructors to should not create orphaned references.

- Initializers should not use the body's return continuation object, they should each have their own.

BUG=
R=sigurdm@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44238 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 14:42:48 +00:00
kmillikin@google.com 028d0b63c7 Streamline the CPS IR Visitor interface.
Previously, the visitor interface combined two things: (1) the
interface for visiting concrete IR instruction classes and (2) a
default implementation that called the visit function for the
superclass explicitly (but not through super).  For most classes that
extended Visitor this inherited implementation was used to throw an
exception if a visit method for a new class was forgotten.

Instead, it's better to make this class purely an interface which will
give a static warning when a visit method is forgotten.  This change
forces us to implement methods that previously had an inherited (not
necessary correct) implementation.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44235 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 14:31:59 +00:00
asgerf@google.com 2c2b61bddb Changed construction of 'for' loops so that bindings introduced in
enterLoopBody are in scope in the update part.

BUG=
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44233 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 13:49:18 +00:00
floitsch@google.com 497505f0dc Add "force inline" to internal annotations.
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44232 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 13:37:06 +00:00
asgerf@google.com 1f11691e88 Fix reference counting bugs in StatementRewriter.
BUG=
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44231 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 13:32:03 +00:00
floitsch@google.com dace64cbb7 dart2js: Allow to encode side-effects in the spec-string of JS and similar built-ins.
This patch prepares a shift towards two builtins. We currently have ~20 foreign functions that must be caught by the resolver, type-inferrer, builder, ...
In the future there will be only two:
JS(...), and JS_BUILTIN(...)

The JS_BUILTIN function would take a string or enum as second argument (after the spec-string) which would be shared between the runtime and the compiler.
This makes it easier to ensure that no builtin is forgotten in the places where they need to be handled.

This patch also gives more flexibility to the implementor.
For example `JS('bool', 'typeof self["foo"] != "undefined"')` would currently trigger a "depends on index store". With this patch the developer could override the automatic side-effect analysis and force the dependency to be empty.

Note: in theory we could make "JS" a BUILTIN itself, but, given its importance, I prefer to keep it separate.

Note2: with the "ForceInline" CL [0] we can keep the old functions (like "JS_GET_FLAG") and just forward to JS_BUILTIN:

@ForceInline()
bool JS_GET_FLAG(String name) {
  // Given: a shared enum `Builtin`.
  return JS_BUILTIN('bool', Builtin.getFlag, name);
}

[0] https://chromiumcodereview.appspot.com/962703004/

R=herhut@google.com, sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44229 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 13:20:00 +00:00
sigurdm@google.com 649796355b Copy the parameters to a sync* function for each invocation of .iterator
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44227 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 13:09:24 +00:00
het@google.com 239fc78cb4 Sets the native name of static native methods by using the @JSName with the @Native tag of the enclosing class.
BUG=22483
R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44201 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 21:51:12 +00:00
sigurdm@google.com d5614f5a76 Missing named parameter.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44171 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 14:23:30 +00:00
sigurdm@google.com ef983cd0ee Fix problems with default-cases in async code.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44170 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 14:20:17 +00:00
sigurdm@google.com e9e1a5ffff Fix of https://codereview.chromium.org//964553004 .
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44168 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 13:31:08 +00:00
sigurdm@google.com 6787beb0f6 Analyze locals in await for loops as inside a try-finally.
Otherwise they do not get the right boxing behavior.

BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44166 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 12:41:10 +00:00
zarah@google.com 0c6213e97e dart2js: don't emit unneeded native info.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44164 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 11:18:40 +00:00
sigurdm@google.com f82faf5bb7 Support for a dart2js dartDeferredLoader hook.
Also move deferred loading special casing of d8 and jsshell to
preambles.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44163 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 10:12:09 +00:00
sigurdm@google.com 4e5078f2e7 Move the dart_precompiled function inside scoping function.
Also make it a property of init.

This is also done for deferred hunks, allowing deferred loading to work
in CSP mode.

Long term I would like the precompiled function to go away, and move
the generated functions into the library-initializer when they are
 needed.

BUG=16898
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44162 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 09:31:29 +00:00
asgerf@google.com 63db65942b IR tracer for try statements.
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44161 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 09:23:10 +00:00
zarah@google.com 3f5640a31b dart2Js: bailout early when using the new emitter with mirrors.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44160 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 08:59:27 +00:00
floitsch@google.com a74cc4f5df Fix order of box and types for constructor-body invocations.
BUG= http://dartbug.com/22590
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44130 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 14:57:49 +00:00
johnniwinther@google.com 5a5cfc18a2 Typecheck return with respect to async.
BUG=http://dartbug.com/22552
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44128 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 13:04:43 +00:00
johnniwinther@google.com 143b5d31fc Pass SourceInformation through the CPS IR.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44126 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 11:44:37 +00:00
asgerf@google.com b28886229a Added VariableUse expression to tree IR.
Variable is no longer an Expression. It must be referenced through a
VariableUse.

This makes it possible to reference a specific occurrence of a variable
in the tree, which is useful for things like finding the first or last
occurrence of a variable.

BUG=
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44125 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 10:20:49 +00:00
asgerf@google.com 96b77b5be9 dart2js: Refactoring, documentation, and a few bugfixes in Namer class.
See long doc comment in namer.dart.

BUG=
R=floitsch@google.com

Committed: https://code.google.com/p/dart/source/detail?r=43588

Reverted: https://code.google.com/p/dart/source/detail?r=43590
(to avoid rebase conflicts for people pushing to trunk)

Committed: https://code.google.com/p/dart/source/detail?r=43724

Reverted: https://code.google.com/p/dart/source/detail?r=43739
(red bots)

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44092 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 14:20:49 +00:00
sigurdm@google.com 0f41a29315 Let CSP-mode-flag be available as a foreign_helper constant.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44091 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 13:05:04 +00:00
floitsch@google.com 0974ab5b7e dart2js: simplify constant expression generation.
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44089 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 12:34:58 +00:00
floitsch@google.com 098de0210f dart2js: Don't emit nsm handlers if nobody needs them in the new emitter.
R=herhut@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44088 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 12:33:43 +00:00
sigurdm@google.com fa4dcd2b82 Refactor rewrite_async
Split AsyncRewriter into a base class and threee subclasses.

Avoid using -name variables everywhere.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44085 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 09:55:15 +00:00
kmillikin@google.com 1bfb7768ed dart2dart: Implementation of simple try/catch.
A LetHandler form is introduced to the CPS IR.  It binds an exception
handler continuation which is in scope for its body.  LetHandler is
translated to try/catch when translating back to direct style.

Optimizations in the CPS and Tree languages that move code have to be
careful when moving code into or out of the scope of an exception
handler.  This change prohibits such code motion, though it might be
sometimes provably safe.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44047 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 13:24:58 +00:00
rmacnak@google.com 8b6a6a1e4f Add ClassMirror.isEnum.
BUG=http://dartbug.com/21718
R=asiva@google.com, gbracha@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44035 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 01:13:50 +00:00
karlklose@google.com 45322c5765 Reapply "Use an enum in embedded_names as input to JS_GET_NAME."
Original CL: https://codereview.chromium.org/929313002/
Reverted in: https://code.google.com/p/dart/source/detail?r=43943

R=herhut@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44020 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 10:34:07 +00:00
sra@google.com 07f1d4dacc Extends shortened representation of numbers to negative numbers.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44015 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 03:06:36 +00:00
sra@google.com fe756ad5cd Move js_ast library to its own package under pkg
IT IS NECESSARY TO REBUILD AFTER SYNCING TO THIS CL.
Rebuilding creates a needed symlink in out/... for the new js_ast package.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44012 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 01:27:01 +00:00
sra@google.com 4930144c17 Delete IterableMixinWorkaround
Most code in IterableMixinWorkaround was unused.  The remaining O(20)
methods have been moved to their only use on JSArray.

I looked into using ListMixin on JSArray.  The code was clearly worse
- nearly 1% bloat on swarm and some less precise inference.  I think
it is reasonable to have the JSArray methods special-cased for
performance reasons.

R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44006 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:57:28 +00:00
sigurdm@google.com 8dccbae46f Use more js templates in async rewrite.
Also switch some js '==' to '==='.

BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43986 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 13:30:08 +00:00