Commit Graph

2925 Commits

Author SHA1 Message Date
John McCutchan 77101d63e3 Source positions for constructors and lots of async machinery
- Rework token position address space.
- Use ClassifyingTokenPositions::kMethodExtractor for the token position of a method extractor.
- Plumb token positions through all of Ast Transformer.
- Plumb token positions for temporary expressions, etc in Flow Graph Builder.
- Add token positions for parts of the await machinery.
- Move ClassifyingTokenPositions into token.h.
- Remove default token position of Scanner::kNoSourcePos for many IR instructions.
- A couple of unit tests.
- Use synthetic token positions for synthetic AstNodes.
- Fix SLEB128 encoding / decoding + test
- s/Scanner::kNoSourcePos/Token::kNoSourcePos.
- Remove >= 0 and < 0 checks against token positions and use helpers instead.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1589643002 .
2016-01-19 15:01:08 -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
Ryan Macnak 80702cb272 Fall back to inlining intervals to generate stack traces in --noopt. Inlined frames will lack line and column positions, but they will at least be expanded.
Fix stack traces when visible functions are inlined into an invisible function.

Fix off-by-one expanding inlined functions in the profiler.

BUG=http://dartbug.com/24783
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1582683003 .
2016-01-12 16:45:00 -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
Ryan Macnak c4480b6ded More 0 => Scanner::kNoSourcePos.
Arguably method extractors, invoke-field dispatchers and noSuchMethod dispatchers should also have their token position as kNoSourcePos instead of 0, but this would complicate how parser initializes its token iterator, so I'm leaving them as is.

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

Review URL: https://codereview.chromium.org/1566553003 .
2016-01-06 11:12:03 -08:00
John McCutchan cb8b641cc9 Make Scanner::kNoSourcePos be a true sentinel value
- It is possible to write a Dart program with a function token_pos of 0.
- Switch Scanner::kNoSourcePos from 0 to -1.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1564493002 .
2016-01-06 09:06:28 -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 6d0be9b1ec Eliminate excessive increment of deoptimization counters (e.g., with deep recursion of deoptimized function). Instead increment deoptimization_count for all (inlined) functions at deoptimization point if deoptimization was triggered from function's optimized code. Cases where that is not the case are OSR codes, lazy-deopts and code disabling due to loading/finalizing classes or guard invalidation.
Rename deoptimization_counter_threshold to max_deoptimization_counter_threshold.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1557533002 .
2015-12-29 15:48:51 -08:00
Srdjan Mitrovic 6f867815d8 Incremental changes from background compilation work
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1541133003 .
2015-12-22 12:24:01 -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
Regis Crelier 1c7f0a4d60 Finalizing an upper bound during a compile-time type test may lead to cycles.
Fail the test instead, requiring a runtime test.
This was introduced last week as https://codereview.chromium.org/1513493002/
in order to fix #25122.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1528523002 .
2015-12-14 11:38:19 -08:00
Matthias Hausner d68a7de36a Fix mismatched parenthesis error message
'file:xxxx.dart': error: line 2 pos 4: unterminated '('
foo(state { // <= missing closing parenthesis
   ^

Also include a couple of postscripts from previous change.

BUG=5830
R=iposva@google.com

Review URL: https://codereview.chromium.org/1504313003 .
2015-12-08 15:36:10 -08:00
Regis Crelier 173c1aed51 Improve upper bound finalization in VM and fix #25122.
Add regression test.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1513493002 .
2015-12-08 14:38:27 -08:00
Ryan Macnak c99df050b1 Use a monotonic clock in the implementation of Stopwatch.
Rename OS::GetCurrentTraceMicros() to OS::GetCurrentMonotonicMicros().

BUG=http://dartbug.com/477
BUG=http://dartbug.com/12383
R=iposva@google.com

Review URL: https://codereview.chromium.org/1504523002 .
2015-12-08 10:12:05 -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
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
Ryan Macnak 56239b1476 Use the same clock for the profiler samples and timeline events.
Preparation for overlaying samples in the timeline.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org/1492653002 .
2015-12-02 09:37:23 -08:00
Srdjan Mitrovic abef5cb3ed Correct overflow check; signed integer overflow is undefined in C++.
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1490853002 .
2015-12-02 08:45:41 -08:00
Matthias Hausner 1df143b6b6 Removing an assert that trips after the TL class removal.
I will look into why the assertion fails in a follow-on change.

Review URL: https://codereview.chromium.org/1486923005 .
2015-12-01 13:04:32 -08:00
Ryan Macnak 414dd5d778 Precompilation:
- Weaken check in Dart_New: it is okay to invoke a factory constructor or redirecting constructor of a class that was removed. We only need the class of a generative constructor to have been retained.
 - Fix crash sending two-byte symbols in isolate messages. Only occurs in precompilation because there are no two-byte string literals in the core libraries, and so no type-byte entries in the VM isolate's symbol table.
 - Fix crash getting expression snippet for assertion failures.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1493433002 .
2015-12-01 12:44:33 -08:00
Florian Schneider a05ad6111a VM: In CompileAll, don't iterate collected closures for every class
Instead iterate all collected closures at the end. This avoids unnessarily
visiting of the collected closures array and calling Function::Owner.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1491503003 .
2015-12-01 18:26:33 +01: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
Siva Annamalai 01b69ebabc Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone etc. are thread specific instead of being Isolate specific.
R=zra@google.com

Review URL: https://codereview.chromium.org/1473403003 .
2015-11-25 11:07:22 -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
Siva Annamalai 4992bc72a0 Remove support for object grouping during Garbage Collection
- remove support for prolog weak persistent handles
- remove support for construction of weak reference sets

R=iposva@google.com

Review URL: https://codereview.chromium.org/1459173004 .
2015-11-20 12:36:16 -08:00
Florian Schneider 64e71a0b2e VM: Make more globals constant where easily possible.
Remove -fdata-section again from the Linux build configuration: It prevented
some optimizations in gcc and clang - fewer things were recognized as constants.

Add const to pointers/arrays in some places to help compilers with determining
what is a constant.  A common pattern is strlen of a string literal const char*,
or an array of function pointers.

Tested with gcc 4.8.4 / clang 3.4 and improves code qualtiy + reduces binary size.

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

Review URL: https://codereview.chromium.org/1462953002 .
2015-11-20 10:52:07 +01: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
Ryan Macnak a6e8abfeb6 Deal with missing deopt_table under precompilation.
E.g., the InlinedFunctionsIterator used to build stacktraces.

Broken by 73b6080a6b.

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

Review URL: https://codereview.chromium.org/1458973002 .
2015-11-18 13:02:23 -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
Srdjan Mitrovic 354fcb12cf Cleanups. More mutator thread asserts.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1448463004 .
2015-11-16 10:29:01 -08:00
Ryan Macnak 8be0d4aca1 Save the native name on the function instead of finding it in the token stream to resolve lazily-linked natives. Drop token streams from precompiled snapshots.
dart2js ARM -7.0% size

Before
VMIsolate(CodeSize): 4663679
Isolate(CodeSize): 11970519
Instructions(CodeSize): 12904384
Total(CodeSize): 29538582

After
VMIsolate(CodeSize): 2611555
Isolate(CodeSize): 11965825
Instructions(CodeSize): 12906464
Total(CodeSize): 27483844

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1412633007 .
2015-11-12 17:24:42 -08:00
Ryan Macnak df64bb1619 - Annotate instructions that load objects from the ObjectPool or Thread.
- Remove disassembly tooltips.
- Surface whether a function has an intrinsic or is recognized.
- Mark intrinsified or ffi functions in the profile.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1439893002 .
2015-11-12 15:18:31 -08:00
Srdjan Mitrovic 4600d37dc1 Background compilation work:
- Defer deoptimization from optimizing compiler to code installation in mutator thread.
- Defer registration of field and leaf class dependency until code is installed in mutator thread.
- Cleanup.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1433243003 .
2015-11-12 11:25:58 -08:00
John McCutchan c6a8c44eae Include field reference with implicit getter / setter functions
- When printing implicit getter or setter functions, include the field that the implicit functions were generated for.
- Display field on function view in Observatory.
- Service unit test.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1440753002 .
2015-11-11 14:13:45 -08:00
Matthias Hausner 8d03d9a575 Remove dead code
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1441473002 .
2015-11-11 13:16:09 -08:00
John McCutchan f5e63ba792 Make profiler work without Instructions -> Code pointer
- Do one eager pass over both the vm and current isolate's heaps to populate the live code table instead of lazily sampling the heap for code objects.
- Remove Instructions -> Code pointer

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1435533003 .
2015-11-10 11:33:53 -08:00
Srdjan Mitrovic c4aee38224 Pass type argument to Field construction, thus freezing that field, denoting it cannot be changed later.
BUG=
R=regis@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1406943006 .
2015-11-09 13:54:57 -08:00
Srdjan Mitrovic fa3c485001 Queueing fix, cleanups.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1414333014 .
2015-11-06 15:19:59 -08:00
Srdjan Mitrovic 9dcd1fd076 Background compilation fixes
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1426513006 .
2015-11-05 09:53:13 -08:00
Florian Schneider f6b96b3d07 Start remove dependencies on compiler-related files.
Minimize the number of dependencies of compiler-related files.

This is needed to remove whole .cc/.h files from a compiler-less VM binary which
can be used for running precompiled code.

* removed dependencies of object.cc on flow_graph_compiler.h and flow_graph_builder.h

* removed unnecessary includes from object.h

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1411873005 .
2015-11-05 00:08:35 +01:00
John McCutchan ceb12c4f69 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

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

Review URL: https://codereview.chromium.org/1423473004 .
2015-11-04 07:59:16 -08:00
Florian Loitsch be025b8412 Revert "Remove deprecated dart:profiler library"
This reverts commit 535a9715ac.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1415843008 .
2015-11-04 01:59:53 +01:00
William Hesse cc4a5d2e7c Revert "Switch profiler from isolates to threads"
Reverts commit 6365c27f81 and
commit 8b9ed6cfb3.

They are causing flaky timeouts (hangs) on all vm cc tests on all Windows vm bots.

R=mit@google.com

Review URL: https://codereview.chromium.org/1425093006 .
2015-11-03 10:42:55 +01:00