Commit Graph

264 Commits

Author SHA1 Message Date
Konstantin Shcheglov 0f441fa3ea Use BufferContext + offset instead of BufferPointer.
This lets us avoid creating tens of millions of BufferPointer instances
and makes DDC compilation about 6% faster.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1998833002 .
2016-05-19 20:08:26 -07:00
Paul Berry 6090636607 Improve dumping of inferred types.
We now disambiguate all types by their full library
URI (e.g. "dart:core.Map" instead of "Map").  In addition, we now expand
function types based on local functions into their arguments and return
types (e.g. "() -> dynamic" rather than
"typeof(....localFunction[0].localFunction[0])".

This allows more accurate comparison of AST-based and element-based
summaries.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1997753002 .
2016-05-19 11:04:49 -07:00
Paul Berry 655e9155a8 Add a strong-outputs mode to build_sdk_summaries.dart.
This is needed by dev_compiler, which currently has its own fork of the
SDK that can only be summarized successfully in strong mode.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1979333002 .
2016-05-16 11:29:46 -07:00
Paul Berry a407f6ad37 Modify dump_inferred_types to use SummaryDataStore.
This paves the way for further improvements to dump_inferred_types to
allow it to make use of linker data structures.  That will in turn make
it easier to validate the linker code by exercising more of it.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1969313006 .
2016-05-12 10:35:44 -07:00
Paul Berry abd7a34476 Update dump_inferred_types to show an index of libraries and parts.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1962813002 .
2016-05-09 12:38:33 -07:00
Paul Berry f10f138cd1 Drop trailing dynamic when dumping inferred types.
This makes it easier to compare the output of AST-based and
element-based summaries, since element-based summaries cannot
distinguish between implicit type arguments and explicitly-specified
type arguments that happen to match the default (usually `dynamic`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1957133002 .
2016-05-08 11:36:22 -07:00
Paul Berry 5f3481e811 Skip local variables when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1956433002 .
2016-05-05 09:14:16 -07:00
Paul Berry fca48b75de Skip local functions when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1948103002 .
2016-05-04 11:29:38 -07:00
Paul Berry c351cb3c37 Skip more initializers when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1939973002 .
2016-05-02 14:55:27 -07:00
Paul Berry 09c98dc456 Modify dump_inferred_types.dart to handle missing unlinked units.
In rare cases a summary package bundle may contain a LinkedLibrary
object but not its corresponding UnlinkedUnits.  (This could happen, for
instance, if both a package and one of its dependencies contain
libraries that reference the same file as a "part"--in this case, the
UnlinkedUnit for the part might only be included in one of the package
bundles, because it is redundant in the other).

This CL modifies dump_inferred_types.dart so that it doesn't crash in
this rare corner case.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1930663003 .
2016-04-27 14:22:30 -07:00
Paul Berry f821542305 Build strong mode SDK summary with dart2js paths
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1922233002 .
2016-04-26 15:06:48 -07:00
Paul Berry abd0e1f205 Add a "raw" mode to the summary inspector
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1914073003 .
2016-04-26 09:16:23 -07:00
Paul Berry 9ab526d7bd Support additional corner cases in dump_inferred_types.dart
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1915123003 .
2016-04-25 13:39:56 -07:00
Paul Berry d8e8cbe3c8 Add a debugging tool for inspecting the contents of a summary file.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1905173002 .
2016-04-21 15:31:44 -07:00
Paul Berry 516542dc7f Don't visit parts redundantly when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1901303003 .
2016-04-20 14:11:47 -07:00
Paul Berry 0f7c0a18e2 Add a utility for dumping inferred types from summary files.
This should be useful in validating the correctness of AST-based summary
type inference.

R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1890943002 .
2016-04-14 13:10:15 -07:00
Brian Wilkerson deae702994 Format everything in analyzer
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1842563003 .
2016-03-28 18:16:43 -07:00
Konstantin Shcheglov 58bde1b3b4 Add the --build-summary-exclude-informative flag.
It (in combination with --build-summary-only-diet) makes the
package:path summary is almost 3 times smaller, partially because of
skipping bodies, patially because of excluding documentation comments,
and partially because of making 'codeRange' fields informative.

We also remove MD5 hashes.

As I can see after changes in method bodies we generate the exactly
same file (or at least 'cmp -l' thinks so). Adding a new field results
in a file of different length.

R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1828973002 .
2016-03-24 08:20:56 -07:00
Konstantin Shcheglov 552aef6a5c Fix for building SDK summaries.
TBR

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1834433002 .
2016-03-23 13:45:11 -07:00
Konstantin Shcheglov 5e4218b754 Issue 26063. Index declarations in even partically analyzed units.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/26063

Review URL: https://codereview.chromium.org/1829463002 .
2016-03-22 17:24:17 -07:00
Konstantin Shcheglov c4c92c1f8d Use specialized _FbUint8List and Uint8ListReader.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1792523002 .
2016-03-11 14:44:27 -08:00
Konstantin Shcheglov 5a927c7373 Add hacks into build_sdk_summaries to workaround bugs in build tools.
Paul thinks that there is a bug in gyp or make, and we should generate
only one output. So, we generate the whole bundle with all summaries
and index information. And then we have separate actions that take
this bundle and extract one output each - spec.sum and strong.sum files.

R=paulberry@google.com, whesse@google.com
BUG=

Review URL: https://codereview.chromium.org/1775973003 .
2016-03-09 11:37:17 -08:00
Paul Berry ff6a744f38 Implement forwards compatibility for summary enums.
If an attempt is made to read an unrecognized enum value, then rather
than crashing, we will read the default (first) value of the enum type.

This facilitates forwards compatibility by ensuring that if a new enum
value is added in the future, older code will still be able to read the
resulting summary files without crashing.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1747413002 .
2016-03-01 13:28:10 -08:00
Paul Berry 9a983bcbda Add the ability to deprecate Flatbuffer fields.
If an IDL field is marked as `@deprecated`, no setter will be
generated for it, and the getter generated for it will throw an
UnimplementedError.  This is similar to the behavior of standard
Flatbuffer tools (which generate neither setters nor getters for
deprecated fields) except that we have to generate a getter in order
to avoid warnings.

Once we have begun using summaries in the wild, we will need to make
use of this feature in order to avoid changing Id numbers and breaking
backwards compatibility.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1753883002 .
2016-03-01 13:25:02 -08:00
Konstantin Shcheglov 7d0fbd1b11 Separate 'isQualified' flags as List<bool>.
It turned out that for used names we don't need any flags because we
want to store only qualified unresolved (potential) class member
usages. So, no flags for used names at all, at least for now.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1750163003 .
2016-03-01 11:06:40 -08:00
Paul Berry e399f0f5a7 Generate a ".fbs" file representing the summary format.
This file can be consumed by standard flatbuffer tools, allowing
summaries to be consumed from other languages.  For example, a summary
file can now be converted to JSON using:

    flatc -o $outputDirectory -t \
        pkg/analyzer/lib/src/summary/format.fbs -- $inputFile

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1743713002 .
2016-02-26 10:53:33 -08:00
Konstantin Shcheglov a09461a010 Initial package indexing implementation.
More tests will be added in following CLs.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1735243003 .
2016-02-26 08:24:05 -08:00
Paul Berry 7481eff6a8 Add file identifiers to summaries.
These should make it easier for summary files to interoperate with
standard FlatBuffer tools.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1738833004 .
2016-02-25 10:36:42 -08:00
Konstantin Shcheglov 8e9aac65ab Extract PackageBundleAssembler and use for SDK and package summary generation.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722413002 .
2016-02-24 08:26:05 -08:00
Paul Berry 44f507bd05 Add file hashes to SdkBundle; rename to PackageBundle.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1725913002 .
2016-02-23 10:56:26 -08:00
Konstantin Shcheglov bfd8e7ba09 Get LibraryElement(s) and CompilationUnitElement(s) from summary.
With this change we fail just 2 shared tests when use SDK summary.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1712313002 .
2016-02-19 13:10:29 -08:00
Paul Berry 4cd82a693e Generate useful toString() methods for summary classes.
This should make debugging easier.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1712023002 .
2016-02-19 08:33:13 -08:00
Brian Wilkerson 71e7ed86c0 Move scanner out of generated and clean up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1693083004 .
2016-02-14 07:48:44 -08:00
Paul Berry 92ad0e0cba Store enums in summary file as bytes.
Reduces SDK summary file size by about 1%.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1690183003 .
2016-02-12 10:57:14 -08:00
Paul Berry 5a58e09639 Make summary format stable when adding getters to idl.
This mechanism is the same as the "id" mechanism described in
http://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html,
except that for us the ids are always mandatory.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1691923002 .
2016-02-11 14:38:24 -08:00
Paul Berry 71b593f89e Minor improvements to list representation in flatbuffers.
This CL makes the following changes:

- Renames _FbInt32List to _FbGenericList, and makes it able to
  represent lists of entities whose size isn't 4.

- Adds Uint32ListReader and _FbUint32List classes, which are
  specialized to handle lists of 32-bit unsigned ints.

- Moves common elements of all _Fb*List classes to the _FbList base
  class.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1685263003 .
2016-02-11 12:14:29 -08:00
Paul Berry 2a129906a9 In summary/stats.dart, don't count enums with index == 0.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1691043002 .
2016-02-11 11:02:41 -08:00
Paul Berry f2fa7e85e5 Create a tool for collecting statistics about summary files.
In addition to exploring how the summary format is used, it should be a
nice micro-benchmark for FlatBuffer deserialization efficiency.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1686753005 .
2016-02-10 09:03:11 -08:00
Konstantin Shcheglov abc69cb232 Add DirectoryBasedDartSdk.useSummary property.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1687583002 .
2016-02-09 12:49:29 -08:00
Konstantin Shcheglov 7f4f8f07a5 Find and serialize other libraries next to the libraries described in libraries.dart meta.
Even while these libraries are not descibed directly in the
libraries.dart file of Dart SDK, they still can be imported using URIs
like 'dart:html_common/metadata.dart'. So, we need to serialize them
too. Unfortunately I don't see any direct way to know all the SDK
libraries.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681853002 .
2016-02-09 12:26:40 -08:00
Konstantin Shcheglov e43fc7e4ef Generate spec.sum and strong.sum summaties for SDK.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1672753002 .
2016-02-05 09:00:53 -08:00
Paul Berry 24e3e091d6 Set an exit code when exiting build_sdk_summary in error.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1668533002 .
2016-02-04 05:27:43 -08:00
Paul Berry 3057754843 Use summary IDL file for interface classes.
This CL makes a small change to the format of the summary IDL file:
instead of containing classes with fields, it now contains classes
with getters.  This allows the classes in the IDL file to be directly
used as interface classes, which makes code navigation much smoother.

Since the IDL file is now being used directly by the code, it has been
relocated to pkg/analyzer/lib/src/summary/idl.dart.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1667723002 .
2016-02-03 08:57:44 -08:00
Paul Berry bfa85298e2 Document that LinkedExportName.name includes trailing '=' for setters.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1658773004 .
2016-02-01 12:49:29 -08:00
Konstantin Shcheglov eb4a056948 Verify AST instead of constant values.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1651653002 .
2016-01-29 14:55:56 -08:00
Paul Berry 9e7b8daf83 Add the ability to summarize inferred types based on function-typed parameters.
There may still be bugs related to generic types.  I will follow up
with more tests (and fixes if necessary) in further CLs.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1647253002 .
2016-01-29 13:12:15 -08:00
Paul Berry db4acee8c3 Rename ReferenceKind.constField and referenceKind.staticMethod.
These will be re-used when summarizing inferred types, and they won't
necessarily refer to things that are const/static.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1646363002 .
2016-01-29 10:34:12 -08:00
Konstantin Shcheglov a3b870d8ec Resynthesize binary and prefix expressions.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1649873002 .
2016-01-28 14:40:02 -08:00
Konstantin Shcheglov 581c2b71c4 Repalce shiftOr with pushLongInt, tweak makeSymbol.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1648783002 .
2016-01-28 14:34:13 -08:00
Konstantin Shcheglov e4ab45aa65 Improve 'length' instance property reference encoding.
UnlinkedConstOperation.length is used not only if we can prove that
the target is a StringLiteral (and actually we cannot encode it as a
reference).

The new ReferenceKind.length was added - it is used to encode reference
to the the only instance property we support - 'length'.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1642483002 .
2016-01-27 09:55:36 -08:00