Commit Graph

901 Commits

Author SHA1 Message Date
Florian Schneider f0a35b3260 VM: Add dart_precompiled build target, a standalone VM without the JIT compiler.
This removes most of the compiler-related code from dart_precompiled:
x64 stripped binary size 13M -> 9.1M
ARM stripped binary size 12M -> 8.3M

The precompiled build defines the DART_PRECOMPILED macro. This
stubs out the public interface to the compiler/parser with empty
function bodies.

Use gcc options -ffunction-sections and --gc-sections to make the linker remove
unused functions/symbols.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1459443002 .
2015-11-19 10:13:16 +01:00
Matthias Hausner 648e52baa8 Collect closure functions in isolate
Instead of collecting closures functions in each class object, maintain one list per isolate. This is a step towards getting rid of top-level classes.

I'd appreciate if John could take a look at the service isolate and coverage related change.

I'd appreciate if Ryan could take a look at the precompilation related change.

When compiling all of corelib, the list of closures in the isolate is about 600 entries long. If this linear list should become a bottleneck, I'll deal with it later. (Sadly, some code relies on the fact that a closure can be identified with a list index, so making it a hash table instead of an array does not work.)

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1436243005 .
2015-11-17 15:40:27 -08:00
Ryan Macnak 8be0d4aca1 Save the native name on the function instead of finding it in the token stream to resolve lazily-linked natives. Drop token streams from precompiled snapshots.
dart2js ARM -7.0% size

Before
VMIsolate(CodeSize): 4663679
Isolate(CodeSize): 11970519
Instructions(CodeSize): 12904384
Total(CodeSize): 29538582

After
VMIsolate(CodeSize): 2611555
Isolate(CodeSize): 11965825
Instructions(CodeSize): 12906464
Total(CodeSize): 27483844

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1412633007 .
2015-11-12 17:24:42 -08:00
Srdjan Mitrovic c4aee38224 Pass type argument to Field construction, thus freezing that field, denoting it cannot be changed later.
BUG=
R=regis@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1406943006 .
2015-11-09 13:54:57 -08:00
Srdjan Mitrovic 9dcd1fd076 Background compilation fixes
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1426513006 .
2015-11-05 09:53:13 -08:00
Srdjan Mitrovic 181e8cc2a9 Move resolving of natives to a late stage (during code emission). That eliminates unnecessary native resolution (e.g., when native gets recognized or rejected in the inliner). Removed tests that are now impossible to implement with AST (fake native functions).
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1420173006 .
2015-11-03 16:18:24 -08:00
Florian Schneider 598018bd21 VM: Fix bug with ??= expressions using await.
Moving the construction of ?? into the parser using LetNode, so that the await-transformations are properly applied.

a ?? b becomes { temp = a; temp !== null ? temp : b; }

a ??= b becomes { temp = a; temp != null ? temp : a = b; }

BUG=issue #24392
R=hausner@google.com

Review URL: https://codereview.chromium.org/1417733007 .
2015-11-03 21:47:06 +01:00
Srdjan Mitrovic 8e27f43f36 Allocate some data structures in old instead of in new space. Early inlining bailout for native functions. Verify heap after background compiler was shutdown.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1433463002 .
2015-11-02 16:39:22 -08:00
Matthias Hausner f094c36141 Constant cache improvement
Change the compile-time constant map to use a pair (url, token_pos) as
the key. Previously, the two values were concatenated into a string, which creates a lot of new strings.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1424393002 .
2015-11-02 10:59:19 -08:00
Siva Annamalai 99abe7d883 - Some cleanup of dynamic_type usage.
- Avoid egregious creation of handles in Class::CreateInvocationDispatcher

R=regis@google.com

Review URL: https://codereview.chromium.org/1409113006 .
2015-10-21 17:24:10 -07:00
Florian Schneider 9a0b13fe86 VM: Replace CheckedHandle with Cast/Handle in some places.
CheckedHandle are only when entering C++ from native code,
or when calling out via the API.

Otherwise Cast and Object::Handle is sufficient.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1376183002 .
2015-10-21 16:54:50 +02:00
Srdjan Mitrovic b9426418d8 Get rid of deprecated methods accessing mutator_thread_ instead of current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1410643008 .
2015-10-20 10:26:08 -07:00
Srdjan Mitrovic 8915fb6fde More work for background compilation; move pending_functions_ from ObjectStore to Thread.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1409173002 .
2015-10-16 17:02:43 -07:00
Ryan Macnak b56991878f Fix Enum.toString when enum type is private.
R=hausner@google.com

Review URL: https://codereview.chromium.org/1398843008 .
2015-10-15 11:28:13 -07:00
Florian Schneider 7fe1e05826 VM: Precompile method extractors for implicit and explicit closurization.
Also, avoid creating duplicate method extractors with explicit closurization:
Before the compiler would create one extractor per site when using the explicit
#-closurization operator.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1404163002 .
2015-10-15 12:27:23 +02:00
Matthias Hausner 45034b7626 Eliminate RawClass::patch_class_ field
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1407533005 .
2015-10-14 14:52:14 -07:00
Srdjan Mitrovic 8d618766a8 Remove isolate argument from handle allocation: Part II
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1389353004 .
2015-10-12 14:06:50 -07:00
Matthias Hausner 019a4e4e5c Add flag which moves super initializer statement
--move_super directs the VM compiler to move the super initializer
of a constructor to the end of the initializer list. The default
value is false. If we opt to enable this functionality, the implicit
phase parameter of constructors can be eliminated, simplifying
constructors significantly.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1382533003 .
2015-10-07 10:26:22 -07:00
Regis Crelier 451eaab718 Remove --supermixin flag from VM.
Update tests and test status files.

Fixes #24479.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1383923002 .
2015-10-01 18:04:31 -07:00
Matthias Hausner 4995b84051 Remove obsolete timer list from VM
The functionality is now covered with TimeLine and CompilerStats

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1375343002 .
2015-09-30 12:47:23 -07:00
Srdjan Mitrovic d867784de5 Cleanups and preemptively pass Heap::kOld whenever subtype testing in compiler
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1377453005 .
2015-09-29 11:05:54 -07:00
Ryan Macnak fcdd855859 Precompile invoke-field-dispatchers for closures.
Improves precompiled DeltaBlueClosures by 8.6x and increases
instructions size by 0.05% (0.0005) on ARM.

R=fschneider@google.com

Review URL: https://codereview.chromium.org//1371453002 .
2015-09-24 17:19:37 -07:00
Rico Wind 2e22f41612 This is a fixed up version of:
https://codereview.chromium.org/1305183010/

- Reorder the priority of flags in the test harness when passed to the VM:
  default flags, file flags, command line flags
- Ensure to not enable assertions when not being requested.

Peter, any reason to not move the flags in to the
configuration file?  Why don't we actually have all of them in there? (not
that I want to move them, I am just currious why we don't add them in
there, it seems more logical to me)

BUG=
R=iposva@google.com, whesse@google.com

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

Review URL: https://codereview.chromium.org//1330643003 .
2015-09-14 07:58:18 +02:00
Rico Wind 02320ff26e Revert "This is a fixed up version of:"
This reverts commit dd7767d95e.

This made the analyzer fail:
http://build.chromium.org/p/client.dart/builders/analyzer_experimental-linux-release-be/builds/3418/

Please note that this is just not the new test (which I would just have
suppressed)
It seems that in --checked --host-checked mode we see a range of new
failures, because of the change to flags.

It also made dart2js fail on the new tests

Ivan: Will you look into this with the analyzer people?

R=iposva@google.com
BUG=

Review URL: https://codereview.chromium.org//1308743006 .
2015-09-07 08:41:46 +02:00
Rico Wind dd7767d95e This is a fixed up version of:
https://codereview.chromium.org/1305183010/

- Reorder the priority of flags in the test harness when passed to the VM:
  default flags, file flags, command line flags
- Ensure to not enable assertions when not being requested.

Peter, any reason to not move the flags in to the
configuration file?  Why don't we actually have all of them in there? (not
that I want to move them, I am just currious why we don't add them in
there, it seems more logical to me)

BUG=
R=iposva@google.com, whesse@google.com

Review URL: https://codereview.chromium.org//1330643003 .
2015-09-07 07:44:41 +02:00
Srdjan Mitrovic cba48a6ab6 More cleanups for background compilation.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1325373004 .
2015-09-06 11:10:48 -07:00
Matthias Hausner 6fad437e5c BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1327003003 .
2015-09-04 19:39:21 -07:00
Matthias Hausner d3a2f619bb Fix compiler stats
Prints the stats into a zone-allocated string that can either be dumped to the console, or displayed as a whole in the observatory.

Distinguish token consumption between class parsing and function parsing when compiling.

Change stat counter macros use thread instead of isolate.

Review URL: https://codereview.chromium.org//1300033002 .
2015-09-04 13:13:56 -07:00
Siva Annamalai 79ef28317f Changes to prepare for allowing script snapshots to be taken after running the main application:
- Rename accessors of class Field to make it more apparent as to what is being accessed (static field values or instance field offsets
- Use precompiled initializer state (Used only during precompilation) to also store saved initial value of static fields (Used only during application snapshot   generation)

BUG=
R=hausner@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//1289643005 .
2015-09-04 11:03:46 -07:00
Srdjan Mitrovic 771f2dfb52 Symbols::NewFormatted and old space allocation.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1322973006 .
2015-09-04 10:59:28 -07:00
Matthias Hausner d0f408811e Cache more constants
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1311393010 .
2015-09-03 16:32:58 -07:00
Srdjan Mitrovic d4365bc6f4 Lookup getter/setter symbols before alllocating them, thus eliminating extra String allocations in new space.
Various old space allocations, cleanups.
Add a test for Symbols concatenation.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1320673012 .
2015-09-03 14:09:34 -07:00
Matthias Hausner 9a79cbd78e Eliminate LocalVarDescriptors in some corner cases
Fix initializing functions so they can be recompiled if
var descriptors are needed for a stack trace.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1317753004 .
2015-09-03 13:55:03 -07:00
Regis Crelier 1abc4ce8e9 Reduce the number of captured variables in async code, by only capturing local
variables that are in scope at each await location.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1308163006 .
2015-09-02 18:29:32 -07:00
Srdjan Mitrovic 0094f0a76f More cleanups in compiler (remove allocation in new space).
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1314363003 .
2015-09-02 16:03:24 -07:00
Srdjan Mitrovic 7fb555045a Remove allocation in old space ....
Eliminate need for GrowableObjectArray, allocate constants in old space.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1305223006 .
2015-09-02 08:59:33 -07:00
Matthias Hausner f286b5b8b6 Moar constant caching
Insert all compile-time constants expression in the constant cache.

BUG=

Review URL: https://codereview.chromium.org//1303973007 .
2015-09-01 14:42:53 -07:00
Srdjan Mitrovic 59db5010a9 More elimination of new space allocation, fix bugs in Symbols::FromConcatAll
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1322043002 .
2015-09-01 10:30:03 -07:00
Srdjan Mitrovic dd5410209f Added {Zone}GrowableHandlePtrArray types: simplifies code, makes code safer
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1312833009 .
2015-08-31 09:24:00 -07:00
Srdjan Mitrovic d732b68b8c oneee# Enter a description of the change.
Collect interfaces without GrowableObjectArray

Concat to symbol without temporary String creation

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1311693003 .
2015-08-28 08:24:17 -07:00
Regis Crelier e6225bee44 Improve async code in VM by not unnecessarily capturing parameters of async and
sync closures, thereby avoiding copy of parameters on entry.
Remove variable aliases in local scopes now that another mechanism detects
use-before-define cases. Keep aliases only for captured variables of outer
functions thereby speeding up scope lookups for all Dart code (not just async).
The next step will be to try to reduce the number of captured variables in
async code.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1317213003 .
2015-08-27 16:49:07 -07:00
Srdjan Mitrovic f857c1ba8e Remove more GrowableObjectArray usage in parser
Allocate appropriate data structures in old space from beginning

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1316373002 .
2015-08-27 13:46:32 -07:00
Matthias Hausner 62e9d05668 Introduce per-isolate cache for compile time constants
Compile-time constant values are maintained in a cache, keyed
by script and token position. When the same code is compiled
again later, e.g. by the optimizing compiler, the value is
found in the cache and does not need to be computed again.

In this version, the key is a string concatenated from the
script url and the token position. That’s probably more overhead
than we want.

Added two compiler stat counters for number of cached constants
and number of cache hits. Running dart2js to compile a hello world
program results in about 1400 cached values and 85 cache hits.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1308073005 .
2015-08-26 16:17:20 -07:00
Regis Crelier a799659bcf Use correct scope to lookup saved async context variable.
Stop inserting aliases in all intermediary scopes for explicitly captured
variables.
Use proper lookup function in async code to access async completer variable.
Add asserts verifying async variables existence.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1314993002 .
2015-08-25 15:46:17 -07:00
Srdjan Mitrovic 5985718945 Clean up default parameter computation in parser
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1316763002 .
2015-08-25 14:54:48 -07:00
Srdjan Mitrovic 304dc3486f Make default_parameter_values a ZoneGrowableArray instead of an array in new space
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1307943008 .
2015-08-24 17:22:44 -07:00
Regis Crelier 8b825b3f73 Simplify and improve canonicalization of signature types.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1311773006 .
2015-08-24 14:53:33 -07:00
Srdjan Mitrovic fcea0077cc Minor cleanup in preparation for removal of allocation in new space, and removal of an 'optimization'
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1310383002 .
2015-08-24 13:40:32 -07:00
Regis Crelier 26031ab6b0 Avoid numerous type allocations by caching the canonical type of a class, which
is used as the receiver type for non-static methods of this class, be it a
generic, non-generic, or signature class.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1309613002 .
2015-08-21 13:37:07 -07:00
Srdjan Mitrovic 2b6219fd5a Addressed review comments from previous CLs; adding more Symbols::FromConcat
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1308013002 .
2015-08-21 11:16:30 -07:00