document.registerElement is going away soon, and dart2js never implemented window.customElements.define.
Replace the inheritance with composition for each FooElement.
When used to create a DOM tree, replace `new FooElement()` with `new FooElement().element`.
In CSS, replace each custom element selector with a class selector, i.e. `foo-element` with `.foo-element`.
Bug: https://github.com/dart-lang/sdk/issues/34107
Change-Id: Id5ab5b6104a6165a8ad3b01d73ee9d76e46024ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101061
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reproduction without this fix:
Create 2 files, test1.dart and test2.dart:
```
$ cat test1.dart
import "test2.dart";
main() {
test();
test();
}
$ cat test2.dart
test() {
// blank line.
print("hello");
}
```
Launch with observatory enabled and paused at start, e.g.
`out/ReleaseX64/dart --observe --pause-isolates-on-start test1.dart`
Set a breakpoint on the second (*not* the first!) call to `test()`.
Continue execution.
Now write `break test2.dart:2` into the debugger console and you will be
presented with a stack trace looking something like this:
```
Unexpected exception:
NoSuchMethodError: method not found: 'gi4'
Receiver: Instance of 'minified:hS'
Arguments: []
StackTrace:
main.dart.js 459:3 Object.n
main.dart.js 15752:9 hS.G
main.dart.js 15901:28 hS.gi4
main.dart.js 40703:10 GE.$1
main.dart.js 43127:29 Hz.$0
main.dart.js 43100:9 pN.lG
main.dart.js 43124:12 HA.$1
main.dart.js 43127:29 Hz.$0
main.dart.js 43100:9 pN.lG
main.dart.js 43124:12 HA.$1
===== asynchronous gap ===========================
main.dart.js 14033:115 LH.cG
main.dart.js 13585:17 qm.eB
main.dart.js 13571:3 qm.kC
main.dart.js 13870:3 cQ.aV
main.dart.js 13873:27 cQ.I
main.dart.js 40226:79 P.R
===== asynchronous gap ===========================
[...]
```
This CL fixes the issue by catching the NoSuchMethod
(it will succeed for UnresolvedSourceLocation for instance)
and then using the scriptref and token position on the
abstract class Location to get the actual line.
Change-Id: Id951e2727a5edb8ba52a65959c833dcbf923406c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98667
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Previously, a valid web socket connection would use the following URI:
`ws://127.0.0.1/ws`
Now, by default, the VM service requires a connection to be made with a
URI similar to the following:
`ws://127.0.0.1:8181/Ug_U0QVsqFs=/ws`
where `Ug_U0QVsqFs` is an authentication code generated and shared by the
service.
This behavior can be disabled with the `--disable-service-auth-codes`
flag.
Change-Id: I288aac58e3ba9d35dca8071f3f7e7a073896c271
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98433
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
- Setting the `disableBreakpoints` parameter to true will result in any
breakpoints hit during execution resulting from an evaluate or invoke
call to be ignored.
- Default behavior is the same (break on breakpoints).
- Updated Observatory eval box to disable breakpoints.
- Added tests
Change-Id: Ibf40f8a8de018718435118e13cc2e969f8ed7944
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95320
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
In Dart2, type bounds checking is either performed by the common front-end or
by explicitly generated code, but not by type finalization or runtime anymore,
as it was done in Dart1.
Consequently, the class BoundedType is not needed anymore, and malbounded or
malformed types are not seen by the runtime either.
Change-Id: I5d6e4c68d153d6730fa7ff7f6d9dcfa611299c16
Reviewed-on: https://dart-review.googlesource.com/c/86687
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
- use core snapshot when initializing an isolate (CorelibIsolateStartup benchmark moves from 39s to 2s)
- remove use_dart_frontend flag from the isolate specific flags
- the script snapshot API functions now return an error
Change-Id: Ia562e007fdbfd1d3ebd8e1a0c8feee238bada00b
Reviewed-on: https://dart-review.googlesource.com/76709
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Get rid of stuff like this (that at least showed up in debug builds):
```
Unexpected exception:
TypeError: 604.0795288085938: type 'JSDouble' is not a subtype of type
'int'
StackTrace:
main.dart.js 3527:17 Object.wrapException
main.dart.js 4000:15 Object.intTypeCheck
main.dart.js 55623:39 HtmlElement._varsTop$1
main.dart.js 55631:23 HtmlElement.dart.DebuggerFrameElement._onScroll$1
main.dart.js 3941:14 Object.eval
[...]
```
(Note that I disabled minification in the example above).
Change-Id: Id79e726c3229ba96b1df5db7d4fb779e4be0913a
Reviewed-on: https://dart-review.googlesource.com/74623
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
When clicking the "toplist by retained memory" button in Observatory
it always asks to find 10 objects of a specific size.
The previous implementation did this by taking all objects (millions if
using a lot of memory), sorting it (O(n log n)), filtering it (O(n)),
and ".take"ing the 10 we wanted. Total runtime should be O(n log n)
where n is the number of objects in the heap.
This CL optimizes this for the (to my knowledge) only case there exists,
and instead, while iterationg over all elements (O(n)) keeps a sorted
working list of the top m objects (this is 10 for all intents and purpose
as far as I can see; I've if-cased it to be at most 20). Total runtime
should be O(n log m) where n is the number of objects in the heap and m
is the requested number, which - as said - is at most 20, i.e. a constant,
maying that the runtime is more like O(n).
Instrumenting the code slightly to measure how long it takes:
```
diff --git a/runtime/observatory/lib/src/repositories/top_retaining_instances.dart b/runtime/observatory/lib/src/repositories/top_retaining_instances.dart
index 400ac1427ed..b7e5c429fac 100644
--- a/runtime/observatory/lib/src/repositories/top_retaining_instances.dart
+++ b/runtime/observatory/lib/src/repositories/top_retaining_instances.dart
@@ -7,6 +7,8 @@ part of repositories;
class TopRetainingInstancesRepository
implements M.TopRetainingInstancesRepository {
Future<Iterable<M.RetainingObject>> get(M.IsolateRef i, M.ClassRef c) async {
+ Stopwatch stopwatch = new Stopwatch()..start();
+ try {
S.Isolate isolate = i as S.Isolate;
S.Class cls = c as S.Class;
assert(isolate != null);
@@ -18,5 +20,9 @@ class TopRetainingInstancesRepository
return (await Future.wait(
snapshot.getMostRetained(isolate, classId: cls.vmCid, limit: 10)))
.map((object) => new S.RetainingObject(object));
+ } finally {
+ int ms = stopwatch.elapsedMilliseconds;
+ print("TopRetainingInstancesRepository took $ms ms.");
+ }
}
}
```
I ran this program:
```
import "dart:isolate";
List<Object> data = [];
main() {
RawReceivePort preventClose = new RawReceivePort();
for(int i = 0; i < 10000000; i++) {
data.add(new List<int>()..add(i));
}
for(int i = 0; i < 100000; i++) {
data.add(new Foo(i));
}
}
class Foo {
final int i;
Foo(this.i);
}
```
and requested the toplist by retained memory for class `Foo`.
What before took 121778 ms now takes 81026 ms.
(For smaller numbers in the same test it went from ~10 seconds to ~8 seconds).
Change-Id: I6aee4b0c91af8a9ade116b79e56d1e6cbbee5d09
Reviewed-on: https://dart-review.googlesource.com/70502
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Prior to this fix I get errors like
```
TypeError: Instance of 'b2<bQ>': type 'b2<bQ>' is not a subtype of type 'List<bQ>'
StackTrace:
main.dart.js 1631:3 Object.m
main.dart.js 2001:9 Object.p
[...]
```
Change-Id: I2fc6329c05cb76bff76929aeee1eca3954fbc0a9
Reviewed-on: https://dart-review.googlesource.com/70501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Throwing a programmer-constructed FallThroughError is not useful. It
prints something like:
'null': Switch case fall-through at line null.
And if you can track that down, it's confusing because it's being used
to signal things that don't have anything to do with falling through
from one switch case to the next one. Usually, there turns out to be
no matching case in the first place so there's no possible way that
anything fell through to the next case.
Fixes https://github.com/dart-lang/sdk/issues/28189
Change-Id: I68d8aaf22c95163f87a159928f924c25c19f094e
Reviewed-on: https://dart-review.googlesource.com/62522
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This forwarders are used at dynamic call-sites and perform type checking
for all non-generic-covariant arguments. This allows to skip the same
type checks in the actual method body.
This yield on average 10% improvement in performance across the body of
benchmarks including dart2js compilation times.
Bug: https://github.com/dart-lang/sdk/issues/33257
Change-Id: If3fc94a2e0a6f496ec0633f0b379d053a54a40ca
Reviewed-on: https://dart-review.googlesource.com/61244
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
In most cases the correct fix is to simply drop the generic comment
syntax (e.g. replace "List/*<Map>*/" with "List"). We can't use the
more precise type because the runtime type is actually more general
(e.g. when processing an object that came from the JSON parser, all
lists have runtime type List<dynamic>, even if their elements happen
to be uniform). But we can introduce more precise types when handling
substructures.
Exception: all JSON-derived maps have type Map<String, dynamic> (since
JSON maps always have string keys), so we can use a more precise type
when dealing with JSON maps.
Change-Id: I48c9dbdda97c11530978212146f74db7b43f5197
Reviewed-on: https://dart-review.googlesource.com/58320
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
If there is registered expression compiler, VM debugger uses it to compile expressions. Otherwise, it will fallback to use kernel service compiler.
This is needed to support Flutter use case where compiler is running on developer's host machine, not on the device where VM is running.
Bug: dartbug.com/31981
Change-Id: I8bdfc8ab45a57c306169abe189f1e24e1b0bcf40
Reviewed-on: https://dart-review.googlesource.com/57520
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This CL adds base classes for breakpoint events (which support a
`breakpoint` getter) and async suspension events (which support an
`atAsyncSuspension` getter). Previously these getters were accessed
through dynamic dispatch.
Change-Id: I9bc450a8988483cd0662b1dfe31b4adaf0936ff9
Reviewed-on: https://dart-review.googlesource.com/57380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>