Commit Graph

2925 Commits

Author SHA1 Message Date
Srdjan Mitrovic ad6d0bc8a8 Fix a crash in debugger, add flag --stress-test-background-compilation, add asserts.
Fix a crash in debugger: in background compilation check if the function is still marked as optimizable; setting breakpoints at runtime can change that.

Add flag --stress-test-background-compilation which re-feeds compiled functions into the compilation queue.

Add various asserts related to background compilation.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1884213004 .
2016-04-15 12:12:35 -07:00
Siva Annamalai 8ce7b6291a Revert "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linear list and search for canonical instances."
This reverts commit 95a2b02a9e.

Once the tree shaker in precompiled code is fixed to treat the constants array in a class as a hash table this CL can be re-applied.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1888593003 .
2016-04-13 18:49:53 -07:00
Srdjan Mitrovic 8a1072e3e6 Fix background compilation disassembly: allocate string in old space instead of new space.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1889603003 .
2016-04-13 13:48:37 -07:00
Siva Annamalai 5491e7caa4 Fix build.
Review URL: https://codereview.chromium.org/1889583002 .
2016-04-13 11:43:52 -07:00
Siva Annamalai 95a2b02a9e - Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linear list and search for canonical instances.
- Some minor cleanups
  - Return an empty array right away in the parser instead of creating an
    empty array and canonicalizing it
  - The canonical bit was not being set for some of the singleton objects.

R=regis@google.com

Review URL: https://codereview.chromium.org/1873143003 .
2016-04-13 10:26:17 -07:00
Regis Crelier b8bcb5587b Properly handle unfinalized type parameters of generic mixins (fixes #26230).
Finalize upper bounds of unfinalized classes earlier in order to reduce the
number of BoundedType allocations.
Add regression test.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1886633002 .
2016-04-13 10:04:53 -07:00
Siva Annamalai fc3156db11 Add usage and collision details to the hash table data structure in order to determine effectiveness of the hash function.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1882763002 .
2016-04-13 09:08:52 -07:00
Siva Annamalai 5828e3eb6f Provide a mechanism for naming a hash table so that it can be used in DumpStats to identify the table.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1873283003 .
2016-04-12 13:38:08 -07:00
Ivan Posva 5be5d54529 - Refactor Symbol allocation to expect a thread parameter.
- Preallocate all tokens as symbols to avoid repeated lookups.
- Pass thread/zone where useful while doing this change.
- Avoid allocating symbols for error messages.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1870343002 .
2016-04-11 16:28:29 -07:00
Srdjan Mitrovic cb63ed46fe Invalidate background compilation only if relevant fields were invalidated.
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1877973002 .
2016-04-11 15:34:59 -07:00
Matthias Hausner 425b9a36b9 Use symbols when looking up fields in a class
The slow string comparison is only necessary when looking up
non-symbols or untangled private names.

Compiling all of dart2js seems to be about 1% faster, but it's really in the noise.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1868803002 .
2016-04-07 16:36:35 -07:00
Ivan Posva c434931517 - Remove --coverage_dir flag and old-style coverage service requests.
BUG=

Review URL: https://codereview.chromium.org/1846443002 .
2016-04-07 16:24:49 -07:00
Ryan Macnak 34e4107c0d Add flag to disable string externalization, allowing the compiler to rely on string class checks remaining valid across calls.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1859273002 .
2016-04-07 13:24:44 -07:00
Siva Annamalai 95f37e03af Minor cleanup.
R=hausner@google.com

Review URL: https://codereview.chromium.org/1868783002 .
2016-04-06 16:03:28 -07:00
Siva Annamalai 07d0c715ff - Restructure Canonicalization of instances in preparation for adding a
HashMap to store the Canonical constants of Instances/Arrays. The goal is
  to continue to use an array for Numbers (Mint, Bigint, Double) and use a
  HashMap for other Instances/Arrays.

- Check first for the array length and elements being same before checking
  if the TypeArguments are equivalent

- Removed some unused code

R=regis@google.com

Review URL: https://codereview.chromium.org/1866713003 .
2016-04-06 15:47:42 -07:00
Srdjan Mitrovic 3d23c82d94 Fixes crashes in inliner: do not inline if icdata was cleared. Add some asserts.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1863733004 .
2016-04-06 14:43:56 -07:00
Srdjan Mitrovic cef337f8c7 Add instruction tags to saved ICData (debug mode only).
When restoring ICData in optimizing compiler, we can verify that the ICData/deopt-id matches an instruction. This should help catch non-deterministic graph generation.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1864143002 .
2016-04-06 11:01:46 -07:00
Srdjan Mitrovic c87181af57 Fix detection if a function was compiled,
Background compilation requires that a function was run through parser in mutator thread at least once. Because snapshots can/could preload ICData and code they are not reliable signals if the function was compiled or not. Add a bit to function object.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1857273002 .
2016-04-05 13:32:14 -07:00
Srdjan Mitrovic 706ea55404 Fix background compilation issues when creating snapshots.
- Stop background compilation early enough
- Restore symbol table after completing snapshot writing.
- Create symbols instead fo strinfs (error caught with --no-use_lib_cache)

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1852393004 .
2016-04-04 16:40:46 -07:00
Ryan Macnak 87e8bc2c96 VM: Evaluate-in-frame should happen in the scope of the method class, not the receiver class.
BUG=http://dartbug.com/26161
R=hausner@google.com

Review URL: https://codereview.chromium.org/1854243002 .
2016-04-04 15:22:57 -07:00
Siva Annamalai 78a6b46155 Provide ability to patch external functions in a class that has already been finalized. The following restrictions are in place:
- No new fields or patching of existing fields can be done
 - Only external methods that have not already executed (i.e code for it has been   generated) can be patched

This change enables patching of JS Interop methods into a class and provides close to 5 sec drop in start up times for Green Tea app.

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

Review URL: https://codereview.chromium.org/1850653003 .
2016-03-31 20:06:44 -07:00
Ryan Macnak e228e78264 Precompilation: Don't look at embedder allocated pages when finalizing the VM isolate.
On precompiled Space Blast on an iTouch 6, reduces finalizing the vm isolate from 60ms to <1 ms, but loading the isolate snapshot doesn't happen any sooner.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1834333002 .
2016-03-29 16:49:33 -07:00
Srdjan Mitrovic 40d8eee81e Remove unnecessary isolate argument from some visitors
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1838373002 .
2016-03-29 14:47:51 -07:00
Ryan Macnak f0d4f3151c Precompilation:
- Fix crash sending full class responses.
  - Don't wait for service isolate startup.
  - Add timeline events for deserializing and premarking the VM isolate.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1835633002 .
2016-03-29 12:30:47 -07:00
Ryan Macnak b2f3e8efe1 Precompilation: don't include an object header for instructions in the text section.
Reference Instructions only through Code::entry_point_ (or Function::entry_point_). Store the instructions size in its corresponding Code object.

precompiled dart2js x64 22163470 -> 21621102 (-2.45%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1808553002 .
2016-03-29 11:04:04 -07:00
Srdjan Mitrovic 7ed2b851a9 Enable export lookup by two threads (mutator and background compiler) by carying a copy of exports_ in exports2_.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1839123002 .
2016-03-29 10:56:56 -07:00
Srdjan Mitrovic f60e86fd83 Track loading happening in parallel with background compilation and abort compilation if necessary.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1834763004 .
2016-03-28 16:02:32 -07:00
Srdjan Mitrovic 8fb38ee2b4 Be more vigilant with deferred loading.
Abort background compilation if deferred loading occurs during parsing, since the code generated would not match the saved ICData (deopt-id assignments change, since LibraryPrefix.is_loaded changes in mutator thread while compiling in background)

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1830283002 .
2016-03-24 11:27:08 -07:00
Srdjan Mitrovic 389dad87f7 Fix stub frame walking: when materializing the frame content during deoptimization, the stack is not yet set up properly (missing code object). This happens when background compiler requires GC.
Revert fixes other crashes in stack walk.
Revert "Reapply "Remove Code::active_instructions_.""

This reverts commit 28846c4bd4.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1830733002 .
2016-03-23 14:43:02 -07:00
John McCutchan e389ab73d3 Speedup function profile by using a hash table instead of a linear scan
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org/1830473002 .
2016-03-23 12:35:57 -07:00
Matthias Hausner 07a52f6711 Fix name resolution through re-exported libraries
Make sure a re-exported setter is resolved even when no corresponding
getter exists.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1824213002 .
2016-03-22 16:27:16 -07:00
Srdjan Mitrovic f360e1a2b6 Fix background compilation: handle compilation abort during parsing. Abort background compilation if finalization is necessary.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1821283002 .
2016-03-22 13:42:54 -07:00
Ryan Macnak 28846c4bd4 Reapply "Remove Code::active_instructions_."
Was reverted because it altered timing and saw a profile tick during
deoptimization, fixed in 7e9c892435.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1820333002 .
2016-03-22 10:16:13 -07:00
Ryan Macnak b070d98f6e Simpler regex names:
C++ JSRegExp -> RegExp
  Dart _JSSyntaxRegExp -> _RegExp
  Function RegExp.:irregexp: pattern -> RegExp.:matcher: pattern

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1815333002 .
2016-03-21 17:21:05 -07:00
Regis Crelier 966aea003b Remove recently introduced FunctionType vm class by merging it into class Type.
Fix syntax used when printing function type with optional named parameters.
Fix several issues discovered with cloning function types.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1815733003 .
2016-03-21 14:08:57 -07:00
Ryan Macnak d3901a3fa1 Revert "Remove Code::active_instructions_."
This reverts commit 714027a81b.

Review URL: https://codereview.chromium.org/1821793002 .
2016-03-21 13:06:46 -07:00
Ryan Macnak 714027a81b Remove Code::active_instructions_.
It is only used to test if the Code has been disabled, and we can instead test if the active entry point matches the Instruction's entry point. A Code's entry point is either for its own Instructions or Instructions of stub code in the VM isolate, so we don't need this field to keep the Instructions alive.

precompiled dart2js x64 22254552 -> 22165795 (-0.39%)

BUG=http://dartbug.com/25992
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1814623003 .
2016-03-21 10:53:31 -07:00
Florian Schneider f3de2377ab Move the VM's typed_data implementation to runtime/lib.
This removes the additional indirection to the VM's implementation
for all the factory constructors.

Additionally, it removes one class per typed data list type, thus reducing
snapshot and generated code size.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1790593002 .
2016-03-21 13:39:49 +01:00
Siva Annamalai c110b6f355 Map typed data class back to the original names, we need to do this as we do not have type objects set up for these. The cost of adding type objects in each of these dart classes would be more expensive than the simple switch statement here.
R=regis@google.com

Review URL: https://codereview.chromium.org/1814233004 .
2016-03-18 15:03:42 -07:00
Ryan Macnak aefb7a424c Precompilation: Change instance call sequence to load the entry point and Code object from the ic data array instead of loading them indirectly from the Function object loaded from the same array.
Load the Code from the ic data array instead of the ObjectPool because we still need the Code object in the frame to find stackmaps / build stacktraces / build profile results.

Keep doing things the old way until all compilation is finished because evaluation of constants still needs functional lazy compilation and the compiler works with ICData that may contain as-yet-uncompiled functions. After compilation is finished, transform all the ICData from (cid, target function, count) to (cid, target code, entry point) and switch to the ICLookup stub that works with this representation.

Golem average +3.133% on ARM, +3.544% on x64

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1799793002 .
2016-03-17 15:41:04 -07:00
Ryan Macnak 7d3c48acc5 Fail gracefully in Script::GetLine under precompilation like Script::GetSnippet.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1810663002 .
2016-03-16 12:26:02 -07:00
John McCutchan c65114b6b4 Timeline API fixes for Flutter
API changes:

- Remove isolate specific Timeline APIs.
- Remove Dart_EmbedderTimelineGetTimeline callback.
- Add Dart_TimelineEvent so that arbitrary trace events can be added.

Internal changes:

- Remove isolate specific streams which were never used or controllable from outside the VM.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1811613002 .
2016-03-16 12:18:46 -07:00
Regis Crelier ea7929d2fb Ignore bounds in compile time type tests, since they will have been checked at
run time (fixes issue 25935).
Add regression test.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1780333002 .
2016-03-10 14:22:44 -08:00
Regis Crelier ba69c8a898 Enumerate URIs of all types in type errors in order to help the user diagnose
the error (it was previously only printed for types with identical names).
Cleanup and simplify construction of type errors.

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

Review URL: https://codereview.chromium.org/1778133002 .
2016-03-09 15:16:47 -08:00
Matthias Hausner 5db2c56b5b Fix crash when setting breakpoint in Observatory
Fix bug in code that determines end token pos of classes, handle
typedef classes correctly.

BUG=25880
R=floitsch@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1767113007 .
2016-03-09 08:55:54 -08:00
Matthias Hausner 3107a41bb7 Fix context level info in for-loops
The stack overflow check on the back-branch of the loop must
be at the same context level as the (outer) loop block of
the for-loop.

Before this change, the stack check was recorded to be at a
token position that is outside of the loop block, which caused
a context mismatch on some stack traces when the debugger
or the observatory interrupted the isolate on that back
branch.

It is not practical to write a test for this, unfortunately.

BUG=25684
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1768763002 .
2016-03-04 16:37:03 -08:00
Florian Schneider 72a815c39f VM: Add smi fast path operations for precompiled code
The non-smi case is handled in a slow-path deferred code path.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1756403002 .
2016-03-04 09:33:09 -08:00
Florian Schneider 48b0183926 Make precompiler work with product mode.
For now, change compilation-related flags to be regular
command line options. They won't affect the size of the
precompiled runtime anyway since the compiler is not included
there.

Also introduce a separate switch for precompiled runtime. This can be
 used instead of the macro since it is a compile-time constant in the
 precompiled runtime.

BUG=

Review URL: https://codereview.chromium.org/1759913002 .
2016-03-02 13:59:54 -08:00
Srdjan Mitrovic 4128c31916 Add thread safe constant canonicalization.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1754813004 .
2016-03-02 12:12:48 -08:00
John McCutchan 58e0ef13fa Add source position information to profile
- Fix bug in inlined call token positios.
- Add ProfileFunctionSourcePosition for tracking source positions within functions.
- Keep a list of ProfileFunctionSourcePosition in each function.
- Add unit test helper functions.
- Add unoptimized unit tests that verify source positions in function profiles.
- Add optimized/inlined unit tests that verify source positions in function profiles.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1758653003 .
2016-03-02 12:02:28 -08:00