Commit graph

1644 commits

Author SHA1 Message Date
Florian Schneider d99229026e Fix issues with argument evaluation order and noSuchMethod errors.
Fix tests to conform to spec bahavior.

Update dart2js test status.

BUG=#27572
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2416513003 .
2016-10-12 17:04:55 -07:00
John McCutchan 7fd9df4d91 Improvements to NoSuchMethodError.toString
This makes the following improvements:

* Always show the call that was made, with arguments.
* ...and show the actual arguments in more cases.
* Be less confusing in the case of a call on the null receiver.
* Be less redundant in the output.
* Report when a constructor is called with the wrong number of arguments.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2405353002 .
2016-10-12 09:52:51 -07:00
John McCutchan eaea9d58fe Revert "Give useful message for null derefs"
This reverts commit 588fed0368.

BUG=

Review URL: https://codereview.chromium.org/2403203002 .
2016-10-10 13:11:44 -07:00
John McCutchan 588fed0368 Give useful message for null derefs
The exception implements NoSuchMethodError so that code that depends on
the previous exception type still works.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2407603002 .
2016-10-10 12:53:47 -07:00
Matthias Hausner 3e0d13bc28 Make compile-time errors catchable
If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.

The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#

Example:
     1	void bad() {
     2	    return 5
     3	}
     4
     5	void main(args) {
     6	    bad();
     7	}

Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^
$

After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^

#0      main (file:///Users/hausner/tmp/e.dart:6:3)
#1      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$

Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.

BUG= https://github.com/dart-lang/sdk/issues/23684
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2044753002 .
2016-09-16 10:10:38 -07:00
Ryan Macnak 6137d020b9 AOT: Use a cid range check when possible to implement type tests.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2314133003 .
2016-09-08 15:25:08 -07:00
Lasse R.H. Nielsen 8a70e46d76 Fix problem occurring when an async* stream is paused at the end of a yield*.
In this case, the stream is unscheduled and it is not expecting to be resumed,
so nothing further happens.

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

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

Review URL: https://codereview.chromium.org/2297013003 .
2016-09-01 11:03:35 +02:00
Ryan Macnak ea6159fb08 Don't cache the cid of CodeUnits.
It is not a predefined class, so its cid may change during precompilation.

Review URL: https://codereview.chromium.org/2279323003 .
2016-08-29 09:21:06 -07:00
Lasse R.H. Nielsen 99ec987a09 Remove deprecated Resource class from dart:core.
BUG=
R=floitsch@google.com, mit@google.com

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

Committed: f61143153a
Committed: 35437dda1f
2016-08-26 11:58:04 +02:00
Florian Schneider caceddba8f VM: New, faster default Map construction.
Replace the C++ implementation of the default Map constructor with a
Dart version that uses the existing native setters to initialize members.

This avoid the expensive runtime transition when doing "new Map()".

BUG=#26046
R=asiva@google.com

Review URL: https://codereview.chromium.org/2278273003 .
2016-08-25 17:51:45 -07:00
Ryan Macnak 5c06127e2d Remove unused external typed data factories.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2276803002 .
2016-08-25 10:29:17 -07:00
Lasse R.H. Nielsen 99439a336a See: https://docs.google.com/document/d/1iEuLbDMgbB657R5aFj9EfnT6B0obzQk93Of7CfWKc00/edit#heading=h.9ixvz54wwawi
Implement assert in initializer list in VM.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2002923002 .
2016-08-24 12:43:26 +02:00
Lasse R.H. Nielsen afbbbb97cf Reapply fast-URI patch.
Review URL: https://codereview.chromium.org/2245533004 .
2016-08-17 10:54:24 +02:00
Siva Annamalai cb36467568 - Fix for issue 27054 (leak when removing element from _GrowableList)
- _GrowableList.removeLast was not shrinking the backing array

BUG=27054
R=johnmccutchan@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2240313002 .
2016-08-12 16:06:12 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Lasse R.H. Nielsen 3502fd5fd7 Revert "Reapply fast-URI patch."
Seems to trigger VM bug.

Review URL: https://codereview.chromium.org/2225243003 .
2016-08-09 12:51:58 +02:00
Lasse R.H. Nielsen 99e94db85b Reapply fast-URI patch.
R=whesse@google.com

Review URL: https://codereview.chromium.org/2220373002 .
2016-08-09 09:38:47 +02:00
Regis Crelier fbbedf4f18 Introduce getter p on double in the VM to control fractional precision.
Add test.

R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org/2208473006 .
2016-08-04 15:18:00 -07:00
Siva Annamalai 39ae4337dd Fix issue 27006 (safepoint assertion failure).
BUG=27006
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2206423002 .
2016-08-03 14:28:41 -07:00
Ryan Macnak d37ea681f5 RELOAD: Check if an implicit closure needs rebinding at compile time and adjust closure equality.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2187433006 .
2016-07-27 16:51:11 -07:00
Vyacheslav Egorov 2a8581a238 VM: Remove _GrowableList.from which was never called.
It contained a bug anyway: _GrowableList does not have a 0 arguments constructor.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2163173003 .
2016-07-21 16:13:37 +02:00
William Hesse ca49303576 Revert "Add fast-mode Uri class."
This reverts commit 00090a0c72.

Revert "Add fast-mode Uri class."

This reverts commit 323ca7e410.

Revert "Fix regression for the one case where we deliberately don't follow the RFC."

This reverts commit b39e048c4b.

Revert "Cache hashCode in Uri implementations to improve performance when used as, e.g., Map key."

This reverts commit a11ad27723.

BUG=https://github.com/dart-lang/sdk/issues/26917
TBR=keertip@google.com

Review URL: https://codereview.chromium.org/2167663002 .
2016-07-20 14:32:52 +02:00
John McCutchan c692a64e5a Rework how enums are implemented and reloaded
- Enum instances now hold their index and their label. Before the labels were held in a static array to the side and the index was used to look up the label.

- Before and after reload enum instances are now paired (by label) and put into the 'become' table.

Fixes https://github.com/dart-lang/sdk/issues/26877

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2153143002 .
2016-07-15 10:52:20 -07:00
Siva Annamalai 06a3687ec3 More #ifndef PRODUCT changes.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2156443002 .
2016-07-14 18:27:55 -07:00
Siva Annamalai aaa0867567 More changes to use #ifndef PRODUCT ... #endif explicitly instead of relying on compiler magic.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2146713004 .
2016-07-14 11:13:13 -07:00
Lars Bak 21a3a27aff Made simple instance-of checks fast for unoptimized code.
This change makes dart2js 15% faster when compiling 60KLOC. 15sec -> 13sec.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/2147123002 .
2016-07-14 11:11:17 -07:00
Zachary Anderson 64e9017629 Fuchsia: Platform specific calls needed to Initialize and Cleanup VM.
fuchsia_test now succeeds.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2148533002 .
2016-07-13 09:12:28 -07:00
Ryan Macnak 3fec7d2017 Fix debug and release builds.
Review URL: https://codereview.chromium.org/2139403002 .
2016-07-12 11:05:01 -07:00
Ryan Macnak c7e6ed1e9f Fix product build.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2141003003 .
2016-07-12 11:01:00 -07:00
Todd Turnidge 3a51fceaba First cut at _spawnUri rpc in the vm service.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2072543002 .
2016-07-11 14:25:27 -07:00
Lars Bak bc6358e5ef Sped up hashCode by removing megamorphic call to _identityHashCode.
Microbenchmark measuring megamorhic hashCode access shows 25% speedup.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2137673002 .
2016-07-08 15:19:55 -07:00
Stephen Adams 38fdb4bd4a vm: Generate 'and' instruction for Smi values.
This pattern ensures the generation of 'and' instructions on the Smi x Smi path of a polymorphic & operation.

There are two 'and' operations on most simple _InternalLinkedHashMap and _CompactLinkedHashSet operations. One of the inputs, the hashCode, is occasionally a _Bigint.  This change ensures that the usual case path has an 'and' instruction instead of a call to _IntegerImplementation.&

R=regis@google.com

Review URL: https://codereview.chromium.org/1913663002 .
2016-07-04 16:27:57 -07:00
Siva Annamalai de5a1c8dac Remove support for pretenuring as it is not fully implemented and is currently turned on for a very specific case (double to string for one byte strings).
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2119633002 .
2016-07-01 12:59:19 -07:00
Zachary Anderson a503570e3a Fuchsia: Initial check-in.
Instructions to build and run are in README.fuchsia.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2117593002 .
2016-07-01 12:42:05 -07:00
Lasse R.H. Nielsen 00090a0c72 Add fast-mode Uri class.
Optimize parser and make it recognize a class of URIs that don't need extra
handling: no escapes, no funny characters, already (nearly or completely)
normalized.
Have a class specifically for those URIs which retains the original
input string without having allocate any further strings.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2086613003.
2016-06-30 12:20:15 +02:00
Ryan Macnak 524fbc1e0f Use clustered serialization for full snapshots.
Retain the recursive-descent format for script and message snapshots.

Flutter gallery app on a Nexus 4
 - Snapshot, excluding instruction/rodata sections 3429177 -> 2874997B (-16%)
 - InitOnce 54.1 -> 8.4ms (-84%)
 - InitializeIsolate 374.3 -> 170.8ms (-54%)

R=asiva@google.com

Review URL: https://codereview.chromium.org/2032153003 .
2016-06-29 19:50:06 -07:00
Siva Annamalai da1a5534b4 Fix for issue 26555, do not inherit package root and package config from the parent isolate when doing Isolate.spawn
BUG=26555
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2072873002 .
2016-06-17 09:59:15 -07:00
Matthias Hausner 98033d4132 Simplify generated code for assert()
Move the assert condition check and throwing the error into
the Dart library. This eliminates one call to library code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2073623002 .
2016-06-16 10:44:30 -07:00
Zachary Anderson b3e5c5eeed DBC: Adds BinarySmiOp instruction
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2053213004 .
2016-06-15 14:48:11 -07:00
Lasse R.H. Nielsen c56411d576 Make VM accept function values in assert statements.
Fix for issue #18454.

BUG= http://dartbug.com/18454

Review URL: https://codereview.chromium.org/2064663002 .
2016-06-15 10:08:39 +02:00
John McCutchan 1a4c2005cc DevFS initial implementation.
This cl implements an experimental filesystem maintained in the vm, called dart-devfs.  This will allow service protocol users to read and write source files while the vm is running.  This is needed for the reload support for flutter.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/2059883003 .
2016-06-10 12:33:50 -07:00
John McCutchan 62af0fc5d6 Fix checked mode error
BUG=

Review URL: https://codereview.chromium.org/2039813005 .
2016-06-08 07:34:55 -07:00
John McCutchan 3b2e14ab56 Fix deferred load errors
R=hausner@google.com

Review URL: https://codereview.chromium.org/2045023003 .
2016-06-08 07:12:52 -07:00
John McCutchan 6fd8fd7987 Rework standalone to use a synchronous loader that does not invoke Dart code
- [x] The first caller of the tag handler blocks, recursive callers queue work and exit.
- [x] Use a NativeMessageHandler to receive I/O results from the service isolate.
- [x] Preserve load error message format.
- [x] Move packages map into service isolate.
- [x] Wire up Todd's native URI code.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1998963003 .
2016-06-06 14:15:01 -07:00
Stephen Adams b37747934e Specialize Symbol.hashCode
Patch internal.Symbol.hashCode and specialize JS version to avoid
recomputing String.hashCode

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2038853003 .
2016-06-03 15:10:51 -07:00
Ryan Macnak 2e9c5f9a91 Reapply "VM: Add result cid information for recognized methods."
- _HashVMBase._index is nullable
 - _HashVMBase._data is a regular Array
 - DBC fixes from Zach.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2033553002 .
2016-06-02 09:59:48 -07:00
Ryan Macnak 907a6b1c3b Revert "VM: Add result cid information for recognized methods."
In Flutter, this caused

  RangeError (index): Index out of range: index should be less than null: 0
  Uint32List.[]= (dart:typed_data)
  _HashVMBase&MapMixin&&_LinkedHashMapMixin._insert (dart:collection-patch/compact_hash.dart)

This reverts commit 0ae4ae5033.

TBR=fschneider@google.com

Review URL: https://codereview.chromium.org/2023423002 .
2016-06-01 14:08:48 -07:00
Florian Schneider 0ae4ae5033 VM: Add result cid information for recognized methods.
We already had this for recognized factories. This CL adds a result cid
for the remaining recognized methods.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2018363004 .
2016-06-01 09:42:48 +02:00