Commit Graph

2071 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen 4ee6246556 Add split function to LineSplitter class in dart:convert.
The split function returns a lazy iterable of the lines, unlike the convert
function which returns a list.
This makes the function usable on large strings where not all of the lines
are needed.

Closes https://github.com/dart-lang/sdk/issues/23837

R=kevmoo@google.com

Review URL: https://codereview.chromium.org//1240623002 .
2015-07-15 12:26:24 +02:00
Karl Klose 04dacd24f4 Remove functions white-listed for use of try-finally and switch, add JS_SET_CURRENT_ISOLATE.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1237573002 .
2015-07-14 10:26:38 +02:00
Karl Klose 3fe9309c96 dart2js cps: Implement compilation of redirecting factory constructors for reflection.
Without reflection, redirecting factory constructor invocations are shortcut at the instantiation site.  With reflection, code like
  reflectClass(Foo).newInstance(const Symbol(''), [])
can hit a redirecting factory constructor and we need to emit a function that does the redirection and type substitution.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1227873004 .
2015-07-09 14:54:23 +02:00
Stephan Herhut 0799e538c3 dart2js: Emit static const fields if accessible by reflections.
BUG= http://dartbug.com/23811
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1225083004.
2015-07-09 13:28:23 +02:00
Karl Klose 71e2bec0a5 dart2js cps: Support JS_CURRENT_ISOLATE.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1222913003 .
2015-07-07 15:55:13 +02:00
Lasse R.H. Nielsen 03f92623b2 Revert usage of delegating generative constructor, still not supported by VM.
Also update test expectation for d8/jsshell now that test doesn't use non-zero timer any more.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1221033008.
2015-07-03 14:53:29 +02:00
Asger Feldthaus dbd197acdd dart2js cps: Fuse tear-off and call invocation.
For example:
  new Foo().bar.call(123)
    ==>
  new Foo().bar(123)

This does not trigger much right now, but it will matter when forEach
is rewritten to a loop in a later CL.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1220193003.
2015-07-03 14:44:47 +02:00
Asger Feldthaus 61f47e7384 dart2js cps: Ensure JSArray is emitted when we see a type cast.
This is a workaround to resolve an issue that is affecting a lot
of tests.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1214123003.
2015-07-03 14:32:01 +02:00
Lasse R.H. Nielsen f529055c1b Update documentation of StreamIterator, improve tests.
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1216123004.
2015-07-03 13:23:39 +02:00
Asger Feldthaus 34302b1320 dart2js cps: Translate synthesized mixin constructors.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1216593002.
2015-06-29 15:28:40 +02:00
Asger Feldthaus ec55d46148 dart2js cps: Fix translation of local constants.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1211393003.
2015-06-29 14:32:49 +02:00
William Hesse 57765a8929 Ensure correct line endings for method_mirror_source tests.
R=whesse@google.com
BUG=

Review URL: https://codereview.chromium.org//1218813002.
2015-06-29 13:43:57 +02:00
Stephan Herhut 225be75498 Fix some tests and exclude others from CRLF rewriting.
R=whesse@google.com
BUG=

Review URL: https://codereview.chromium.org//1212823002.
2015-06-26 14:40:01 +02:00
Asger Feldthaus cf920ec66c dart2js cps: Fix codegen for foreign statements.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1203353003.
2015-06-25 16:07:56 +02:00
Asger Feldthaus fceb7f00dc dart2js cps: Handle checks against mutable and extendable lists.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1206873003.
2015-06-25 15:03:00 +02:00
Kevin Millikin 089ed2965b Implement try/finally by inlining the finally code.
Try/finally is implemented by inlining.  There is a try/catch to catch
exceptions in the try block.  The catch body contains the finally code
followed by a rethrow.  The code for finally is translated again after the
normal exit of the try block.  Break, continue, and return exits in the try
block have the finally code inlined just before the exit is taken.

Try/catch/finally is not yet supported, it requires some changes to the
assigned variables analysis.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1201983002.
2015-06-24 10:12:42 +02:00
Kevin Millikin bf595224d5 Implement simple switch statements as nested if/else.
Simple switch statements that do not have continue to labeled cases
are compiled into a chain if/else comparisons.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1191193005.
2015-06-22 11:29:31 +02:00
Karl Klose 3f46181244 cps-ir: Support foreign code.
R=kmillikin@google.com

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

Reverted: https://github.com/dart-lang/sdk/commit/40ed0daaaf71904d2da271e66ba8381ef857116d

Review URL: https://codereview.chromium.org//1185633003.
2015-06-19 13:44:58 +02:00
Karl Klose 40ed0daaaf Revert "cps-ir: Support foreign code."
This reverts commit a120ee7c90.

TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1196443002.
2015-06-18 13:37:52 +02:00
Karl Klose a120ee7c90 cps-ir: Support foreign code.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1185633003.
2015-06-18 13:09:50 +02:00
Asger Feldthaus fb38d61dba dart2js cps: Support function types in 'is' and 'as' operators.
The generated code uses different helpers than the SSA. In SSA, there are calls to buildFunctionType and _isTest. The CPS uses checkSubtypeOfRuntimeType, the "one size fits all" method we also use to test against type variable types.

When the function type has no type variables in it we could hoist the function type into a constant, but the constant system does not support type representation constants at the moment. But it seems like an optimization we may want to add later.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1180973003.
2015-06-18 11:30:57 +02:00
Karl Klose a842f6dff2 Update dart2js-cps_ir test expectations.
TBR=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1188183006.
2015-06-17 09:41:50 +02:00
Ryan Macnak 98b9ff6a30 Fix reflective NoSuchMethodErrors to match their non-reflective counterparts when due to argument mismatches.
BUG=http://dartbug.com/23266
R=asiva@google.com

Review URL: https://codereview.chromium.org//1182613004.
2015-06-16 09:42:11 -07:00
Karl Klose 7f8fe44067 Update dart2js-cps_ir test expectations.
TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1181063004.
2015-06-16 15:47:35 +02:00
Karl Klose 551fa1fdaa Do not mark type variables as needing a box inside try; they are immutable.
Closes #23650

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1188103002.
2015-06-16 14:13:01 +02:00
Lasse R.H. Nielsen 80960767e9 Fix timing issue in stream_empty_test, and make analyzer expect it to pass.
Review URL: https://codereview.chromium.org//1188613008.
2015-06-16 13:33:53 +02:00
Lasse R.H. Nielsen fbedc2b86f Also iprove Future.value(null) and documentation of some Stream related classes.
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1177343004.
2015-06-16 11:38:07 +02:00
Karl Klose bb45376735 Update dart2js-cps_ir status files.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1191433002.
2015-06-15 12:50:58 +02:00
Stephen Adams f7263216e4 Better messages for optimized index errors.
Typed list, Array and String indexer methods detect index errors in their own optimized way but now defer to common code to diagnose the error.  This code is shared with the optimized 'ioore' helper, which makes the error message consistent between optimized and unoptimized code.

The main reason for doing this is to ensure that the error messages have as much information as possible to help debug off-line using captured error messages.

BUG=
R=lrn@google.com

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

Reverted: https://github.com/dart-lang/sdk/commit/82215d36f4f6163082d802508331e8b49b711b77

Review URL: https://codereview.chromium.org//1180713003.
2015-06-12 18:21:47 -07:00
Stephen Adams 82215d36f4 Revert "Better messages for optimized index errors."
TBR=lrn@google.com

Review URL: https://codereview.chromium.org//1187553005.
2015-06-12 16:53:19 -07:00
Stephen Adams 0d4361fb6d Better messages for optimized index errors.
Typed list, Array and String indexer methods detect index errors in their own optimized way but now defer to common code to diagnose the error.  This code is shared with the optimized 'ioore' helper, which makes the error message consistent between optimized and unoptimized code.

The main reason for doing this is to ensure that the error messages have as much information as possible to help debug off-line using captured error messages.

BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//1180713003.
2015-06-12 15:33:58 -07:00
Karl Klose e4b56654ff Update dart2js-cps_ir test expectations with better annotations.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1181613003.
2015-06-11 10:56:56 +02:00
Karl Klose 6cffe227fe Update dart2js-cps_ir test expectations after bac7481d3d.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1171773004.
2015-06-09 15:12:18 +02:00
Asger Feldthaus d01d394af7 dart2js cps: Type casts and related changes to type propagation.
We now optimize type casts that always fail or always pass.
Type propagation has been refactored a bit to make this work.

A new IR node Unreachable has been added. This is an node that is known
to be unreachable and is ultimately compiled to an empty statement.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1153603006
2015-06-08 17:02:47 +02:00
Ryan Macnak 6545e8539e Fix isAssignableTo in VM mirrors to use subtype (<:) rather than moreSpecificThan (<<).
BUG=http://dartbug.com/22852
R=gbracha@google.com

Review URL: https://codereview.chromium.org//1156583005
2015-06-04 12:25:59 -07:00
Karl Klose 95a46fb177 Adjust cps_ir test expectations.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1167673009
2015-06-02 11:26:26 +02:00
Karl Klose 993338408e cps_ir: Handle malformed type arguments and type checks.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1156373008
2015-05-29 09:53:35 +02:00
Asger Feldthaus c29b7c6461 dart2js cps: 'is'-check directly against type variables.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1160763002
2015-05-28 12:30:00 +02:00
William Hesse 49a94a6938 Update status for failing tests on MIPS hardware.
BUG=dartbug.com/23536, dartbug.com/22626
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1153243002
2015-05-27 16:33:57 +02:00
Asger Feldthaus f1bbc3bb2d dart2js cps: 'is' checks on types with type arguments.
R=karlklose@google.com

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

Reverted: https://github.com/dart-lang/sdk/commit/f0c4e31174996e6259fab283af14c49aa8faf28c

Review URL: https://codereview.chromium.org//1161683002
2015-05-27 14:14:07 +02:00
Asger Feldthaus f0c4e31174 Revert "dart2js cps: 'is' checks on types with type arguments."
This reverts commit 00c33fb134.

TBR=karlklose@google.com

BUG=

Review URL: https://codereview.chromium.org//1161793002
2015-05-27 13:54:07 +02:00
Asger Feldthaus 00c33fb134 dart2js cps: 'is' checks on types with type arguments.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1161683002
2015-05-27 13:45:39 +02:00
Lasse R.H. Nielsen 25a16a39b3 In JsonEncoder, test if map has only string keys, and use toEncodable if not.
Currently the encoder assumes that a map will have string keys, and will fail
in ugly ways if it doesn't. With this change, the toEncodable function used on
other un-encodable values is also used on non-String-keyed maps.

BUG= http://dartbug.com/23469
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1153893004
2015-05-27 10:49:21 +02:00
Asger Feldthaus f42a0ef25c dart2js cps: Always use interceptors and type tags for 'is' checks.
"x is Foo" will become getInterceptor(x).$isFoo

Testing against a type with type arguments is still a giveup().

This test always works, but is not very fast. For instance, testing
against an int should be "typeof x === 'number' && Math.floor(x) === x".

Following an offline discussion with Karl, the plan is to rewrite
'is'-checks to more fine-grained tests in a CPS optimization pass,
probably the type propagator.

Concretely, we plan to introduce IR nodes like TypeOfTest, FloorTest,
InstanceofTest, etc, which optimization phases can introduce under the
right circumstances. That way, the code generation phase remains simple.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1144163004
2015-05-26 17:50:48 +02:00
Karl Klose 36d3e0d0e6 Update cps-ir test expectations.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1152133003
2015-05-22 09:58:58 +02:00
Ryan Macnak daf6fb6091 Ensure libraries always have at least one top-level class and therefore at least one script.
BUG=http://dartbug.com/23483
R=hausner@google.com

Review URL: https://codereview.chromium.org//1131793012
2015-05-19 08:58:23 -07:00
Asger Feldthaus ccee558a5b dart2js cps: Access to lazily initialized fields.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1136843006
2015-05-19 10:05:09 +02:00
Rico Wind f247caaab2 Readd analyzer suppression for profiler/metrics_{test,num_test}, the files are still there
TBR=johnmccutchan@google.com
BUG=

Review URL: https://codereview.chromium.org//1142913002
2015-05-19 09:58:08 +02:00
Ryan Macnak 97c4f89e69 Temporarily suppress mirrors_reader_test crash.
BUG=http://dartbug.com/23483

Review URL: https://codereview.chromium.org//1136633003
2015-05-18 14:03:33 -07:00
John McCutchan 6e42aec4f6 Deprecate 'dart:profiler' and move functionality to 'dart:developer'
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1133713006
2015-05-18 11:31:20 -07:00