Commit Graph

59 Commits

Author SHA1 Message Date
Regis Crelier d0a7bad121 Pass a second type argument vector to all type instantiation calls in the VM.
With generic methods, uninstantiated types will require 2 instantiators, one
reflecting the class type arguments (as of today) and one reflecting the
function type arguments (new).
This is work in progress and the second instantiator is always null for now.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2799373002 .
2017-04-10 21:25:33 -07:00
Jacob Richman 4360e99d18 Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Committed: https://github.com/dart-lang/sdk/commit/62be0eacfbb36bdc92a05c7c35bb4506621b6a3a
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-21 10:07:26 -07:00
Jacob Richman 62be0eacfb Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-20 22:19:22 -07:00
Jacob Richman 88f8aacd5f Re-apply rolled back CL to apply dartfmt to runtime.
Fix observatory tests broken by running dartfmt due to line and column changes.
Temporarily reverted formatting for evaluate_activation_test.dart as dartfmt doesn't yet handle multitests.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2759973004 .
2017-03-20 21:44:59 -07:00
Ryan Macnak ea4744a06f Revert "Run dartfmt on all files under runtime."
This reverts commit 15f393f189.

The change caused many service test failures due to changed line numbers.

TBR=jacobr@google.com

Review-Url: https://codereview.chromium.org/2762583003 .
2017-03-20 13:42:55 -07:00
Jacob Richman 15f393f189 Run dartfmt on all files under runtime.
I've omitted files where the formatter output is significantly uglier
than the original code and I'll send those files in a separate CL
with options for how to make the code look reasonable while still
taking advantage of the formatter.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2751423005 .
2017-03-20 13:13:50 -07:00
Florian Schneider 71cb54714b Reland "VM: Simplify lowering of is-tests.""
This reverts commit d44fec08b0.

Remove special-cases for known types (int, String, num, double, Smi). The generic
lowering into an instance call (_simpleInstanceOf) works just fine for these predefined
types.

Also, remove parameter for negated is-tests. Instead insert explicit negation when.
building the flow graph.

Diff to original CL:
 * Correct number of arguments in invocation of _instanceOf in kernel_to_il.cc.

R=vegorov@google.com
TBR=vegorov@google.com

Review-Url: https://codereview.chromium.org/2748063003 .
2017-03-14 09:19:51 -07:00
Vyacheslav Egorov d44fec08b0 Revert "VM: Simplify lowering of is-tests."
This reverts commit 066123e037.

Reason for revert: vm-kernel-* is broken because kernel_to_il.cc was not updated
in sync with flow_graph_builder.cc.

TBR=fschneider@google.com, rmacnak@google.com,

Review-Url: https://codereview.chromium.org/2748073002 .
2017-03-14 12:27:41 +01:00
Florian Schneider 066123e037 VM: Simplify lowering of is-tests.
Remove special-cases for known types (int, String, num, double, Smi). The generic
lowering into an instance call (_simpleInstanceOf) works just fine for these predefined
types.

Also, remove parameter for negated is-tests. Instead insert explicit negation when.
building the flow graph.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2751543003 .
2017-03-13 16:48:59 -07:00
Sigmund Cherem 053e0ee720 Minor adjustments to patch files
The implementation of patching in analyzer checks that signatures are identical.
This is stricter than it needs to be, but the required fixes in dart:core are
pretty simple.

BUG=
R=hausner@google.com

Review-Url: https://codereview.chromium.org/2655223005 .
2017-01-27 14:24:06 -08:00
Vyacheslav Egorov 0635b57d43 Reland "Recognize and optimize a.runtimeType == b.runtimeType pattern."
This relands commit f4ec20abac.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2465793003 .
2016-11-01 16:49:02 +01:00
Vyacheslav Egorov eb8c24e133 Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451623006 .
2016-10-27 10:09:22 +02:00
Vyacheslav Egorov 12968edb9c Revert "Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork.""
This reverts commit 4e7a31262e.

Windows bots are broken now.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451893004 .
2016-10-26 17:07:18 +02:00
Vyacheslav Egorov 16e4f2f1c2 Revert "Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."""
This reverts commit e495e100dd.

Commit breaks bots that are using Android devices (SIMARM is unaffected).

R=rmacnak@google.com
BUG=

Review URL: https://codereview.chromium.org/2449013004 .
2016-10-26 16:53:32 +02:00
Vyacheslav Egorov 4e7a31262e Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This relands commit 2fed1c3905 with fixes to ensure that analyzer summaries are correctly created and XARM build does not try to use target binaries on the host.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2453773002 .
2016-10-26 16:48:28 +02:00
Vyacheslav Egorov cf7ff42e60 Revert "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This reverts commit 2fed1c3905.

SDK builds are failing

TBR=zra@google.com

Review URL: https://codereview.chromium.org/2455593002 .
2016-10-26 13:06:27 +02:00
Vyacheslav Egorov 2fed1c3905 Merge more Kernel infrastructure from kernel_sdk SDK fork.
- bring patched SDK generation scripts and VM patch tweaks that allow VM patch files to be parsed by analyzer front-end;
  Patched SDK is an SDK with all VM patches spliced into it. Kernel compiler is based on the analyzer front-end which does
  not have any patch files support/model so for it to produce Kernel files that match VM we need to generate a such patched SDKs.

- bring test script modifications that allow to test Kernel pipeline

BUG=
R=asiva@google.com, kmillikin@google.com, whesse@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2434123003 .
2016-10-26 13:02:54 +02:00
Vyacheslav Egorov e495e100dd Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern.""
This reverts commit 890f694de5.

Previous commit was passing field_type_map_ down in a place where it was not passed down before.

This caused some handles to be used across zones, which caused crashes.

BUG=

Review URL: https://codereview.chromium.org/2453463006 .
2016-10-26 12:25:48 +02:00
Ryan Macnak 890f694de5 Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."
This reverts commit f4ec20abac.

Revert "Use ZoneHandle when creating ConstantInstr"

This reverts commit cb87f2d82f.

This change introduced crashes on AOT and runtime errors on the GN SDK build.

TBR=vegorov@google.com

Review URL: https://codereview.chromium.org/2451893002 .
2016-10-25 13:19:33 -07:00
Vyacheslav Egorov f4ec20abac Recognize and optimize a.runtimeType == b.runtimeType pattern.
Start by removing all get:runtimeType overrides in the patch files to have a single point computing the runtime type - Object.get:runtimeType. Handle string, double and integer types inside both intrinsic and runtime call to unify their handling and guarantee that code works even with intrinsifier disabled.

With overrides removed we can easily check that get:runtimeType is unique function name within the application that is being precompiled and use that to convert InstanceCall(get:runtimeType, ...) into StaticCall even nothing is known about the receiver.

This enables us to check if both left side and right side of comparison are StaticCall(Object.get:runtimeType, ...) when specializing InstanceCall(==, x, y). If they are we convert InstanceCall(==, StaticCall(get:runtimeType, a), StaticCall(get:runtimeType, b)) into StaticCall(Object._hasSameRuntimeType, a, b). A canonicalization rule will later delete unused get:runtimeType invocations.

Object._hasSameRuntimeType is implemented in C++ and intrinsified. It operates without creating new runtime types (except for Closures - where it does for simplicity). Cases of different class ids (i.e. a.[cid] != b.[cid]) and non-parameterized types are handled completely in the intrinsic. The rest is handled in the runtime code.

Microbenchmarking results:

Same parameterized classes: 15x improvement
Different parameterized classes: 300x improvement
Different/same non-parameterized classes: 2x improvement

BUG=
R=fschneider@google.com, regis@google.com

Review URL: https://codereview.chromium.org/2379733002 .
2016-10-25 10:03:06 +02: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
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
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
Florian Schneider 1217e539e9 VM: Remove _leftShiftWithMask32.
It was used for the Javascript integer overflow warnings which were already
removed from the VM.

BUG=
R=regis@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1900863004 .
2016-04-19 19:06:53 +02:00
Regis Crelier 48bc8bbf33 Remove instantiator argument in generated code for type tests.
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1533383003 .
2015-12-21 13:07:32 -08:00
Srdjan Mitrovic 5711c13f69 Make frequent type checks (instanceof) faster by adding dedicated instanceof methods; improves dart2js startup
There is a possibility of adding intrinsics for all new instanceOf methods; my measurements did not show any benefits, therefore they were removed from this CL.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1222863003 .
2015-07-07 10:20:41 -07:00
srdjan@google.com d44423b766 Add VM internal Dart class 'ClassID' used to manage class-ids of known classes. Next CL: add constant fields corresponding to each class id (smiCid, oneByteStringCid, etc).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37567 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 20:56:55 +00:00
lrn@google.com 3b3e87cabc Revert "Rename internal library dart:_collection-dev to dart:_internal."
Dartium needs updating too.

Committed: https://code.google.com/p/dart/source/detail?r=31827

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31877 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 12:06:38 +00:00
lrn@google.com ead87f47e9 Revert "Rename internal library dart:_collection-dev to dart:_internal."
Dartium needs updating too.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31827 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 12:27:44 +00:00
lrn@google.com 0098710559 Rename internal library dart:_collection-dev to dart:_internal.
BUG= http://dartbug.com/14140
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31823 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 09:24:46 +00:00
regis@google.com 06830dbbd2 Use a trail instead of a mark bit when processing recursive types in the VM
(issue 15595).

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31584 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-07 21:55:07 +00:00
fschneider@google.com 9031c80c88 Change == into an instance call to allow polymorphic inlining of ==.
In unoptimized code equality is now just another instance call.

The optimizer replaces it with a specialized implementation based on static
 type information and type feedback.

Many of the manual optimizations of == in the optimizer are now just handled
 by the generic inliner, plus polymorphic inlining of == calls is now possible.
This also eliminates the need for a lot of duplicated code in the backend.

I adapted the inlining heuristics to compensate for the slightly larger
inital flow graph size.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29800 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-04 11:32:52 +00:00
lrn@google.com c03e58cd99 Add Object.hashCodeOf to get the default hashCode of an object.
BUG= http://dartbug.com/13404
R=floitsch@google.com, iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27865 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 08:15:41 +00:00
rmacnak@google.com 8bdc9b5696 Cleanup making Null a public class of dart:core in the VM. Remove special cases for Null in lookup and compile-time type tests.
BUG=http://dartbug.com/12364
R=asiva@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26205 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-15 18:34:23 +00:00
srdjan@google.com 1f31dcc424 Fix for running with --throw_on_javascript_int_overflow: recognize pattern (a << b) & mask and test for overflow only after the mask.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26122 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 15:12:39 +00:00
iposva@google.com 56b0fc10a7 Reland r24563 and r24564 with fixes cumbersome API leading to leaks.
- Add a WeakTable to the VM. This is used to remember the
  native peers registered through the Dart C API as well
  as assigning identity hashcodes to objects when needed.
- Use the hashcode to lookup entries in the Expando.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24822 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-08 21:41:05 +00:00
iposva@google.com fb06bcdff3 - Revert r24564 and r24563 due to unexplained malloc corruption.
Review URL: https://codereview.chromium.org//18051007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24565 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 00:27:25 +00:00
iposva@google.com 9c9989d2f6 - Add a WeakTable to the VM. This is used to remember the
native peers registered through the Dart C API as well
  as assigning identity hashcodes to objects when needed.
- Use the hashcode to lookup entries in the Expando.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24563 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 00:01:47 +00:00
srdjan@google.com 7797d39362 Added Object._cid getter, optimized it. Added to (some) classes a static final _clCid. Use those to test for exact type in VM's libraries.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22695 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-14 18:16:44 +00:00
ahe@google.com 89be2ccac8 Change memberName and namedArguments in Invocation to use Symbol.
Review URL: https://codereview.chromium.org//14066019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21602 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-17 07:54:48 +00:00
ahe@google.com 5b6c0ba820 Rename InvocationMirror to Invocation.
Review URL: https://codereview.chromium.org//14049009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21465 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 15:42:44 +00:00
srdjan@google.com 60e57ecfe1 Optimizes 'as' operation in similar way as 'instanceof': collect type feedback in unoptimized mode and try to convert it to a simple classcheck in optimized code.
Review URL: https://codereview.chromium.org//13190014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20783 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-02 15:30:14 +00:00
iposva@google.com c900112af7 - Improve the message for NoSuchMethodErrors that are
determined statically at compile time.
Review URL: https://codereview.chromium.org//12328019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18848 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 18:53:27 +00:00
iposva@google.com 2d8c51d0f4 Fix bug 5511:
- null must support hashCode.
Review URL: https://codereview.chromium.org//11819014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16827 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-08 23:58:55 +00:00
srdjan@google.com 29e06db609 In unoptimized code use call for instanceof instead of inlined checks. This allows us to collect type feedback and to reduce the code size of unoptimized code. Next will be work on type tests as well.
Review URL: https://codereview.chromium.org//11694003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16589 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-02 22:22:39 +00:00
regis@google.com 3b1dfe51d1 Pass the proper invocation mirror argument to noSuchMethod.
Review URL: https://codereview.chromium.org//11523002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15939 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-11 00:31:53 +00:00
lrn@google.com a8720a6d9c Change signature of noSuchMethod to take an InvocationMirror.
Requires VM and dart2js/dart2dart changes to work.

Committed: https://code.google.com/p/dart/source/detail?r=14198

Committed: https://code.google.com/p/dart/source/detail?r=14254

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14324 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-31 10:32:54 +00:00
lrn@google.com 895d155ab1 Revert "Change signature of noSuchMethod to take an InvocationMirror."
TBR=ager@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14260 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 10:47:42 +00:00
lrn@google.com 4a24ddc1d4 Change signature of noSuchMethod to take an InvocationMirror.
Requires VM and dart2js/dart2dart changes to work.

Committed: https://code.google.com/p/dart/source/detail?r=14198

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14254 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 10:04:12 +00:00