Commit Graph

277 Commits

Author SHA1 Message Date
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
Srdjan Mitrovic 0c77e70b49 Cleanup access to guarded_fields
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1712563006 .
2016-02-19 11:07:44 -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
Matthias Hausner 783cc8acae Parser recursion check
Let the parser issue a compile-time error when the C stack is about to overflow, instead of crashing the VM.

BUG=24476
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1620493002 .
2016-01-22 08:59:45 -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
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
Florian Schneider 4a037f0ccb VM: Use read-only handle Object::dynamic_type() where possible.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1528873002 .
2015-12-16 11:31:53 +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
Matthias Hausner 019a4e4e5c Add flag which moves super initializer statement
--move_super directs the VM compiler to move the super initializer
of a constructor to the end of the initializer list. The default
value is false. If we opt to enable this functionality, the implicit
phase parameter of constructors can be eliminated, simplifying
constructors significantly.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1382533003 .
2015-10-07 10:26:22 -07:00
Matthias Hausner d3a2f619bb Fix compiler stats
Prints the stats into a zone-allocated string that can either be dumped to the console, or displayed as a whole in the observatory.

Distinguish token consumption between class parsing and function parsing when compiling.

Change stat counter macros use thread instead of isolate.

Review URL: https://codereview.chromium.org//1300033002 .
2015-09-04 13:13:56 -07:00
Matthias Hausner f286b5b8b6 Moar constant caching
Insert all compile-time constants expression in the constant cache.

BUG=

Review URL: https://codereview.chromium.org//1303973007 .
2015-09-01 14:42:53 -07:00
Srdjan Mitrovic f857c1ba8e Remove more GrowableObjectArray usage in parser
Allocate appropriate data structures in old space from beginning

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1316373002 .
2015-08-27 13:46:32 -07:00
Matthias Hausner 62e9d05668 Introduce per-isolate cache for compile time constants
Compile-time constant values are maintained in a cache, keyed
by script and token position. When the same code is compiled
again later, e.g. by the optimizing compiler, the value is
found in the cache and does not need to be computed again.

In this version, the key is a string concatenated from the
script url and the token position. That’s probably more overhead
than we want.

Added two compiler stat counters for number of cached constants
and number of cache hits. Running dart2js to compile a hello world
program results in about 1400 cached values and 85 cache hits.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1308073005 .
2015-08-26 16:17:20 -07:00
Srdjan Mitrovic 5985718945 Clean up default parameter computation in parser
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1316763002 .
2015-08-25 14:54:48 -07:00
Srdjan Mitrovic 304dc3486f Make default_parameter_values a ZoneGrowableArray instead of an array in new space
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1307943008 .
2015-08-24 17:22:44 -07:00
Srdjan Mitrovic fcea0077cc Minor cleanup in preparation for removal of allocation in new space, and removal of an 'optimization'
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1310383002 .
2015-08-24 13:40:32 -07:00
Daniel Andersson bc149bf2f5 Migrate most uses of StackZone(Isolate*) to Thread*.
Also migrate some HANDLESCOPE uses.
This prepares for concurrent compilation.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1285293004 .
2015-08-13 13:11:30 -07:00
Matthias Hausner fc55f38aaf Fix ??= AST modification.
BUG=23988
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1273033007 .
2015-08-11 13:13:56 -07:00
Daniel Andersson ecccff2566 Refactor VMTagScope to Thread* rather than Isolate*.
Prepares for per-thread vm tags, but only changes the interface for now.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1284713003 .
2015-08-10 10:43:30 -07:00
Matthias Hausner 4ebab25d8f Implement constructor closures
One detail that isn't implemented yet is canonicalization of constructor tear-offs. At the moment, two tear-offs of the same constructor result in closures that are not equal.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1255063005 .
2015-08-03 15:50:46 -07:00
Matthias Hausner f1da09741d Implement tear-off closure operator #
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1234883005 .
2015-07-22 12:50:36 -07:00
Daniel Andersson 700bd54362 Remove more uses of Isolate::current_zone.
The most substantial change is in Parser and ParsedFunction, which now cache their calling thread. (A similar change was tried unsuccessfully in the past, but can now be safely implemented thanks to the ThreadRegistry state saving.)

Only remaining users are the Object::Handle(Isolate*, [...]) methods. Then, this deprecated interface will be removed.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1242343002 .
2015-07-21 09:37:23 -07:00
Srdjan Mitrovic d503d2f0ed Added full deferred loading semantic to precompiled/--noopt/eager-loading code (some corner cases, e.g., compile-time errors for constants, still missing)
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1211273011 .
2015-07-09 10:56:55 -07:00
Matthias Hausner 0535e37619 Implement ?? ??= and ?. operators
BUG=23455
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1180903002.
2015-06-18 11:05:16 -07:00
Regis Crelier 601da25b92 Fix issue 23500
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1146993003
2015-05-29 13:31:16 -07:00
hausner@google.com 9db5059098 Fix CompilerStats info
Move the counters and timers into the isolate. Statically allocated data
does not work anymore now that we always have multiple isolates.

Remove unused counters, add some counters to measure size of compiled code
and meta info.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45751 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 23:03:48 +00:00
hausner@google.com 1890e567fe Simplification in resolving classes
The helper functions in Parser to resolve classes in the library
and prefix scope created an unnecessary handlescope. With libraries
caching previous lookups, and with namespaces now using dictionaries,
there are just a handful (so to speak) of handles allocated for the
lookup. That does not warrant a handlescope. Removed the helper
functions.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45399 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 15:45:54 +00:00
hausner@google.com 21ca62f8bc Properly resolve top-level setters
Fixes issue 4386.

When converting a getter to a setter (converting a right-hand
side expression to a left-hand side, assignable entity),
we need to know where to look for the setter function.
Top-level setters need to be resolved in the library or prefix
scope in which the getter was found.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45316 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-21 17:36:34 +00:00
regis@google.com 8b73c2a3e5 Simplify restoring of saved try contexts in async code by passing around the
relevant variables instead of scopes and try indices.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45081 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 22:15:00 +00:00
hausner@google.com aa75044ff7 Fix spurious resume when awaiting future in async* code
Fixes issue reported in bug 23116.

The equivalent fix for dart2js contains a test case for this.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44985 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-08 22:09:20 +00:00
hausner@google.com 0b99d6dc95 Better error messages when matching parens and braces
Tell user where the mismatched closing paren or brace
opens.

Fix for 22820 and improvement for (previously closed) 2936

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44882 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-03 17:07:25 +00:00
koda@google.com 549c74a3da Avoid caching thread in parser.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44854 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-02 01:14:31 +00:00
hausner@google.com f5339aaabb Add the implicit return in the correct sequence node
Make sure we add the implicit return node into the sequence
node that contains the function’s code. Previously, we added
the implicit return in the outermost sequence. If the outermost
sequence is at a different context level than the sequence that
contains the function’s code, the debugger cannot access the
captured variables when stopped at the return statement.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44826 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-31 22:11:06 +00:00
fschneider@google.com 76f5627abd Compile implicit closures as dispatchers instead of duplicating the original method's code.
This saves space in unoptimized code for implicit closures. In optimized code the
original method's code will often be inlined into the implicit closure dispatcher so that
there won't be a performance impact.

The static case just calls the original method. For implicit instance closures, the
this-parameter is loaded from the context and passed to the original method.


The coverage test is affected since the dispatcher has the original method's token position
associated with it. This means that the line with the method declaration is considered to
have executable code. Setting the token position to 0 (Scanner::kNoSourcePos) does not work
because it coincides with the first line (and first token) in the script.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44655 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-24 09:33:36 +00:00
hausner@google.com b88c3ee1b8 Fix await/async/yield keyword recognition
Fixes issue 22870.

The VM parser didn’t distinguish between await and “await”.

Added some additional symbol recognition cleanup which should speed up parsing.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44540 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 17:26:58 +00:00
rmacnak@google.com e1bbc90322 Display call site data for functions.
- Requested with coverage data, only in function view for now.
 - Adjust token position associated with ICData to correspond to the identifier instead of the open paren.
 - Fix JSONifying ICs for static/constructor calls.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44476 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 20:44:41 +00:00
regis@google.com c502cb8371 Fix more async machinery (issue 22579 and possibly more to be triaged).
Add regression test.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44250 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 00:42:17 +00:00
fschneider@google.com d0ca8036a2 Fix VM bug with super-constructor invocation and mixins.
When using mixins, the constructor of a super-class was incorrectly
invoked twice if the super() call was not at the end of the initializer
list.

When generating the super constructor call in an implicit constructor, pass
along the phase parameter that comes in instead of invoking all phases.

BUG=dartbug.com/22604
TEST=tests/language/constructor_with_mixin_test.dart
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44242 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 18:02:40 +00:00
regis@google.com 17f01a0489 Fix more async machinery (capture return value when necessary, issue 22620).
Review URL: https://codereview.chromium.org//981433002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44216 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 02:08:52 +00:00
regis@google.com 5cb782b7fb Fix async machinery for finally clauses (issues 22445, 22300).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44210 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 23:55:18 +00:00
regis@google.com 8618df1864 One more fix to async machinery (rethrow in finally, issue 22595).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44189 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 18:34:01 +00:00
hausner@google.com 9a6ed9a718 Implement async* functions in VM
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44185 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 17:49:53 +00:00
regis@google.com 0036014d8a Fix async machinery (issue 22445 and possibly others to be triaged later).
R=hausner@google.com, iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44107 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 22:19:47 +00:00
regis@google.com afd4864b0e Save exception and stack trace variables in async catch clauses and use them
in rethrow statements (fix issue 22523).

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44001 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:05:35 +00:00
regis@google.com 3caf1669dc Fix indentation of parser trace (several threads may compile at once).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43885 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 18:54:24 +00:00
hausner@google.com 2487c76886 Add support for sync* and yield and yield*
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43516 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 18:36:40 +00:00
koda@google.com 99127744c6 Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces.
Remove deprecated Isolate-based BitVector constructor.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43136 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 14:54:02 +00:00
johnmccutchan@google.com f216834af8 Expose set_source service command for functions
- Can change signatures
- Currently only works for unexecuted functions.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42124 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-04 23:35:24 +00:00
srdjan@google.com bad6a61899 Cleanups.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42069 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 18:48:12 +00:00
zerny@google.com 8e807c8550 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

Committed: https://code.google.com/p/dart/source/detail?r=41949

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41983 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-26 09:32:43 +00:00