Commit Graph

2008 Commits

Author SHA1 Message Date
Florian Schneider ab4490e5bf VM: Remove collection of unused range feedback.
We can always put it back if the optimizer makes use of it.
It's a lot of extra code that is unused. Therefore, remove it for now.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2132933003 .
2016-07-11 06:46:50 -07:00
Ryan Macnak d75699e863 Make core snapshots word-size portable again.
Flutter creates a single core snapshot (from x64) that is used by both sky_snapshot (x64) and the engine (arm).

R=asiva@google.com

Review URL: https://codereview.chromium.org/2132833002 .
2016-07-08 14:18:44 -07:00
Siva Annamalai 4a214e50e9 Add NosafepointScope and remove comment.
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2121383003 .
2016-07-07 10:01:32 -07:00
Siva Annamalai 006bab2c47 Land Ivan's change of 'Remove support for verified memory handling'
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2112043002 .
2016-07-01 09:21:01 -07: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
John McCutchan c0eb4d9dc0 Remember inside an ICData if it is for a static call or an instance call
- [x] Add an is static call bit to ICData
- [x] Rewrite the reset ICData iterators to rely on that bit rather than the function's ic data map

BUG=

Review URL: https://codereview.chromium.org/2064693003 .
2016-06-13 13:23:57 -07:00
John McCutchan 77e0e96b5f Revert "Remember inside an ICData if it is for a static call or an instance call"
I accidentally committed an old version of this CL.

This reverts commit 9256d49af5.

BUG=

Review URL: https://codereview.chromium.org/2062983002 .
2016-06-13 13:19:38 -07:00
John McCutchan 9256d49af5 Remember inside an ICData if it is for a static call or an instance call
- [x] Add an is static call bit to ICData
- [x] Rewrite the reset ICData iterators to rely on that bit rather than the function's ic data map

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2044423003 .
2016-06-13 13:09:48 -07:00
Ryan Macnak 3f8c0bb0a9 Don't overload FreeListElement for become.
R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2026643004 .
2016-06-02 10:57:34 -07:00
Ryan Macnak 4aaf810d25 Add --dump-megamorphic-stats. Lower megamorphic cache load factor to 50%.
R=iposva@google.com

Review URL: https://codereview.chromium.org/2007233002 .
2016-05-25 14:03:27 -07:00
Ivan Posva 5295e99d27 - Removed the kWatchedBit and the associated weak property handling
code from the GCs.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2001713002 .
2016-05-24 13:22:49 -07:00
Vyacheslav Egorov 65f2e015ca VM: Fix race between background compiler and guarded cid update.
Rework how we check guarded state consistency in background compiler.

Background compiler was storing original fields inside guarded fields list. This caused a race during inlining when inliner would copy guarded fields one by one from the callee function into the caller, because ParsedFunction::AddToGuardedFields looks at the guarded_cid to filter out those fields that should not be guarded.

As a result if some guarded field transitioned to unguarded (kDynamicCid) after callee graph construction but before list of guarded fields were copied then AddToGuardedFields would simply skip that field because it now has guarded_cid() == kDynamicCid.

We fix this race by always placing copies into the list of guarded fields and unwrapping them only in FinalizeCode.

Placing the copies also allows us to simplify a lot of code that was trying to verify guarded state consistency before committing the generated optimized code - now that we store copies in the list we can just compare their state to the originals and abort if the state is different.

Additionally fix deduplication check that was comparing original fields with copies - resulting in adding the same field into the list multiple times.

Add an assertion that verifies that we are not trying to access guarded_cid of original field from background compiler.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2006793002 .
2016-05-24 14:52:02 +02:00
Ryan Macnak 4d48c341bf Include multiplication in the megamorphic cache hash to avoid cid ranges overlapping modulo table size from causing large displacements.
CompileOnceHelloHtml +7.115% x64
Dart2JSCompileAll +1.363% x64

R=iposva@google.com

Review URL: https://codereview.chromium.org/1998263002 .
2016-05-20 10:41:41 -07:00
John McCutchan 2918c91e5f Attempt to fix the linker issues by wrapping the template call with a helper
BUG=

Review URL: https://codereview.chromium.org/1990613002 .
2016-05-17 14:37:29 -07:00
Siva Annamalai 5de775a823 - Canonicalize generic types in a global isolate hash
table, this ensures that we do not linearly walk through
  a large type list in the class calling the expensive
  'Type::Equals' method (some applications have close to
  1304 generic types in them)

- Use the stand hash table implementation for TypeArguments
  canonicalization instead of a custom hash table

R=johnmccutchan@google.com, regis@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1965493004 .
2016-05-17 14:35:23 -07:00
John McCutchan 48c8ffa7f3 Initial isolate reload support
This is a cut of the work that Todd and I collaborated on in the reload branch.

In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.

- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1965823002 .
2016-05-17 12:19:06 -07:00
Matthias Hausner 68a6060794 Eliminate GrowableTokenStream
Eliminate building an intermediate array of tokens in the scanner. Build
the compressed TokenStream directly instead.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1969563002 .
2016-05-11 14:09:45 -07:00
Matthias Hausner 444665465c Small fix in Scanner
Use intptr_t instead of TokenPosition to denote the index of
a token in the token stream.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1968143002 .
2016-05-11 10:49:40 -07:00
Ivan Posva b2ac279269 - Use a map to lookup libraries by URL.
- Ensure the uniqueness of private keys without having to
  search the existing key space.
- Pass a thread parameter where useful to library methods.

BUG=

Review URL: https://codereview.chromium.org/1947393003 .
2016-05-05 10:42:28 -07:00
Siva Annamalai 95904322e7 Minor cleanup based on profiler output of CompileParseFunction.
- Add a zone parameter to TokenStream::Iterator
- Add IsXXXX() functions in raw_object.h using GetClassId()
- Modify
    - Function::owner
    - Function::origin
    - Type::IsMalformed
    - Type::IsMalbounded
    - Type::error
  to not create a Handle in the common path

R=regis@google.com

Review URL: https://codereview.chromium.org/1952023002 .
2016-05-04 15:30:56 -07:00
Regis Crelier 5294523c20 More efficient identification of dynamic and void types.
R=asiva@google.com

Review URL: https://codereview.chromium.org/1947753002 .
2016-05-03 16:08:37 -07:00
Ryan Macnak f7a3e215a5 Undo "Don't include an object header for instructions in the text section."
This undoes most of b2f3e8efe1.

This optimization prevents precompiled code from being disabled and re-enabled, because disabling causes the code to lose its only reference to its own instructions. This was okay for precompilated code that ran without a JIT because it is never disabled, but precompiled code that runs in a JIT will become disabled when corresponding optimized code is compiled and re-abled after a deopt.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1925153003 .
2016-05-03 11:22:28 -07:00
Siva Annamalai 65c4aaee17 - Add a new constructor to the hash table classes that allow handles to be passed in instead of creating new ones for every lookup/insertion
- Use reusable handles in Symbols::New and Symbols::Lookup with the new constructor defined above

R=hausner@google.com

Review URL: https://codereview.chromium.org/1934263003 .
2016-05-02 17:07:31 -07:00
Siva Annamalai d5583d6a79 Use a reusable handle in SubString instead of creating one as this path is now used when creating Symbols of identifiers.
R=hausner@google.com

Review URL: https://codereview.chromium.org/1933933002 .
2016-04-29 14:53:07 -07:00
Ryan Macnak 1995651559 Don't include dependent code arrays in snapshots.
Full snapshots never include code that can deopt.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1930263002 .
2016-04-29 14:48:12 -07:00
Srdjan Mitrovic 4ea8b39157 Added flag --inline_smi_string_hashcode and --inline_smi_string_hashcode_ratio to decide when/if should Smi/OnebyteString hashcode be inlined before calling megamorphic. Improve code as suggested by zra.
Added flag --display_sorted_ic_data which displays ICData as sorted by count, unary ICData (e.g., in disassembly).

BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1920103004 .
2016-04-27 13:27:43 -07:00
Matthias Hausner b4ac99a412 Add per-library cache of exported names
Speeds up name resolution of code that uses extensive
“exports” clauses. The pathological example in the bug report
compiles about 50 times faster.

Introduces a trail of visited libraries to detect cycles when following the exports directives. This works better with the background compiler.

BUG= 26145

Review URL: https://codereview.chromium.org/1902563002 .
2016-04-19 09:10:46 -07:00
Ryan Macnak f731dd0615 Reapply "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linear list and search for canonical instances."
- Rehash constants table during tree-shaking.
 - Rehash constants table on snapshot load.

R=regis@google.com

Review URL: https://codereview.chromium.org/1900863002 .
2016-04-18 16:46:26 -07:00
Vyacheslav Egorov ee0f608ce4 Dart Byte Code interpreter.
This version is Clang/GCC only and does not support Windows because it uses computed goto's.

Only unoptimized mode is supported.

Architecture is described in constants_dbc.h and stack_frame_dbc.h.

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

Review URL: https://codereview.chromium.org/1858283002 .
2016-04-18 23:02:01 +02: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
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
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
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
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 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
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
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
Srdjan Mitrovic 7b86508143 Fix bug with exports2()
BUG=

Review URL: https://codereview.chromium.org/1838303003 .
2016-03-29 12:50:41 -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 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
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