Commit Graph

4698 Commits

Author SHA1 Message Date
Sigmund Cherem 4bec345309 Fix redness in bot
TBR=het@google.com

Review URL: https://codereview.chromium.org/2267193002 .
2016-08-22 16:47:28 -07:00
Sigmund Cherem 57f26aeb60 Add skeleton of SSAKernel function compiler
R=het@google.com

Review URL: https://codereview.chromium.org/2269783002 .
2016-08-22 16:30:41 -07:00
Harry Terkelsen b86be4ea68 Copy Rasta visitor to dart2js.
This code is unused now, but will be used to create the SSA graph
from Kernel IR.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2265383002 .
2016-08-22 15:31:48 -07:00
Sigmund Cherem 69c28ae15b Add flag to dart2js to configure whether to use the kernel lowering.
R=het@google.com

Review URL: https://codereview.chromium.org/2270473002 .
2016-08-22 15:30:11 -07:00
Sigmund Cherem b16d5ca237 Introduce "CommonElements"
Moves common elements that the compiler refers to into a standalone class "CommonElements". Along the way I:

  - made computation of these elements lazy: it's only done when needed. This meant also changing some checks of the form `x == someCommonElement` into `isSomeCommonElement(x)` so that we don't forcefully resolve elements if we haven't seen them.

  - I tried also to remove elements that were only used to know whether something happened. Instead we model that directly with a boolean.

Next steps after this:
 - move CommonElements under common/elements.dart
 - merge CoreClasses + CommonElements
 - introduce TargetElements: elements that the backend refers to that we need to know about during resolution/analysis. I expect most of it to be already in BackendHelpers.
 - get rid of onLibraryScanned/onLibrariesLoaded

R=het@google.com

Review URL: https://codereview.chromium.org/2265473004 .
2016-08-22 14:53:26 -07:00
Stephen Adams 4eecf5dfa0 Don't add empty typeinfo lists
A 'classNeedsRti' sometimes when it has no type arguments,
e.g. CodeUnits needs the substitutions to act as Iterable<int>.

It also happens for all classes when .runtimeType is used :-(

BUG=

Review URL: https://codereview.chromium.org/2260993002 .
2016-08-19 18:14:16 -07:00
Stephen Adams eabed882f6 Remove use of JS templates in reified type information
1. Use SSA instructions in place missed in last CL.
2. Remove use of JS templates now that representation is generated during JS codegen.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2260353002 .
2016-08-19 15:30:25 -07:00
Stephen Adams 266ac1b0bc Add SSA instructions for reified type information
This enables GVN optimizations of type representations, e.g.

        var touches, targetTouches, changedTouches, mockTouchList, t1;
        touches = H.setRuntimeTypeInfo([], [W.Touch]);
        targetTouches = H.setRuntimeTypeInfo([], [W.Touch]);
        changedTouches = H.setRuntimeTypeInfo([], [W.Touch]);
        mockTouchList = H.setRuntimeTypeInfo([new S.MockTouch(e)], [W.Touch]);
--->
        var t1, touches, targetTouches, changedTouches, mockTouchList;
        t1 = [W.Touch];
        touches = H.setRuntimeTypeInfo([], t1);
        targetTouches = H.setRuntimeTypeInfo([], t1);
        changedTouches = H.setRuntimeTypeInfo([], t1);
        mockTouchList = H.setRuntimeTypeInfo([new S.MockTouch(e)], t1);

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2260223002 .
2016-08-19 13:02:18 -07:00
Johnni Winther 291af2ee6f Ensure resolution of metadata on parts for serialization.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2256223002 .
2016-08-19 11:02:31 +02:00
Johnni Winther ad0c5a89d1 Support serialization of ambiguous elements.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2255163002 .
2016-08-19 10:54:41 +02:00
Johnni Winther da12e06953 Ensure metadata on imports/exports is resolved for serialization.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2256203002 .
2016-08-19 10:44:20 +02:00
Johnni Winther 8e454ea371 Ascribe erroneous constructors to the resolved element.
Erroneous constructor for missing constructor where given the declaring class as enclosing element. Deserialization would fail because the erroneous element could not be found on the class.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2258793002 .
2016-08-19 10:05:29 +02:00
Johnni Winther d4d5a48c10 Type check field initializers in the correct context.
Closes #27104

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2250433007 .
2016-08-19 09:58:51 +02:00
Harry Terkelsen b7a0a42bf6 Add --bazel-paths option to dart2js entrypoint.
This allows us to resolve files by looking them up in multiple bazel roots,
which allows us to avoid creating a massive symlink farm.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2253153002 .
2016-08-17 11:00:33 -07:00
Sigmund Cherem 46aa3cceb4 Delete dead code (this was used for source-mirrors, which are now gone).
R=johnniwinther@google.com, sra@google.com

Review URL: https://codereview.chromium.org/2248063003 .
2016-08-17 07:31:01 -07:00
Johnni Winther 3266e73128 Support encoding of NaN, infinity and negative infinity.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2250643002 .
2016-08-17 10:17:38 +02:00
Johnni Winther 502b6d55ff Remove AST-hack for multi-field declarations.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2244333003 .
2016-08-17 10:05:13 +02:00
Sigmund Cherem 4a7ae6f340 Move definition of Feature next to definitions of WorldImpact and Use
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2250193002 .
2016-08-16 12:44:11 -07:00
Johnni Winther 1a633236ea Ensure that no scripts are resolved when compiling purely from deserialized data.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2239933003 .
2016-08-16 10:04:08 +02:00
Johnni Winther f1d61727e3 Deserialize ResolvedAsts and ResolutionImpacts only when needed for compilation.
The only real change needed for this was to use [ConstantConstructor]
for deserialized constant constructors (instead of their ASTs)

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2240823002 .
2016-08-16 09:54:44 +02:00
Sigmund Cherem a47c9167cd Delete CPS IR.
We can always revert this CL if we want to bring it back later on.

R=sra@google.com

Review URL: https://codereview.chromium.org/2246623002 .
2016-08-12 14:40:50 -07:00
Stephen Adams b5efb1c0c1 Don't use library tag for private name prefixes
Use only the Uri.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2245533002 .
2016-08-12 10:20:58 -07:00
Stephen Adams b7aa65528c Rerun formatter
TBR=het@google.com

Review URL: https://codereview.chromium.org/2239193002 .
2016-08-11 19:05:59 -07:00
Johnni Winther b6a6b19a1e Ensure correct current element for field initializers.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2230853002 .
2016-08-11 13:19:36 +02:00
Stephen Adams b6f84a01d6 dart2js: Sort libraries by Uri only.
Avoid using the 'library' tag.

Remove compareTo method from CompilationUnitElement and LibraryElement.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2221273002 .
2016-08-10 17:09:27 -07:00
Sigmund Cherem e71fa2b05c Improve error reporting: use colors and associate the appropiate file with
bazel-root uris.

The latter makes it possible to show errors that highlight the original source
code.

BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2237543002 .
2016-08-10 14:41:08 -07:00
Sigmund Cherem 9968b369b9 simplify the bazel-provider to use a search path appraoch
R=het@google.com

Review URL: https://codereview.chromium.org/2228913004 .
2016-08-10 09:57:45 -07:00
Johnni Winther 5af09978e7 Fix Resolution.getResolvedAst for serialization in production mode
- and split analysis_test into 4 subtests.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2220333007 .
2016-08-10 10:30:05 +02:00
Kevin Moore 3c2fcdd3c3 pkg/compiler: clean up imports
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2223133003 .
2016-08-08 19:28:01 -07:00
Sigmund Cherem b995d06a12 dart2js: fix bot failures - I made this private without realizing it was accessed for testing
TBR=het@google.com

Review URL: https://codereview.chromium.org/2226173002 .
2016-08-08 18:19:35 -07:00
Sigmund Cherem eac954b3dc Introduce a bazel provider
R=het@google.com

Review URL: https://codereview.chromium.org/2204593010 .
2016-08-08 16:57:19 -07:00
Kevin Moore 406d5e0c48 pkg/compiler: fix imports
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2221893003 .
2016-08-08 14:41:50 -07:00
Stephen Adams 101a83f2f4 dart2js: Reduce overhead of --verbose measurements
ZoneSpecification and zoneValues are now per-task, rather than per measurement.
This reduces total LinkedHashMap allocations by 30%

In the large compile I am using to measure these things, there are still
~3M zones created via Zone.fork and 10M _ZoneFunction objects allocated, and the Zone.fork copies the (now cached) LinkedHashMap.
So cross-task measurements are still quite expensive.

R=ahe@google.com
BUG=

Review URL: https://codereview.chromium.org/2133913002 .
2016-08-08 14:18:21 -07:00
Sigmund Cherem be28b088d6 Split js_backend into multiple libraries.
R=sra@google.com

Review URL: https://codereview.chromium.org/2220993005 .
2016-08-08 13:33:06 -07:00
Sigmund Cherem 53d968bd02 delete send-info measurements. This experiment is not being maintained
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2214263002 .
2016-08-08 09:27:46 -07:00
Johnni Winther e6241bc12d Include constants in deferred computation.
This ensures that in-code constants are included in the deferred computation.

Currently the set of live constants is not computed in itself, so the constants
used in the computation are not the same - and they are generally larger than needed.

R=het@google.com

Review URL: https://codereview.chromium.org/2194173002 .
2016-08-08 14:39:58 +02:00
Johnni Winther b036a29cbf Add kind to ConstantValue.
In preparation for testing deferred constants.

R=het@google.com

Review URL: https://codereview.chromium.org/2199593003 .
2016-08-08 14:30:16 +02:00
Stephen Adams 36f52dd43f Avoid modifying the set returned by getInterceptorsOn()
The returned set is shared.

This program generates a broken short-circuit interceptor ($n -> $din) due to modifying the cached shared set {n} to {d,i,n}
--------
J.toInt$0$n = function(receiver) {
  return J.getInterceptor$din(receiver).toInt$0(receiver);
};
--------
import 'package:expect/expect.dart';

@NoInline()
@AssumeDynamic()
confuse(x) => x;

@NoInline()
foo(x) {
  print(x.toInt());
  bar(x);
}

@NoInline()
bar(x) {
  print(x.toInt());
  print(x.runtimeType);
}

main() {
  int i = confuse(1);
  foo(i);
  double d = confuse(2.3);
  foo(d);
}
--------

TBR=sigmund@google.com

Review URL: https://codereview.chromium.org/2215133003 .
2016-08-05 16:13:03 -07:00
Sigmund Cherem 0eee4027a6 Delete dart_backend from compiler.
R=sra@google.com

Review URL: https://codereview.chromium.org/2213673002 .
2016-08-04 15:57:04 -07:00
Sigmund Cherem 9aee504527 Remove unnecessary imports to tree.dart
R=het@google.com

Review URL: https://codereview.chromium.org/2203013003 .
2016-08-03 08:27:50 -07:00
Stephen Adams 478106bce2 dart2js inferrer: don't infer widened type when unreachable
'&' and '|' were missing the case to return 'empty' if the argument was empty, causing the widened (default) type to be propagated.

There are a few bitwise operations in the streams code that have better code from being slightly more precise.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1583623002 .
2016-07-27 17:25:56 -07:00
Jacob Richman 8e787a74b0 Fix case caught by test where getUnescapedJSInteropName wasn't called.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/2187893003 .
2016-07-27 13:53:53 -07:00
Stephen Adams 9d5fd9d5bd Avoid using call-through stub on calls to fields.
This usually removes the demand for the call-through stub and sometimes enables optimizations on the field load, e.g.:

    WhereIterator: {
      "^": "Iterator;_iterator,_f",
      moveNext$0: function() {
        for (var t1 = this._iterator; t1.moveNext$0();)
          if (this._f$1(t1.get$current()) === true)
            return true;
        return false;
      },
      _f$1: function(arg0) {
        return this._f.call$1(arg0);
      }
      ...
-->
    WhereIterator: {
      "^": "Iterator;_iterator,_f",
      moveNext$0: function() {
        var t1, t2;
        for (t1 = this._iterator, t2 = this._f; t1.moveNext$0();)
          if (t2.call$1(t1.get$current()) === true)
            return true;
        return false;
      },
      ...

BUG= https://github.com/dart-lang/sdk/issues/22197
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2180363002 .
2016-07-26 18:02:05 -07:00
Stephen Adams 94df5a0c24 dart2js: Avoid empty else clauses in generators.
R=sigurdm@google.com

Committed: https://github.com/dart-lang/sdk/commit/a02c5798a4b9c682cfe5fddbf48f053c9c677b68

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

Reverted: https://github.com/dart-lang/sdk/commit/803826256d0be2c3560705c084d20ed78d1fca74
2016-07-26 09:58:34 -07:00
Stephen Adams 803826256d Revert "dart2js: Avoid empty else clauses in generators."
BUG=

Review URL: https://codereview.chromium.org/2177403003 .
2016-07-25 18:53:32 -07:00
Stephen Adams a02c5798a4 dart2js: Avoid empty else clauses in generators.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1916863002 .
2016-07-25 18:43:16 -07:00
Jacob Richman 96ca5db7e5 Add JSNative utility class with static methods methods to efficiently manipulate typed JSInterop objects in cases where the member name is not known statically. These methods would be extension methods on JSObject if Dart supported extension methods. Update package js to export these methods. Implement in Dart2JS. Implement JS$ in dart2js.
BUG=
R=alanknight@google.com, sra@google.com

Review URL: https://codereview.chromium.org/2150313003 .
2016-07-25 09:59:01 -07:00
Stephen Adams 5923966da3 Feature-detect browser for assignment to __proto__.
Assigning to __proto__ is a fast way to stitch together a number of
object literals into a prototype chain without copying all the
properties.

Unfortunately this leads to very slow execution on Firefox (and
jsshell).  So now we feature-detect Chrome (and d8) since that is the
only browser we know currently can use the 'fast' startup path without
penalizing subsequent performance.

This speeds up some jsshell benchmarks by 30%.

R=het@google.com

Review URL: https://codereview.chromium.org/2180533002 .
2016-07-23 11:42:24 -07:00
Harry Terkelsen 8b1a84c0e0 remove unused message
R=jacobr@google.com

Review URL: https://codereview.chromium.org/2173473002 .
2016-07-21 12:46:15 -07:00
Jacob Richman bbb0c3f727 Seems like this is all that is required to support callable JS objects. dartbug.com/25321
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/2164483004 .
2016-07-20 13:16:37 -07:00