Commit Graph

993 Commits

Author SHA1 Message Date
Florian Schneider 245197fb9f VM precompiler: Allow optimizing static initializers.
Static initializers were compiled without any optimizations. They are only
executed once, but the optimizer can potentially extract static type information
and may also produce a bit smaller code. (7K size savings when compiling dart2js -- i.e. < 0.1%)

This CL enables optimizations for them. The space savings
 are not great, but I still think it's nicer to only have
 optimized code when precompiling, instead of a mixture of
 unoptimized and optimized.

Also, fix printing disassembly for initializers, and insert additional assertions.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1958913003 .
2016-05-10 09:38:03 +02:00
Regis Crelier 508b876ec8 Report wrong async function result type as type error in checked mode (Fixes #26133).
Add regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1847953002 .
2016-05-09 15:06:45 -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
Ivan Posva 3884fd4e4b - Allow for loading dart:html and friends into the standalone
dart_bootstrap binary to evaluate startup and compilation
  performance.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1916793003 .
2016-05-03 20:33:14 -07:00
Regis Crelier 1b36e9dbe6 Remove small window when function parameter types and names were reset to null
by background compiler, possibly crashing the main thread performing a function
type test (fixes #26101).

R=hausner@google.com

Review URL: https://codereview.chromium.org/1947683002 .
2016-05-03 13:37:35 -07:00
Matthias Hausner 6cb7d87e56 Don’t cache constants in initializer expressions
Initializer expressions are evaluated only once. Therefore, do not store
constant expressions in the constant cache, since they will never be
used again.

Except: when generating a stack trace and accessing the local variables
in a the stack frame of an initializer expression (static final getter function),
the constant will have to be recomputed instead of retrieved from the cache.
This CL also disables the stacktrace_every stress flag while a stack trace
is being collected, to avoid recursive requests for stack traces.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1934733002 .
2016-04-29 15:06:30 -07:00
Matthias Hausner d5d8762551 Revert "Don’t cache constants in initializer expressions"
This reverts commit 77b328333f.

BUG=

Review URL: https://codereview.chromium.org/1930553002 .
2016-04-27 10:21:21 -07:00
Matthias Hausner 77b328333f Don’t cache constants in initializer expressions
... they will never be used again.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1923743002 .
2016-04-27 09:28:29 -07:00
Siva Annamalai 9069cb88a2 Cleanup some handle creation code, was showing up in the CompileAll testing that we are doing with large applications.
R=regis@google.com

Review URL: https://codereview.chromium.org/1914293002 .
2016-04-26 16:59:11 -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
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
Regis Crelier bab552edaf Fix mirrors to keep typedef as scope class of function types (fixes #26187).
Add mirror regression test.
Adjust expectation of a mirror test.
Fix parser to mark current class as typedef before parsing signature.
Fix canonicalization of typedef function types (a typedef class can be the scope
class of more than one function type, even if not generic).

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1890013002 .
2016-04-15 13:21:22 -07:00
Florian Loitsch bcd8ef3dea Enable conditional directives by default.
R=brianwilkerson@google.com, iposva@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1851753002 .
2016-04-14 19:02:41 +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
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
Srdjan Mitrovic 80ba69dfdb Print messages when aborting background compilation (--trace-compiler); turn on background compilation; mark a slow test.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1879033002 .
2016-04-12 11:19:56 -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
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 1a9fc8b2fa Move CompilerStats from isolate to thread. Aggregate stats.
The mutator thread holds the aggregate values, the background compiler adds its value to it.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1841213003 .
2016-03-30 13:38:32 -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 3c70445a68 Cleanup
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1819543002 .
2016-03-22 14:18:19 -07:00
Stephen Adams 30f3df8f26 vm: Avoid list allocation for empty map literals.
This reduces the number of _List(0) allocations in a dart2js compile by ~3%.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1819673002 .
2016-03-22 10:33:43 -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
Siva Annamalai 56e888d4cd - Move
stack_limit_,
   stack_overflow_flags_,
   saved_stack_limit_,
   stack_overflow_count_ and
   other interrupts mask fields from Isolate structure to Thread structure

- Change the stack overflow check in the prolog to load the stack limit
  from the THR register, this removes the back to back dependent loads to
  load the stack limit from the Isolate structure

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

Review URL: https://codereview.chromium.org/1812753002 .
2016-03-17 12:57:36 -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
Florian Schneider 631ac120bb VM: Fix --noopt build by using ZoneHandle.
BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1777093003 .
2016-03-10 13:47:07 +01: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 5a0a097188 Fix issues in name resolution
Looking up a name x in the library scope or in a prefix can also return
the setter name x=. There were several situations that were not handled
right.

- a getter x and a setter x= should not result in a duplicate name
  error (and thus a resolution error at runtime).

- when looking for an untangled name x but a setter x= is found first,
  keep looking for x.

BUG=25625
R=regis@google.com

Review URL: https://codereview.chromium.org/1752203002 .
2016-03-02 10:44:28 -08:00
John McCutchan d08d4d8dba Dump functions on circular dependency parser error
Help with: https://github.com/dart-lang/sdk/issues/25545

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1751523003 .
2016-02-29 12:32:20 -08:00
Florian Loitsch 55630a5e90 Support 'dart.library.X' env variables in the VM.
BUG= http://dartbug.com/24587
R=iposva@google.com, johnmccutchan@google.com

Committed: https://github.com/dart-lang/sdk/commit/c2a06e22cb83f491fd3accc33d7738c87490c26d
Reverted: https://github.com/dart-lang/sdk/commit/5eb5b429895987519a00daa81b5ab261debbca3f

Review URL: https://codereview.chromium.org/1640853004 .
2016-02-29 20:58:32 +01:00
Srdjan Mitrovic 5a69e3661b In background compilation make a copy of Field in order to freeze its state. Add flag --force_clone_compiler_objects for debugging purpose.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1722733002 .
2016-02-26 09:07:49 -08:00
Ivan Posva 8d18298fed - Remove Isolate::Flags structure and store flags directly in isolate.
- Make enable_asserts, enable_type_checks, error_on_bad_override and
  error_on_bad_type release mode flags only.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1737693003 .
2016-02-25 18:06:56 -08:00
Regis Crelier 3ffe9922b7 Simplify various name flavors in VM.
R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1723733002 .
2016-02-25 11:21:27 -08:00
Florian Schneider d8677964a3 Move precompilation-related flags to flags list.
They become compile-time constants in the precompiled runtime, and in product mode.

In precompiled product mode, the precompiled value has precedence.

BUG=
R=rmacnak@google.com

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

Review URL: https://codereview.chromium.org/1731743003 .
2016-02-25 07:53:39 -08:00
Ryan Macnak bd85deaf4e Revert "Move precompilation-related flags to flags list."
The default value of print_stop_message was architecture specific.

TBR=fschneider@google.com

Review URL: https://codereview.chromium.org/1739593002 .
2016-02-24 18:08:01 -08:00
Florian Schneider 5c9f18c6c8 Move precompilation-related flags to flags list.
They become compile-time constants in the precompiled runtime, and in product mode.

In precompiled product mode, the precompiled value has precedence.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1731743003 .
2016-02-24 17:31:08 -08:00
Florian Schneider b870dafa4f VM: Separate precompilation-specific code, make flags const.
Move optimizations for precompilation into separate file.

Remove precompilation-specific code from flow_graph_optimizer.cc.

Add precompilation-flags: They are const in the precompiled runtime. Started moving flags to use the new flag-definition macros.

Add libdart_lib_precompiled target.

Define PRECOMPILED_RUNTIME_MACRO in more places (dart_precompiled_runtime)

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1714743002 .
2016-02-23 08:48:08 -08:00
John McCutchan 8266501a72 Remove mirrors in product mode
(stripped) dart_product before: 5307888
(stripped) dart_product after: 5232976

Reduction in size: 74912 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1712843002 .
2016-02-22 09:55:20 -08:00
John McCutchan fda3a9bc2b Remove more things
(stripped) dart_product before: 5307888
(stripped) dart_product after: 5275088

Reduction in size: 32800 bytes.

Removed entirely:

- debuginfo*
- elfgen*
- gdbjit*
- TraceBuffer
- vtune support

Removed in product:

- Compiler stats
- Code observers

R=asiva@google.com

Review URL: https://codereview.chromium.org/1711163002 .
2016-02-22 08:53:11 -08:00
Srdjan Mitrovic 0c77e70b49 Cleanup access to guarded_fields
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1712563006 .
2016-02-19 11:07:44 -08:00
Matthias Hausner 761ee7ec04 ‘Yield* e' should not access e.current eagerly
Match the implementation of dart2js.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1682173008 .
2016-02-12 13:28:16 -08:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
Srdjan Mitrovic c5ea105261 Disable reg-exp compilation in background via a flag; abort background compilation if deoptimization needs to be triggered while compiling; Both issues will be fixed later
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1679373002 .
2016-02-09 12:48:31 -08:00
Regis Crelier 7ab578d21f Keep a trail while checking upper bounds in the VM in order to properly handle
cycles via bounds (fixes #25568).
Add a regression test.
Improve handling of recursive types with trails.
Make sure we do not modify already canonicalized types.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1674383002 .
2016-02-09 10:49:43 -08:00
John McCutchan e2e7af1229 Remove more feature in product mode
- Remove Timeline.
- Remove more vmservice code.
- Remove AST printing.
- Remove IL printing.
- Remove profiler.
- Remove thread interrupter.
- Remove disassembler.
- Remove Library::CheckFunctionFingerprints.

- Update test status files for product mode.

Size of dart_bootstrap before: 5287631
Size of dart_bootstrap after: 5112783

Reduction in size: 174848 bytes.

Total reduction in size (382734 + 174848): 557582 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1678203002 .
2016-02-09 08:45:32 -08:00
Srdjan Mitrovic 4316d1bd17 Move sticky_error_ from isolate to thread
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1672853002 .
2016-02-05 15:46:55 -08:00