Commit Graph

2925 Commits

Author SHA1 Message Date
Matthias Hausner d643234264 Field should not be initialized until after initializer returns
A field with an initializer expression is uninitialized until the
expression is fully evaluated. If the initializer expression reads
the field multiple times, a circular reference error must be
thrown for each time the field is read.

BUG=#27466
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2402133002 .
2016-10-07 16:31:53 -07:00
Ryan Macnak 1cba150307 Fix bad canonicalization for strings whose utf32->utf16 conversion is lossy.
Changes String::Equals(utf32) from string.AsUtf32().Equals(utf32) to string.Equals(utf32.AsUtf16()).

Fixes #27433.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2400523003 .
2016-10-06 16:16:51 -07:00
Ryan Macnak 763daa9d06 Reapply "Lazy deopt without code patching."
When throwing to a frame scheduled for lazy deopt, update the continuation pc for that frame to be the catch handler.

Weaken new assert that the deopt pc belongs to the frame's code as the deopt pc for the last eager deopt in a function lies outside the code, after the call to the deopt stub.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2392613002 .
2016-10-03 11:31:48 -07:00
Ryan Macnak 4e9a473746 Revert "Lazy deopt without code patching."
This reverts commit 6cff17c59a.

Review URL: https://codereview.chromium.org/2382953004 .
2016-09-30 18:04:58 -07:00
Ryan Macnak 6cff17c59a Lazy deopt without code patching.
Keep a side table that maps a fp back to a deopt pc.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2380403003 .
2016-09-30 16:53:29 -07:00
Ryan Macnak e1a252a017 Fix a throw returning to a frame marked for lazy deopt that captures the stacktrace.
A lazy deopt via a return needs to preserve one value (the result), but via a throw needs to preserve two values (the exception and stacktrace).

Fixes #27446.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2374273002 .
2016-09-28 16:51:45 -07:00
Florian Schneider 4bd534191a VM: Avoid allocating strings when disassembling code.
For code objects, don't allocate symbol strings when printing the disassembly.

Don't try to make disassembling work with background compilation -- instead make sure that we don't allocate on the Dart heap while disassembling.

Add NoSafepointScope around disassemble functions to assert that no allocation happens.

Also, remove some dead code from object.cc.

BUG=#27430
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2363413004 .
2016-09-27 12:43:05 -07:00
Ryan Macnak 2bc6e0a71d AOT: Add a separate switchable call state for unlinked calls.
Flutter gallery
Isolate(CodeSize): 2213525 =>
Isolate(CodeSize): 2070395 (-6.4%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2357313003 .
2016-09-26 10:34:36 -07:00
Ryan Macnak bace87bc00 AOT: Enable optimizing native functions. Removes some initialization of unused split slots.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2359393003 .
2016-09-26 09:01:58 -07:00
Siva Annamalai 12f86594ec Add --parse-all option in order to benchmark and measure the scanner/parser performance.
R=hausner@google.com

Review URL: https://codereview.chromium.org/2327693002 .
2016-09-23 15:20:39 -07:00
John McCutchan 48c6f19600 Respect setLibraryDebuggable
- [x] Mark all libraries debuggable by default
- [x] Mark all dart:_* libraries as not debuggable by default
- [x] Respect setLibraryDebuggable
- [x] Add set library debuggable test case
- [x] Do not allow dart:_* libraries to be marked debuggable

Fixes https://github.com/dart-lang/sdk/issues/27370

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2361183002 .
2016-09-23 10:45:51 -07:00
Regis Crelier b91d74172a Make sure unresolved function type parameter bounds do not end up in snapshot.
Read and write parent_level field of function type parameters in snapshots.
Update TypeParameter::ToCString() to handle function type parameters.
Address Siva's comments in previous cl.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2359543003 .
2016-09-20 13:18:01 -07:00
Florian Schneider cd05ee0c81 VM: Fix canonicalization of old-space allocated instances
Instances of objects allocated in old-space would not get canonicalized properly,
resulting in duplicates of these instances on the heap.

This can be e.g. argument descriptors allocated in the background compiler thread.

This also fixes the same issue occurring with isolate reload.

Also, add a NoSafepointScope for consistency.

BUG=#27364
R=asiva@google.com

Review URL: https://codereview.chromium.org/2351613005 .
2016-09-19 17:27:05 -07:00
Regis Crelier 11562f6874 Support generic method syntax (fixes #25869).
Function type parameters are parsed and resolved, but mapped to malformed types
(i.e. dynamic) until full support is implemented.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2349593003 .
2016-09-19 15:17:33 -07:00
Ryan Macnak 47cc06ae66 Shrink AOT snapshot size and memory usage.
- Conditionally remove fields of Code, Function and ICData that are not used in the AOT runtime.
 - Don't include RawClosureData.context_scope_ in AOT snapshots.
 - Remove parameter names not needed for method resolution.
 - Remove parameter types not needed for function type tests.
 - Deduplicate parameter name and parameter type lists.
 - Shrink and share the initial MegamorphicCache table.

Flutter gallery (IsolateSnapshotReader event)
snapshot size 2731129 -> 2199999 (-19.4%)
initial heap  7899568 -> 5433176 (-31.2%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2326483005 .
2016-09-15 15:06:42 -07:00
Ryan Macnak 3a63f4890c Fix some errors from UBSan.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2325863002 .
2016-09-09 09:28:27 -07:00
Ryan Macnak 6137d020b9 AOT: Use a cid range check when possible to implement type tests.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2314133003 .
2016-09-08 15:25:08 -07:00
Ryan Macnak 1bc2b04198 Fix bug in AOT compiler where we would propogate a result type for instances calls where the target is not known.
Interacted with cid range checks to incorrectly reduce

foo(x) => (x * 1.0) is double;

to

foo(x) { x * 1.0; return true; }

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2325753002 .
2016-09-08 14:36:28 -07:00
Florian Schneider c9e1c3dd05 VM: Compute static guarded cid for final instance fields.
Before the tree-shaking pass, iterate over final field initializers
and try to compute the static type.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2300873002 .
2016-09-06 14:59:53 -07:00
Ryan Macnak 3aa65a66d2 Assign external sizes to external strings and to external typed data created by the VM.
Observatory used to report that dart2js hello was using no external memory, but now reports 1.3MB of external memory (all token streams).

R=asiva@google.com

Review URL: https://codereview.chromium.org/2275803002 .
2016-09-01 10:56:40 -07:00
Ryan Macnak ba94427eb1 AOT: When a call goes polymorphic but has a single target, transition to a stub that does a cid range check.
Expand the range on a miss if all classes in the range have the same lookup result, otherwise transition to the stub that does a linear scan of ICData.

Because we do a depth-first sort of classes during AOT, if a call site sees only objects all inheriting the same function as the call target, the call site will be handled by this new stub.

Adjust LoadClassIdMayBeSmi on x64 to preserve the object.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2279563002 .
2016-08-31 11:12:22 -07:00
Florian Schneider bfa70e6df2 Temporary fix for OOM in precompilation with very large methods.
Bail out of load/store optimizations for very large methods because
of quadratic space usage.

BUG=#27087
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2256983002 .
2016-08-18 10:10:17 -07:00
Siva Annamalai 462204e557 Fix for issue 26519
BUG=26519
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2238163003 .
2016-08-16 14:24:08 -07:00
Ryan Macnak 366e5b3310 AOT: Optimize even large functions. Ensures all calls are optimized static calls, switchable calls or megamorphic calls.
Clear IC entries before snapshot to remove the need to relink at startup.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2246083003 .
2016-08-15 16:49:43 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
Ryan Macnak acf68a7126 Don't mark closurized natives as natives.
We used to implement implicit closures by duplicating the body, but now they perform a call to the parent function.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2237113003 .
2016-08-11 16:05:54 -07:00
Ryan Macnak 7244b5de0e Fail gracefully when attempting to evaluate against a VM internal class such a Field.
We can't evaluate against these classes because they don't have Dart source, belong to a library, etc.

Fixes #27052.

R=cbernaschina@google.com

Review URL: https://codereview.chromium.org/2237953002 .
2016-08-11 15:08:59 -07:00
Ryan Macnak 19716b351a Reset most ICs by returning to the canonical empty data arrays.
We can't do this for the binary operators because they must be writable and not shared for the fast Smi op stubs to record invocation counts.

Suspected to help avoid races, see Issue #26946.

Also remove some dead code and avoid TLS.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2217733002 .
2016-08-04 17:41:03 -07:00
Siva Annamalai 714cd8ee6b Trun on canonical objects verification after reload (still have one workaround for immutable arrays, which is related to the enum issue).
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2201473002 .
2016-08-01 17:07:43 -07:00
Todd Turnidge 1166f83bf6 Only reload libraries when they may have been modified.
We now check all of the scripts which make up a library.  If any
script is modified, then we consider that library to be modified.  We
also consider any library which imports a modified library to be
modified.  To propagate this info efficiently, we build and discard
the imported-by graph when beginning a reload.

The embedder must provide a FileModifiedCallback in order to support
the detection of modified scripts.

In order to detect changes to package: libraries, we have modified the
embedder interface to provide the resolved url when possible, so that
we don't need to re-resolve package uris when checking for reload.
This change is incompatible and all embedders will need to be updated.

We now support a "force" flag when reloading sources.  This causes all
libraries to be reloaded regardless of whether the underlying scripts
have been updated.

Closes #26919

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2186423002 .
2016-07-29 11:23:18 -07:00
Lars Bak 293c6116e9 Implemented schema change for the isolate reload operation.
I'll add more tests to isolate_reload_test.cc while waiting for the first round of comments.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2179983002 .
2016-07-26 11:13:28 -07:00
Siva Annamalai bd1895017b Add a verification step which iterates over the heap and verifies that all canonical objects are consistent (i.e canonicalizing the object returns the object).
Review URL: https://codereview.chromium.org/2160953002 .
2016-07-25 14:35:13 -07:00
Florian Schneider 8cd73fd94c Revert "Add new atomic operations and use them in two places."
This reverts commit 27863288db.

Cross ARM and Windows build failing.

TBR=rmacnak@google.com,

Review URL: https://codereview.chromium.org/2178693002 .
2016-07-22 15:54:24 -07:00
Florian Schneider 27863288db Add new atomic operations and use them in two places.
1. Setting the IC data array.  This may have caused corrupt IC data seen by the
 background compiler when cloning IC data.

2. Reading the thread_interrupt_disabled_ flag. This was reported as a race with TSAN.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2176803003 .
2016-07-22 15:40:54 -07:00
Ryan Macnak 4b369f6a0c Remove dead full snapshot support from the recursive descent serializer.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2161853002 .
2016-07-19 17:50:49 -07:00
Ryan Macnak e94012cd24 Fix crash looking at a Code object in an AOT program with the service protocol.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2157223002 .
2016-07-19 09:48:12 -07:00
John McCutchan c692a64e5a Rework how enums are implemented and reloaded
- Enum instances now hold their index and their label. Before the labels were held in a static array to the side and the index was used to look up the label.

- Before and after reload enum instances are now paired (by label) and put into the 'become' table.

Fixes https://github.com/dart-lang/sdk/issues/26877

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2153143002 .
2016-07-15 10:52:20 -07:00
Ryan Macnak 2d9087648d More ifndef PRODUCT.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2153593002 .
2016-07-14 15:30:32 -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
Ryan Macnak d75da67de1 Remove failing assert in Function::ClearCode.
Caching JIT snapshots may include functions with a zeroed usage counter that still have type feedback, e.g. due to code collection.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2146063004 .
2016-07-13 14:43:44 -07:00
Ryan Macnak a6f954b0f3 Don't track allocations in product mode.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2143153002 .
2016-07-12 14:15:02 -07:00
Regis Crelier 10b7f407c7 Add missing trail argument when comparing cyclic type graphs (bug uncovered by hot reload).
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2140223002 .
2016-07-12 10:58:46 -07:00
Todd Turnidge 62ccff992f Cache compile-time constants on the script object, sometimes.
When a script is not in the vm heap, we now cache compile time
constants on the script object itself.  During isolate reload we may
have both an old and a new version of a script being compiled at the
same time and they need to cache their constants separately.  This
also means that compile time constants from old scripts can be
collected when the script is collected, which is good.

When a script is in the vm heap, we continue to use the old system of
employing a shared per-isolate cache stored in the object store.

Closes #26833

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

Review URL: https://codereview.chromium.org/2126393003 .
2016-07-11 14:15:37 -07:00
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
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
Zachary Anderson e933f28a18 Remove some uses of STL map.
This CL removes the use of STL map from freelist.cc by adding
MallocDirectChainedHashMap in hash_map.h and adding an iterator for
BaseDirectChainedHashMap there.

It also removes a use of STL map from hash_table.h that was dead code.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2083103002 .
2016-06-22 08:32:37 -07:00
John McCutchan bfbfb0503d Fix product build
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2063303002 .
2016-06-14 14:30:18 -07:00
John McCutchan a6aec58b6b Ensure the url provided to a library has a computed hash code
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2068813002 .
2016-06-14 14:28:00 -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