Commit Graph

2008 Commits

Author SHA1 Message Date
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
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 a78ed1c47a Tree-shake consts.
BUG=http://dartbug.com/25892
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1758153002 .
2016-03-04 09:42:53 -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
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
Srdjan Mitrovic 88acc8ab01 Make type canonicalization thread safe
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1747073002 .
2016-03-01 12:12:16 -08:00
Srdjan Mitrovic cd1112a382 Factor out code that looks up a canonical type and adds it to the canonical_types_ array if necessary.
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1748913002 .
2016-02-29 15:49:07 -08:00
Regis Crelier a8d71a461d Stop prefixing the library name to type names when reporting a type error with
identical names. The library name is not always helpful, and the prefix confuses
users when the types are function types.
Instead, enumerate all appearing types with their URIs.
This should help debug issue #27229258.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1743653002 .
2016-02-26 15:11:50 -08: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
John McCutchan 761e6a5963 Build CodeSourceMap for each code object
- Add helpers for building CodeSourceMap to FlowGraphCompiler. Ensure that no duplicate pc offsets are added to a CodeSourceMap.
- Add a CodeSourceMap debug printer which incorporates inlining information.
- Add some new classifying token positions.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1740503002 .
2016-02-26 07:59:48 -08:00
John McCutchan 3b0104732b Remember token position where a function was inlined
When inlining a function, remember the token position of the call. I need this information for source level profiling.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1739963002 .
2016-02-25 14:47:11 -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
Ryan Macnak 4b112c6d25 Precompilation: drop unused types and type arguments and empty classes and libraries.
precompiled dart2js arm 20748837 -> 20639848 (-0.52%)
precompiled flutter asteriods arm64 8926398 -> 8782136 (-1.6%)

R=regis@google.com

Review URL: https://codereview.chromium.org/1686773002 .
2016-02-22 14:05:03 -08:00
Srdjan Mitrovic 8e23dcced3 Make function lookup in classes thread-safe:
- Do not create/add function when looking them up  in TryCreatICData
- Do not allow background compilation to add/remove functions
- Cache function hash array as it may change or be set to null.

Check VMObject only if FLAG_verify_handles is true.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1709273003 .
2016-02-18 16:03:29 -08:00
Florian Schneider 1f7458ddf8 VM: Precompiled rodata snapshot.
For now only contains PC descriptors and stack maps and one-byte strings.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1584443002 .
2016-02-15 09:15:26 +01:00
Srdjan Mitrovic 420843a75f Clone both descriptor and data array when compiling in background. Eliminates crashes when ic_data array invocation counter is changed while compiling (e.g., NumberOfUsedChecks can change on the fly).
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1700463002 .
2016-02-12 14:54:55 -08:00
Srdjan Mitrovic 72528aba85 Fix background compilation crashes due to allocation of types in new space. Remove default arguments of InstantiateFrom and others where space argument is being passed, in order to preemptively fix crashes and prevent future problems (always be explicit where the type is allocated, make sure the 'space' argument is propagated).
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1691163002 .
2016-02-12 09:05:08 -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
Regis Crelier 21cad16fac A type should be a subtype of Function if its class declares a call function,
even if call is abstract (fixes #25550).
Add regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1683113003 .
2016-02-10 10:54:00 -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
Srdjan Mitrovic 5cba052d70 Bailout if field state changed during background compilation.
Bailout if deferred loading cleared ic_data_array.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1672873003 .
2016-02-08 12:51:15 -08:00
Ryan Macnak 9f751862db Precompilation: canonicalize Instructions in PRODUCT mode.
precompiled dart2js x64 21550906 -> 18787632 (-12.8%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1653003003 .
2016-02-08 11:27:56 -08:00
John McCutchan d295b9c311 Remove many features when building product mode
Move all JSON printing code from object.cc to object_service.cc.

Not compiled in:

- Service protocol
- Debugger
- Debugger API
- JSONStream
- ObjectIdRing
- Profiler service
- Object JSON printing

Size of dart_bootstrap before: 5670365 bytes
Size of dart_bootstrap after: 5287631 bytes

Reduction in size: 382734 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1660063002 .
2016-02-05 09:55:51 -08:00
Kasper Lund 42dfb86459 Improve performance of Library::LookupLibrary(const String&).
Make sure that String::Equals(const String&) checks the hash codes
on  the strings if they are available. Before this change, only
String::Equals(const Instance&) would consult the hash codes.

R=iposva@google.com
BUG=

Review URL: https://codereview.chromium.org/1666113002 .
2016-02-05 09:55:03 +01:00
Florian Loitsch 8811cba569 Move static before type.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1646543006 .
2016-02-05 00:12:46 +01:00
Ryan Macnak af10c8ceb7 Precompilation: when removing top-level fields and functions, also remove them from the library dictionary.
precompiled dart2js x64 21545468 -> 21521876 (-0.11%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1643023003 .
2016-02-03 13:11:49 -08:00
Ivan Posva 4f392df85e Fix some more shorten-64-to-32 warnings:
- Remove duplicate check for javascript integer overflow.
- Make sure the BitField class knows the type it is
  encoding into.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1644223006 .
2016-02-02 13:58:06 -08:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

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

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
John McCutchan 109e9e2c2d Initialize byte_index_
BUG=

Review URL: https://codereview.chromium.org/1632343002 .
2016-01-26 13:13:50 -08:00
John McCutchan b5259257bd Introduce CodeSourceMap object to hold pc -> token position mappings
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1634863002 .
2016-01-26 13:07:22 -08:00
Regis Crelier 7f57ebcfa1 Remove signature classes from the VM.
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.

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

Review URL: https://codereview.chromium.org/1584223006 .
2016-01-19 16:32:59 -08:00
Matthias Hausner 782f7b268b Report missing semicolons after function declarations
Also take the opportunity to add the ability to report an error after a given token position. This way, the missing semicolon gets reported where it should: at the end of the line rather than the first token on the following line, when the error is actually detected.

BUG= 23761
R=regis@google.com

Review URL: https://codereview.chromium.org/1574213005 .
2016-01-19 09:31:33 -08:00
Siva Annamalai 8359b9e20c Do not include resolved_names_ and loaded_scripts_ consistently in both the full and script snapshots. Initialize the resolved names cache correctly in both cases when reading the snapshot.
This reduces the isolate snapshot size from 255324 to 249714.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1588783002 .
2016-01-13 16:42:29 -08:00
Regis Crelier ca1d105c5a Fix finalization of recursive type graph with bounds (issue 25389).
Add regression test.
Rename malformed_error to bound_error.
Fix internal name of bounded type (broken by a previous cl).

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1580643004 .
2016-01-13 11:19:14 -08:00
Matthias Hausner 4ffdcb76df Eliminate phase parameter in constructors
Super initializer calls get implicitly moved to the end of the initializer list, so we don't need the two-phase constructor protocol anymore.

Ryan, can you please look at the mirror changes and check wether I've missed something?

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

Review URL: https://codereview.chromium.org/1569213003 .
2016-01-08 15:41:51 -08:00
Regis Crelier fe563306d4 Use the fast canonical type cache for non-generic classes, even if their
superclass is generic, in which case the type argument vector is not
necessarily empty, but definitely constant.
Until now, the fast cache was only used for classes without type arguments along
the whole superclass chain.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1556113002 .
2016-01-05 09:51:53 -08:00
Srdjan Mitrovic 1595117898 Investigate & fix issues around usage_count and deoptimization_count
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1559653002 .
2016-01-05 09:40:23 -08:00
Todd Turnidge 26af34a1b3 Add SourceReport, a class for generating Dart source-level reports.
These reports provide information tied to token positions in the
Dart source program.

SourceReport can generate multiple kinds of reports.  Right now it
implements code coverage and call site reports.  In the future it
could provide, for example, valid breakpoint sites or source-level
profiles.

Scripts are refered to by index within the report and a script table
is tacked on the end.  This avoids a bit of duplication.

In a future cl I will expose this reporting through the vm service.
After that, we can remove our older coverage/callsite code.

----------
Very simple, sample coverage report:

{
  "type": "SourceReport",
  "ranges": [
    {
      "scriptIndex": 0,
      "startPos": 0,
      "endPos": 4,
      "compiled": true,
      "coverage": {
        "hits": [],
        "misses": []
      }
    },
    {
      "scriptIndex": 0,
      "startPos": 6,
      "endPos": 10,
      "compiled": false
    },
    {
      "scriptIndex": 0,
      "startPos": 12,
      "endPos": 39,
      "compiled": true,
      "coverage": {
        "hits": [ 23 ],
        "misses": [ 32 ]
      }
    }
  ],
  "scripts": [
    {
      "type": "@Script",
      "fixedId": true,
      "id": "libraries\/15\/scripts\/test-lib",
      "uri": "test-lib",
      "_kind": "script"
    }
  ]
}

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1533653003 .
2016-01-04 10:56:52 -08:00
Srdjan Mitrovic ab7525a820 For background compilation we copy ICData so that it is immutable during comnpilation. However, we must emit the original, shared ICData in the code. Provide a link from cloned ICData object to the original one.
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1544583002 .
2015-12-21 14:49:30 -08:00
Matthias Hausner 0bbfe1e23b There are about 60 patch classes in the libraries. Running dart2js causes about 25 of them to be compiled and applied, so we get rid of 25 of 60 Class objects.
Review URL: https://codereview.chromium.org/1498933002 .
2015-12-04 13:11:25 -08:00
Ryan Macnak d94b68cb41 Precompilation: Don't drop an uncompiled function if it has a compiled implicit closure function.
This ensures the implicit closure function is enumerated in later steps. Fixes crash in co19 test reducible as

import 'dart:math';
main() {
  print(const [1, 2.0, "3"].fold(0, max));
}

Also enumerate invocation dispatchers to avoid a similar situation there, though I cannot find a crashing example involving them.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1489203004 .
2015-12-03 11:03:23 -08:00
Matthias Hausner 4733386ca8 Reset top-level class finalization
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1493533002 .
2015-12-02 09:59:32 -08:00
Matthias Hausner ad0f14e0ce Eliminate all but one top-level class per library.
Each script has an associated top-level class in which the top-level functions and fields are stored, and the reference to the script. All other fields in the TL class are unused. There are 380 TL classes in corelib alone; eliminating them saves space.

This CL eliminates all TL classes but one per library. All TL functions and fields in the library are stored in that TL class. Because scripts are not stored directly in functions and fields, but are accessible via their owner class, the owner of TL entities are now PatchClasses, rather than classes.

Before:
Size of vm isolate snapshot = 930813
New space (0k of 0k) Old space (1184k of 1624k)
VM Isolate: Number of symbols : 14909
Size of isolate snapshot = 261873
New space (0k of 2048k) Old space (987k of 1024k)

After:
Size of vm isolate snapshot = 931101
New space (0k of 0k) Old space (713k of 1156k)
VM Isolate: Number of symbols : 14907
Size of isolate snapshot = 256956
New space (0k of 1024k) Old space (514k of 768k)

R=iposva@google.com

Review URL: https://codereview.chromium.org/1410383020 .
2015-12-01 09:21:17 -08:00
Matthias Hausner e3457758ed Remove Field::FindFieldIndex() and update service protocol
This paves the way to remove functions and fields from top-level
classes. They are looked up via the class dictionary when resolving
names.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1477573002 .
2015-11-24 15:42:03 -08:00
Matthias Hausner 849a635927 Remove dead code
Function::FindFunctionIndex() is not used anywhere.

Review URL: https://codereview.chromium.org/1469243002 .
2015-11-23 16:39:24 -08:00
Srdjan Mitrovic a9961f8f0a Various cleanups
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1464593002 .
2015-11-19 13:15:01 -08:00
Srdjan Mitrovic 1b17e78f38 Create code and instruction object, and install them in the background compilation thread while bringing mutator thread to a saferpoint.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1454553004 .
2015-11-18 11:32:17 -08:00
Florian Schneider dce89b9b5b VM: Speculative inlining in precompiled code.
Enable inlining of certain smi- and array-operations based on propagated
types and range analysis:

If bounds checks and class checks can not be eliminated, bail out of the
current optimization and retry without speculative inlining using the same
mechanism as we use for far jumps on MIPS.

Allow more speculative inlining attempts with up to n deopt ids black-listed.
For now set n=1 since precompilation time will be proportional to n.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1423063005 .
2015-11-18 14:56:06 +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