Commit graph

213 commits

Author SHA1 Message Date
Regis Crelier 4980107a96 Revert "Fix resolution and canonicalization of typedefs and function types..."
Review-Url: https://codereview.chromium.org/2600313002 .
2016-12-27 17:54:00 -08:00
Regis Crelier 291ed0c545 Fix resolution and canonicalization of typedefs and function types in
preparation of the new typedef syntax.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2592263004 .
2016-12-27 16:55:21 -08:00
Florian Schneider 86d62d66f2 Allocate generic types in new-space before canonicalizing.
A previous CL missed the second allocation site (6418f8f36c) in Instance::GetType.

Pass space used in GetType() explicitly to use old-space when invoked from the background compiler.

Fixes #27663.

R=regis@google.com

Review URL: https://codereview.chromium.org/2509013002 .
2016-11-16 12:41:32 -08:00
Zachary Anderson 2e4dfd3a2d clang-format runtime/lib
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2468093007 .
2016-11-04 12:14:41 -07:00
Florian Schneider d99229026e Fix issues with argument evaluation order and noSuchMethod errors.
Fix tests to conform to spec bahavior.

Update dart2js test status.

BUG=#27572
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2416513003 .
2016-10-12 17:04:55 -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
Siva Annamalai 964a659470 - reset 'dirty' flag to false after the libraries mirrors is computed, this ensures that we compute the libraries only when new library modules are loaded and the 'dirty' flag is set to true.
- Use passed in 'zone' argument in the native string functions

- Use passed in 'thread' argument in the library mirror creation functions

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1935703002 .
2016-04-29 15:15:19 -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
Ryan Macnak 71676a1e5b Use exact name lookup for static fields in mirrors.
R=hausner@google.com

Review URL: https://codereview.chromium.org/1877813003 .
2016-04-12 11:15:38 -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 341643cb2b Do not compile a class when the class mirror tries to access the metadata.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1834673003 .
2016-03-28 11:16:15 -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
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
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 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
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 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 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
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
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 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 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
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
Jacob Richman 688b69fb65 Support isExternal method on MethodMirror in the Dart VM. Not really intended for public consumption. switch to using isExternal and using anonymous.
BUG=
R=alanknight@google.com, asiva@google.com

Review URL: https://codereview.chromium.org/1421133003 .
2015-10-29 19:17:08 -07:00
Siva Annamalai 99abe7d883 - Some cleanup of dynamic_type usage.
- Avoid egregious creation of handles in Class::CreateInvocationDispatcher

R=regis@google.com

Review URL: https://codereview.chromium.org/1409113006 .
2015-10-21 17:24:10 -07:00
Srdjan Mitrovic e520dd567f Remove isolate argument from handle allocation: Part I
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1393373003 .
2015-10-12 11:32:08 -07:00
Srdjan Mitrovic 8c7a94e9f4 Preparation for moving reusable handles to thread and more cleanups: isolate -> thread based handle allocation.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1384403002 .
2015-10-06 10:17:12 -07:00
John McCutchan af0ab36f7c Make dart:_vmservice a proper builtin library
- Drops custom resource table for sources.
- Stops loading dart:vmservice library by sources.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1387043002 .
2015-10-06 07:58:14 -07:00
Siva Annamalai 79ef28317f Changes to prepare for allowing script snapshots to be taken after running the main application:
- Rename accessors of class Field to make it more apparent as to what is being accessed (static field values or instance field offsets
- Use precompiled initializer state (Used only during precompilation) to also store saved initial value of static fields (Used only during application snapshot   generation)

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

Review URL: https://codereview.chromium.org//1289643005 .
2015-09-04 11:03:46 -07:00
Ivan Posva 4bd7cdc75c - Ensure that HandleScope is initialized with a thread. (Remove
deprecated isolate based API.)
- Update all code impacted by this change. E.g. DARTSCOPE
- TEST_CASE now passes the current thread as a parameter to the   unit test.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1310463005 .
2015-09-01 17:18:55 -07:00
Ryan Macnak b34267d0d7 Replace is_synthetic bit on Fields with is_reflectable. Mark private fields of dart:* as non-reflectable.
This fixes an inconsistency in mirrors where some classes in dart:* would claim to have a field but throw NSM if one attempts to access it, and prevents accessing private static fields of dart:* that don't have implicit getters or setters.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1280713002 .
2015-08-06 16:48:01 -07:00
Ryan Macnak db8ed04981 Hack around dart:io being loaded into non-service isolates in Dartium.
BUG=http://dartbug.com/23940
R=asiva@google.com

Review URL: https://codereview.chromium.org//1259893006 .
2015-08-03 16:59:32 -07:00
Ryan Macnak 40fcf4a72d Handle field-invocation and method-extraction in the runtime when --lazy_dispatchers=false.
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1195573006.
2015-06-30 15:14:35 -07:00
Ryan Macnak 98b9ff6a30 Fix reflective NoSuchMethodErrors to match their non-reflective counterparts when due to argument mismatches.
BUG=http://dartbug.com/23266
R=asiva@google.com

Review URL: https://codereview.chromium.org//1182613004.
2015-06-16 09:42:11 -07:00
Ryan Macnak 6545e8539e Fix isAssignableTo in VM mirrors to use subtype (<:) rather than moreSpecificThan (<<).
BUG=http://dartbug.com/22852
R=gbracha@google.com

Review URL: https://codereview.chromium.org//1156583005
2015-06-04 12:25:59 -07:00
Ryan Macnak 4102b0c446 Canonicalize mixin type during class finalization. Add asserts that most types are canonical.
R=regis@google.com

Review URL: https://codereview.chromium.org//1167583002
2015-05-29 15:29:04 -07:00
rmacnak@google.com a6e42c48b5 Deal with deferred loading in the VM mirrors.
- Invalidate MirrorSystem.libraries when a load completes.
- Recheck if a deferred import's target has been loaded before failing.
- Allow loading libraries from a LibraryDepedencyMirror.
- Propogate compile-time error when attempting to reflect a deferred type.

BUG=http://dartbug.com/22592
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//1095903002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45444 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-28 23:47:45 +00:00
rmacnak@google.com e2c41789ee Mirrors memory usage tweaks.
- Don't build and cache vestigial members/constructors maps.
- Avoid creating multiple LibraryMirrors for the same library.
- Store infrequently used method flags as a bitfield.
- Don't cache MethodMirror source.

mirrors_reader_test final heap size: 10.8 -> 8.9 MB (-17.5%)
mirrors_reader_test time: 1.55 -> 1.33 seconds (-14.2%)

R=asiva@google.com

Review URL: https://codereview.chromium.org//1080393006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45352 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 17:51:49 +00:00
rmacnak@google.com 9f56280609 Add asserts that isolates have a root library set up before they become runnable.
R=iposva@google.com

Review URL: https://codereview.chromium.org//1073983010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45224 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-17 00:44:47 +00:00
rmacnak@google.com 26548a2f3d Remove some duplication in code that extracts the source for a function.
R=asiva@google.com

Review URL: https://codereview.chromium.org//1071703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45145 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 19:41:38 +00:00
rmacnak@google.com b3f4ce9bd8 Deal with type arguments of generic local functions in VM mirrors.
BUG=http://dartbug.com/14913
R=regis@google.com

Review URL: https://codereview.chromium.org//1072443005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44983 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-08 21:40:51 +00:00
rmacnak@google.com 91a7300cb9 Mark the functions of closures generated to speed up getField/setField as invisible, just like other dispatchers.
BUG=http://dartbug.com/23006
R=asiva@google.com

Review URL: https://codereview.chromium.org//1036393002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44748 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-27 18:09:49 +00:00
rmacnak@google.com 60fd23bffc Treat functions generated for closurization as equivalent to their source functions.
BUG=http://dartbug.com/22601
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//973913002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44674 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-24 20:06:40 +00:00
koda@google.com 9c181ec6d5 Thread/Isolate refactoring: new(Isolate*) -> new(Zone*)
Refactor all remaning cases where the current zone is used through new(Isolate*) and remove this interface.

Removing this interface is needed to move towards multiple threads per isolate, and also makes the caller more aware of the scope of the zone used, reducing the risk of use-after-free.

Make the current thread and the stack zone created around native/runtime entries directly available in their body, saving an indirection (and optimized away if unused).

R=iposva@google.com

Review URL: https://codereview.chromium.org//982873004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44541 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 19:24:26 +00:00
rmacnak@google.com 8b6a6a1e4f Add ClassMirror.isEnum.
BUG=http://dartbug.com/21718
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//938513002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44035 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 01:13:50 +00:00
rmacnak@google.com 4abf50c04d Add LibraryDependencyMirror.isDeferred.
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//921163004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43829 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-17 23:49:40 +00:00
rmacnak@google.com 511c997316 Implement DeclarationMirror.location for all but ParameterMirrors.
- Mark NativeFieldWrapper classes as synthetic.
- Mark ClassID fields as synthetic.

BUG=http://dartbug.com/22378
R=gbracha@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//922023002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43784 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-13 23:32:20 +00:00
rmacnak@google.com 4de5f89b99 Rename IsConstructor to IsGenerativeConstructor.
This matches the terminology in the spec, and it avoids confusion with the function kind kConstructor, which indicates either a generative constructor or a factory constructor.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//910313002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43673 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-11 00:59:19 +00:00