Commit Graph

470 Commits

Author SHA1 Message Date
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 d9bd7f915d Revert collecting defined elements.
We decided to resynthesize local elements from summaries.
This CL rolls back the following CLs:

https://codereview.chromium.org/1687573002
https://codereview.chromium.org/1681493005

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1729523002 .
2016-02-23 09:55:14 -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
Paul Berry 7b4cef6902 Fix broken analyzer tests after 56a9c0d9f1.
Review URL: https://codereview.chromium.org/1708623002 .
2016-02-17 08:56:31 -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 4a99fe9e18 Collect defined elements together with used elements.
We cannot visit CompilationUnitElement and reach local variables and
functions. So, we need another way to know them while generating hints.

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

Review URL: https://codereview.chromium.org/1687573002 .
2016-02-09 12:44:58 -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 c174f4c778 Generate tasks.dot for the new tasks structure.
TBR

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1672323002 .
2016-02-05 18:17:16 -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
Konstantin Shcheglov 217cd8181b Remove unused READY_RESOLVED_UNIT10 and READY_RESOLVED_UNIT11.
...as well as the corresponding tasks that produce them.

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

Review URL: https://codereview.chromium.org/1668993002 .
2016-02-04 13:09:42 -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
Paul Berry f93e2d3212 Remove some summary TODOs that have already been addressed.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1636893003 .
2016-01-26 11:13:10 -08:00
Konstantin Shcheglov 8485e42a27 Record static constant public fields.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1639533003 .
2016-01-26 10:44:21 -08:00
Konstantin Shcheglov b0836ee7b9 Support for constructor references in constant serializer and prelinker.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1633863002 .
2016-01-26 08:23:12 -08:00
Konstantin Shcheglov 013f0066ff Include explicit constructors and static methods into UnlinkedPublicName
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1619253003 .
2016-01-25 09:27:24 -08:00
Paul Berry e97db5219c Store the result of type inference in summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1624853002 .
2016-01-25 08:04:50 -05:00
Paul Berry 52386076f5 Drop implicit types from summaries.
Previously, implicit types were serialized in the summary as
references to `dynamic`.  Now, we simply omit the types from the
summary and the dynamic type is inferred at resynthesis time.

This should reduce the summary size and simplify the implementation of
inferred types.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1622673002 .
2016-01-22 14:57:33 -05:00
Paul Berry d1f3290c38 Use the explicit string 'void' to refer to void in summaries.
Previously we used a null EntityRef as a special case to mean "void".
This saved a tiny amount of space in the summary file, but it's not
worth it because (a) it will complicate some error handling scenarios,
and (b) it would be more worthwhile to use a null EntityRef to
represent implicit types.  Both (a) and (b) will be addressed in
future CLs.

This CL changes "void" so that it's serialized as though it were
defined in the defining compilation unit of each library.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1625543002 .
2016-01-22 13:26:35 -05:00
Paul Berry ef3935b590 Use the explicit string 'dynamic' to refer to dynamic in summaries.
Previously we used reference 0 as a special case to mean "dynamic".
This saved a tiny amount of space in the summary file, but it's not
worth it because it will complicate some error handling scenarios
(which will be addressed in future CLs).

This CL changes "dynamic" so that it's serialized as though it were
defined in the defining compilation unit of each library.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1621763002 .
2016-01-22 12:57:01 -05:00
Paul Berry dd209aa19c Rename TypeRef to EntityRef.
Now that we're storing constants in the summary, the we can have
legitimate references to things other than types.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1619913005 .
2016-01-21 17:53:59 -05:00
Paul Berry 5e27219e9a Modify summary codegen so that builder getters return builders.
This should allow more flexibility in the code that creates summaries,
since it will be possible to things like:

    FooBuilder foo = new FooBuilder(bar: new BarBuilder);
    foo.bar.baz = ...;

(Previously this would have been disallowed because foo.bar would have
returned a `Foo` rather than a `FooBuilder`, and the `Foo` class doesn't
have a setter for `baz`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1606283003 .
2016-01-21 11:26:53 -08:00
Konstantin Shcheglov b0704262d9 Generate documentation for enumeration values.
I missed it previous time, now noticed that format.dart does not change
when I update the idl.dart file constant operations.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1617123002 .
2016-01-21 10:59:49 -08:00
Konstantin Shcheglov 709cbcd76c Add named arguments support into constant ASTs.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1616023002 .
2016-01-21 10:25:44 -08:00
Konstantin Shcheglov 2d47247b73 Serialize long integers as unsigned 32-bit pieces.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1612863002 .
2016-01-21 08:26:01 -08:00
Konstantin Shcheglov 6794b47c38 Use Uint32 for int in IDL.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1615453002 .
2016-01-20 14:40:44 -08:00
Konstantin Shcheglov 0a495243c6 Validate that int values that we write to summaries are >= 0.
Also make tweaks for TestTypeProvider to ensure that this is true.

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

Review URL: https://codereview.chromium.org/1605763007 .
2016-01-20 13:38:10 -08:00
Paul Berry c6dd4a3967 Add propagated types to summary files.
Note: the prelinker doesn't support type propagation, since type
propagation may require looking at files beyond direct imports and the
transitive closure of exports.  However, to pave the way for a future
implementation of a full linker, we still maintain the distinction
between linked and unlinked data.  The unlinked data for a propagated
type is simply a unique "slot id" for each type in the compilation
unit which may be propagated.  The linked data is the propagated type
to fill into each slot, if any.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1610043002 .
2016-01-20 06:36:04 -08:00
Paul Berry 1db9d760fc Rename UnlinkedTypeRef to TypeRef.
This data structure is going to be re-used in the "linked" section of
summaries to refer to propagated and inferred types.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1610003002 .
2016-01-19 18:52:05 -08:00
Konstantin Shcheglov 07f8831bc2 Serialize constant initializers.
No implementation for element references in this CL.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1602203004 .
2016-01-19 13:42:51 -08:00
Konstantin Shcheglov 028254cea1 Generate code UnlinkedConst / UnlinkedConstOperation.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1596703002 .
2016-01-17 08:58:35 -08:00
Konstantin Shcheglov 6f5082ea7c Generate enum readers.
This is just nicer for the clients, plus also will allow us to use
these readers in lists.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1589823007 .
2016-01-15 15:05:56 -08:00
Paul Berry a07b997e63 Downplay the distinction between linked and prelinked summaries.
Following a discussion on Tuesday, we've decided to only deal with the
distinction between linked and unlinked information in the summary
definition for now.  This should allow fully-linked information (such as
constant evaluation, propagated types, and inferred types) to be added
to summaries without much trouble.

The distinction is preserved in the prelinker (which can't currently
handle fully-linked information), and to some degree it will be
preserved in unit tests (to minimize future churn).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1584313005 .
2016-01-14 16:58:03 -08:00
Paul Berry ba31abe429 Use constructor args in favor of summary "encode" functions.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1585973004 .
2016-01-14 09:30:04 -08:00
Paul Berry 834263789f Include the export namespace in the prelinked summary.
This prevents having to traverse the transitive closure of exports
when resynthesizing a library from its summary.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1589573003 .
2016-01-13 13:16:23 -08:00
Paul Berry c1642e9d9f Make summary builder classes implement summary interfaces.
This allows for easier unit testing, since we can use a builder class
directly rather than having to serialize and deserialize it.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1581993002 .
2016-01-13 08:54:48 -08:00