Commit Graph

699 Commits

Author SHA1 Message Date
Leaf Petersen 4f7fa8a930 Check for null when getting the extension type.
isJsInterop can call this with null.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2983523002 .
2017-07-13 16:48:25 -07:00
Leaf Petersen 4a87156b13 Move NullError into interceptors
Put the NullError class into interceptors so that it will be picked
up as a native type.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2976173002 .
2017-07-13 14:38:39 -07:00
Vijay Menon d952055a7e Support ClassMirror.newInstance on factory constructors
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2976133002 .
2017-07-13 13:07:37 -07:00
Natalie Weizenbaum 5a74d8ab09 Properly handle Windows file: URLs on Node.js (#30098)
This adds logic to the JS implementation of URI to determine whether
the code is running on Windows under Node.js.
2017-07-12 14:57:01 -07:00
Vijay Menon 5b742853c7 Treat JS TypeError as Dart NSM
Fixes #30134

R=jacobr@google.com

Review-Url: https://codereview.chromium.org/2979613002 .
2017-07-11 05:44:22 -07:00
Jennifer Messerly 5533a256cb fix #30030, fix #27327 - fix tearoffs and various Object member bugs
this includes various cleanups found along the way:
* various issues with JS annotations, see #30043
* getGenericClass is now optimized when used in a JS builtin with a Type literal
* typed list literals should be slightly faster to create
* memoized getters used by dart:_runtime should be faster
* registerExtension should be a tad faster, and now understands JSArray
* dart.bind "safeName" hack gone in codegenerator
* JSArray<E>.runtimeType returns List<E>
* JSArray<E>.noSuchMethod works
* cleans up code that generates `setExtensionBaseClass` (used only by JSArray)
* _throwUnsafe helper for generating a `throw` in --unsafe compile mode
* fix tearoff of JS interop types (_emitSimpleIdentifier)
* fix TODO about splitting LazyJSType and AnonymousJSType
* fix is/as/cast methods on TypeRep and related classes
* fix codegenerator to not tearoff "hashCode" and "runtimeType" (they are not methods)
* fix NoSuchMethodError.toString()   (update via dart2js sdk impl)

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2962263002 .
2017-07-05 14:17:53 -07:00
Bob Nystrom 52a9e3d9c6 Fix build_pkgs.dart to not mutate arguments list. (#30078)
* Fix build_pkgs.dart to not mutate arguments list.

Also remove build of when package since it's apparently gone now.

* Use sublist to remove element.
2017-07-05 12:20:58 -07:00
Leaf Petersen 6f73694bb7 Generate better code for '==', core.identical, and dart.test.
Avoid falling back to the dart.equal runtime helper where possible based on static types.  Also uses JS `==` or `===` in some cases.

Treat core.identical as a compiler intrinsic, based on type.

Make dart.test assume correct types, use dart.dtest for combined cast and nullability check only when required.

Fixes https://github.com/dart-lang/sdk/issues/29851
Fixes https://github.com/dart-lang/sdk/issues/29772
BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2926613003 .
2017-06-30 15:04:29 -07:00
Bob Nystrom 24743461c9 Fix test.sh to not run non-existent shell script.
R=leafp@google.com

Review-Url: https://codereview.chromium.org/2964123002 .
2017-06-29 17:25:17 -07:00
Leaf Petersen 24f9478550 Fix handling of inline JS types in DDC.
DDC was incorrectly interpreting inline JS types, and hence marking
some things as non-nullable which were nullable.  This fixes that, and
also slightly improves the analyzers treatment of inline JS types.
Also fixes some incorrect inline JS type annotations in DDC patch
files.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2965633002 .
2017-06-29 16:02:04 -07:00
Bob Nystrom 0b2c9b048d Dynamically load packages for dartdevc tests in test.dart.
This involves a few pieces:

- Add support to DDC for specifying the module name associated with a
  given summary. This lets test.dart invoke DDC using summaries in the
  build directory outside of the directory containing the test itself.

- Add support to the build scripts for building the packages. This adds
  a new GN target that builds everything needed to run test.dart with
  dartdevc. In particular, it invokes build_pkgs.dart to compile the
  relevant packages to JS+summary so that the tests can use them.

  This requires some changes to build_pkgs.dart so it can output to a
  given directory.

- In test.dart, when tests are compiled with dartdevc, pass in the
  summaries for the packages so they don't get compiled in. Then, when
  the test is run, configure require.js with the right paths to their
  JS files so they can be loaded.

  I also removed a bunch of unneeded buildDir parameters being passed
  around the various CompilerConfiguration class methods now that they
  have direct access to the configuration.

Fix #29923.

R=vsm@google.com, whesse@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2955513002 .
2017-06-29 13:45:57 -07:00
Vijay Menon fd6164cce4 Handle toString on DOM types
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2952363003 .
2017-06-27 09:22:25 -07:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Vijay Menon 7d73159017 Fix ddc build
Not sure why this just started breaking.  I don't think Ben added this
param - just a use of it.  Our patch script might not be catching the
mismatch.

TBR=jmesserly@google.com,bkonyi@google.com

Review-Url: https://codereview.chromium.org/2954513003 .
2017-06-22 14:27:22 -07:00
Vijay Menon ecca1e1c2a Add FallThroughError patch
TBR=jensj@google.com,rnystrom@google.com

Review-Url: https://codereview.chromium.org/2953693002 .
2017-06-21 16:33:31 -07:00
Jennifer Messerly 070f31a899 optimize null safe ops by using DDC's let abstraction
We were already using it for most other things (increment ops, op assign, ??, cascades, etc)

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2944413002 .
2017-06-20 10:31:30 -07:00
Jennifer Messerly 1f50f0d126 fix mixins with factory constructors
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2935933005 .
2017-06-13 15:58:50 -07:00
Alan Knight 9e3fdbf94d Update DDC core patch for ConstantExpressionError
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2941593002 .
2017-06-13 13:57:42 -07:00
Jennifer Messerly 71c7914061 fix checking of dsend generic type bounds
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2935553002 .
2017-06-12 16:17:39 -07:00
Jennifer Messerly cb038cda2f fix test runner to understand mutlitests that expect an error
R=rnystrom@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2930203002 .
2017-06-12 16:07:17 -07:00
Jennifer Messerly e79fbd167b fix #29789, avoid unneccessary dcalls and checks in dart:_runtime
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2932043003 .
2017-06-12 15:44:45 -07:00
Jennifer Messerly 334354f968 fix #29753, use ES5 constructors for ddc
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2934623003 .
2017-06-12 15:31:32 -07:00
Vijay Menon a7645f817f Optimize runtime code on hot methods
ochafik: this should include your internal fixes.

Here are generated diffs:

JSArray:
       [dartx._get](index) {
-        if (!(typeof index == 'number')) dart.throw(_js_helper.diagnoseIndexError(this, index));
-        if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNull(index) < 0) dart.throw(_js_helper.diagnoseIndexError(this, index));
+        if (index == null || index >= this.length || index < 0) {
+          dart.throw(_js_helper.diagnoseIndexError(this, index));
+        }
         return this[index];
       }
       [dartx._set](index, value) {
         E._check(value);
         this[dartx.checkMutable]('indexed set');
-        if (!(typeof index == 'number')) dart.throw(_js_helper.diagnoseIndexError(this, index));
-        if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNull(index) < 0) dart.throw(_js_helper.diagnoseIndexError(this, index));
+        if (index == null || index >= this.length || index < 0) {
+          dart.throw(_js_helper.diagnoseIndexError(this, index));
+        }

R=jmesserly@google.com, ochafik@google.com

JSString:
     [dartx.codeUnitAt](index) {
-      if (!(typeof index == 'number')) dart.throw(_js_helper.diagnoseIndexError(this, index));
-      if (dart.notNull(index) < 0) dart.throw(_js_helper.diagnoseIndexError(this, index));
-      if (dart.notNull(index) >= dart.notNull(this[dartx.length])) dart.throw(_js_helper.diagnoseIndexError(this, index));
+      if (index == null || index < 0 || index >= this.length) {
+        dart.throw(_js_helper.diagnoseIndexError(this, index));
+      }
       return this.charCodeAt(index);
     }
     [dartx.startsWith](pattern, index) {
       if (index === void 0) index = 0;
-      _js_helper.checkInt(index);
-      if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dartx.length])) {
+      let length = this.length;
+      if (dart.notNull(index) < 0 || index > length) {
         dart.throw(new core.RangeError.range(index, 0, this[dartx.length]));
       }
       if (typeof pattern == 'string') {
         let other = pattern;
-        let otherLength = other[dartx.length];
-        let endIndex = dart.notNull(index) + dart.notNull(otherLength);
-        if (endIndex > dart.notNull(this[dartx.length])) return false;
+        let otherLength = other.length;
+        let endIndex = index + otherLength;
+        if (endIndex > length) return false;
         return other == this.substring(index, endIndex);
       }
       return pattern[dartx.matchAsPrefix](this, index) != null;
     }
     get [dartx.isEmpty]() {
-      return this[dartx.length] == 0;
+      return this.length == 0;
     }
     [dartx.compareTo](other) {
-      if (!(typeof other == 'string')) dart.throw(_js_helper.argumentErrorValue(other));
+      if (other == null) dart.throw(_js_helper.argumentErrorValue(other));
       return dart.equals(this, other) ? 0 : this < other ? -1 : 1;
     }
     get [dartx.hashCode]() {
       let hash = 0;
-      for (let i = 0; i < dart.notNull(this[dartx.length]); i++) {
+      let length = this.length;
+      for (let i = 0; i < length; i++) {
         hash = 536870911 & hash + this.charCodeAt(i);
         hash = 536870911 & hash + ((524287 & hash) << 10);
         hash = hash ^ hash >> 6;
         ...
     }
     [dartx._get](index) {
-      if (!(typeof index == 'number')) dart.throw(_js_helper.diagnoseIndexError(this, index));
-      if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNull(index) < 0) dart.throw(_js_helper.diagnoseIndexError(this, index));
+      if (index == null || index >= this.length || index < 0) {
+        dart.throw(_js_helper.diagnoseIndexError(this, index));
+      }
       return this[index];
     }
Review-Url: https://codereview.chromium.org/2927763004 .
2017-06-08 17:31:44 -07:00
Ben Konyi 033c18472d Revert "Removed SecurityContext.alpnSupported, as ALPN is now supported on all platforms. Also updated CHANGELOG.md to announce its removal."
This reverts commit 4b6fa0d5fb.

BUG=
R=kevmoo@google.com

Review-Url: https://codereview.chromium.org/2928013002 .
2017-06-08 14:32:41 -07:00
Ben Konyi 4b6fa0d5fb Removed SecurityContext.alpnSupported, as ALPN is now supported on all platforms. Also updated CHANGELOG.md to announce its removal.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2926153004 .
2017-06-07 15:15:58 -07:00
Alan Knight a865f0ecf2 Update DDC libraries to match SDK, and debugger_test golden file
BUG=
R=jacobr@google.com

Review-Url: https://codereview.chromium.org/2903333002 .
2017-05-25 15:00:51 -07:00
Vijay Menon 75afaf5a24 Support reflectClass on parameterized classes
Internal pageloader usage hits this.

R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2899343004 .
2017-05-25 13:27:35 -07:00
Vijay Menon 570f6de05b Remove unsafe flag from ddc sdk
One small step for man...

R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2910473002 .
2017-05-25 10:50:17 -07:00
Alan Knight 0bb2d5e548 Update DDC html libraries to match SDK
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2899083007 .
2017-05-25 09:33:23 -07:00
Alan Knight b4b02daade Include DDC fixes to dart:html in the main version
BUG=
R=jacobr@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2899173002 .
2017-05-24 12:49:13 -07:00
Vijay Menon 6402ad477d Use the dart2js patch for dart:convert to get latest type fixes
BUG=
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2896253003 .
2017-05-24 07:33:19 -07:00
Jacob Richman 58851f2f06 Add ignoreAllErrors option to dart:_runtime
Supports users who want to try to run broken code while porting a Dart
app to strong mode.

BUG=
R=alanknight@google.com

Review-Url: https://codereview.chromium.org/2893803006 .
2017-05-19 15:53:08 -07:00
Vijay Menon 92d39a4e08 One more minor mixin fix
We need to preserve the Mixin constructor to make sure metadata (e.g.,
implements) is injected in the right place.

R=jacobr@google.com

Review-Url: https://codereview.chromium.org/2779063002 .
2017-05-19 07:41:29 -07:00
Vijay Menon b82b0e29ed DDC fixes for SpeechRecognition
R=alanknight@google.com

Review-Url: https://codereview.chromium.org/2896463002 .
2017-05-18 17:05:51 -07:00
Jacob Richman 61b0cbd685 Fix language/stacktrace_rethrow_error_test_withtraceparameter_multi test
Fix is to remove unexpected frames on the stack trace by inlining
all calls to determine current DDC configuration settings.

BUG=
R=leafp@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2879393002 .
2017-05-15 16:27:42 -07:00
Jacob Richman ff588405fe Fix bugs supporting configuring DDC runtime settings before the application starts.
I don't see a better way to implement this given how DDC lazily
initializes fields.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2875063003 .
2017-05-12 15:59:07 -07:00
Bob Nystrom 979a75c4b3 Fix more errors in DDC SDK.
R=jacobr@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2871363002 .
2017-05-11 11:22:05 -07:00
Bob Nystrom a68b44924e Disambiguate setters and getters when patching DDC SDK.
Stdio was having its setters applied twice instead of applying the
getter and setter each once.

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2874713005 .
2017-05-10 16:56:41 -07:00
Jacob Richman a35b79f178 Support configuring DDC runtime settings before the application starts and normalize API for configuring runtime settings.
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2874813002 .
2017-05-10 10:05:49 -07:00
Jennifer Messerly 4c377076bf fix #29585, implement equality for tearoffs
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2873073002 .
2017-05-09 16:21:51 -07:00
Vijay Menon 36356c28c1 Better stack trace support
- Caches stack trace objects (package:stack_trace appears to rely on this)
- Better support for stack traces on primitives

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2869463002 .
2017-05-09 14:58:34 -07:00
Jennifer Messerly 811a9eed1d Revert "Revert "fix #27256, track type bounds for generic functions""
This reverts commit 3a23e604e2.

The problem was unrelated to the CL; it appears to be a dart:async break of package:async.

In the meantime we have turned on --unsafe-force-compile to DDC's shapshotting step

Review-Url: https://codereview.chromium.org/2869733006 .
2017-05-09 14:20:25 -07:00
Alan Knight 3a23e604e2 Revert "fix #27256, track type bounds for generic functions"
This reverts commit b58f826976.

BUG=

Review URL: https://codereview.chromium.org/2870543005 .
2017-05-09 12:58:03 -07:00
Jennifer Messerly b58f826976 fix #27256, track type bounds for generic functions
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2867493002 .
2017-05-09 11:42:40 -07:00
Bob Nystrom 4145a49503 Move Dart versions of math.min() and math.max() into VM patch file.
For DDC and dart2js, we call the corresponding JS function. This is
shorter and avoids a strong mode type error in the Dart implementation.

R=jmesserly@google.com, lrn@google.com

Review-Url: https://codereview.chromium.org/2858353003 .
2017-05-05 15:15:21 -07:00
Jennifer Messerly 171f7ba592 fix #29544, mixins to a class with named constructors
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2859703003 .
2017-05-04 12:33:45 -07:00
Jennifer Messerly 6ab17db3da fix more mixin tests to work in strong mode
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2861783002 .
2017-05-04 11:30:14 -07:00
Vijay Menon d5ecaf1088 Loosen type check on runZoned errorHandler
R=floitsch@google.com, lrn@google.com

Review-Url: https://codereview.chromium.org/2858843002 .
2017-05-03 05:30:06 -07:00
Lasse R.H. Nielsen 7998f590b1 Update documentation on trignometric functions.
Fixes #17515
BUG= http://dartbug.com/17515
R=floitsch@google.com

Committed: https://github.com/dart-lang/sdk/commit/40220ec0766bb2b179d3623d3f298223df842279
Review-Url: https://codereview.chromium.org/2852053002 .
2017-05-03 09:49:14 +02:00
Jennifer Messerly 5e82b8c2e9 fix #29530, field metadata generation
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2861503002 .
2017-05-02 14:45:34 -07:00