Commit Graph

31 Commits

Author SHA1 Message Date
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Aske Simon Christensen cec963f028 The current growth strategy for growable arrays allocates a backing array of size 2 at (empty) creation and doubles the size whenever the capacity is insufficient while adding elements.
I collected statistics for the sizes and capacities of growable arrays which are promoted to old-space or survive an old-space gc when running dart2js and Fasta. For these applications, the vast majority of arrays stay empty. More than half of the total object size of promoted backing arrays is backing for empty growable arrays.

Furthermore, since the overhead for an array is 3 words (header, type parameters and length), and object sizes are rounded up to an even number of words, we waste one word for all even-sized arrays.

This CL changes the growth strategy so that empty growable arrays are created with a shared, zero-sized array as backing, avoiding the allocation of a backing array if no elements are added. When the array needs to grow, it starts out at 3 and grows to double size plus one each time: 7, 15, 31, ...

A few places in the VM code need to handle these shared, zero-sized arrays specially. In particular, the Array::MakeArray function needs to allocate a new, empty array if its result is to be returned to Dart code.

Benchmarks suggest that the change improves memory usage by a few percent overall and does not significantly affect run time.

BUG=
R=erikcorry@google.com

Review-Url: https://codereview.chromium.org/2949803002 .
2017-06-22 10:51:54 +02:00
Erik Corry aa6353b6da Dart SDK Spelling b, c, and d.
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +02:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -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
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
Srdjan Mitrovic ab20fa00da Move no_callback_scope_depth_ and cha_ from isolate -> thread
Add checks for background compilation:
- Dart code may not be invoked
- Object allocation must happen in old space

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1401413002 .
2015-10-13 14:29:43 -07:00
Srdjan Mitrovic 5039117f50 Remove isolate parameter when allocating handles
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1401643002 .
2015-10-12 15:51:06 -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
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
Lasse R.H. Nielsen d3013cfd35 Fix typos of "function".
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1210483002.
2015-06-24 12:36:34 +02:00
hausner@google.com 0bbf6c5b16 Runtime support for evaluation of static field initializer expressions
Eliminates the generation of field initializer functions by the parser.
Adds a runtime call that creates a one-shot function to evaluate the
initializer of a static field. The runtime function gets called from
the implicit static getter function for the field.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39387 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-19 21:53:44 +00:00
asiva@google.com b310daf72a Change Dart_QualifiedTypeName to use VM code directly and not use the dart api function
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32386 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-06 21:42:35 +00:00
fschneider@google.com ce9573722c VM: Fix checked mode crash (issue 13831).
The AST for static getters differs between parsing the first time, and
subsequent parsings. This leads to a mismatch in deoptimization-ids
between the optimized and the unoptimized code.

This CL avoids creating different ASTs for the same static getters. To allow
better inlining of these getters, the initialization expression is wrapped in a
hidden static initializer-function. As a result the size of such getters is
constant and does not depend on the initializer expression.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29680 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 16:49:55 +00:00
jacobr@google.com 761c1de735 Fix to asiva's code review comments on TBR Cl.
BUG=
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29390 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-28 20:23:19 +00:00
jacobr@google.com 80f92dc265 Add Dart_LibraryId method unblocking landing 45613003. TBR
BUG=
R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29318 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-26 22:55:43 +00:00
rmacnak@google.com 0d6cfb77bd Remove Dart_[Qualified]ClassName.
Review URL: https://codereview.chromium.org//24252014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27724 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 21:17:19 +00:00
rmacnak@google.com b11c4dfda4 Qualify calls from embedding API functions to other embedding API functions to appease the Windows build.
TBR

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27719 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 18:48:09 +00:00
rmacnak@google.com 89d5616468 Never return a Dart_Handle on a dart::Class from the embedding API.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27715 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 18:29:56 +00:00
rmacnak@google.com 2e07b29fd2 Make Dart_FunctionOwner return handles on Types rather than Classes.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27541 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-17 01:10:45 +00:00
rmacnak@google.com c7460aff0f Add Dart_QualifiedClassName.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27539 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-17 00:06:28 +00:00
hausner@google.com fd57843900 Update handling of ambiguous name references
Update VM to latest spec. Referencing a name that is imported
from more than one library is no longer a compile-time error.
If one of the sources of an ambiguous reference is a dart library,
the dart library declaration is automatically hidden.

Also fixes a bug where looking up a getter name in a library
found the getter even though the name is filtered out in the
'hide' combinator.

Long-term we should fix the need for repeatedly convert between
the mangled getter and setter names and the untangled name.

Fixes 12915, 12913, 12724.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27312 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 21:52:40 +00:00
rmacnak@google.com e37a1b46a7 Remove unused functions from dart_mirrors_api.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25749 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-02 22:28:10 +00:00
regis@google.com 9581071936 Refactor resolution code in the vm to properly handle ambiguity errors.
Add test.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25324 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 00:19:39 +00:00
regis@google.com 191d2673c8 Use proper internal name for implicit static final getters.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25053 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-16 16:29:59 +00:00
regis@google.com 71f88546cc Stop resolving classes prematurely in the vm (issue 11023).
Add missing class finalization to mirrors tests.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24965 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-12 17:59:17 +00:00
asiva@google.com e16291b973 Convert implementation in mirrors.cc to use Dart_GetType instead of Dart_GetClass.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24491 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 21:30:18 +00:00
fschneider@google.com 0bf7251d1a Reland: Optimizing noSuchMethod invocation with no arguments.
This is the same CL as https://codereview.chromium.org/17315008/ with
one bug fixed:

If a method is invoked with a mismatching number of arguments, we don't
add a no-such-method-dispatcher function since the dispatcher currently
can only invoke noSuchMethod and would not work if the method
is invoked with correct arguments at a later point.

I extended the test to cover that case.

TEST=tests/language/no_such_method_dispatcher_test.dart
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24351 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 17:18:51 +00:00
fschneider@google.com 48555c83ac Back out r24266 to investigate dartium test failure.
TBR=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24284 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 11:56:32 +00:00
fschneider@google.com ab1981b421 Optimizing noSuchMethod invocation with no arguments.
On each call that triggers a noSuchMethod invocation we 
attach a custom dispatch function that allocates the 
invocation object and invokes noSuchMethod. This dispatcher
is compiled and optimized like a normal Dart function.

Similar to method-extractors, these implicit dispatchers
do not show up as normal functions.

As a first step this CL only handles invocations of getters
and methods with no like o.foo or o.foo().  This CL gives
a >25x speedup of such noSuchMethod invocations. Calls with
multiple arguments still go through the slow path.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24266 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 07:31:51 +00:00
asiva@google.com 51651ee00b Split dart_api.h into multiple parts:
dart_api.h - Has the core API functions
dart_mirrors_api.h - Has API functions to support Mirrors or reflection
dart_native_api.h - Has parts which support the native message handling,
                    profilling and other internal tools

R=sgjesse@google.com, vsm@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24062 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 23:47:40 +00:00