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
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
Lasse R.H. Nielsen
d755dd65b9
Update range errors to agree on the numbers.
...
Also ensure that typed-data errors are consistent with other lists.
Fixes issue #24295
BUG= http://dartbug.com/24295
R=floitsch@google.com , iposva@google.com , sra@google.com
Review URL: https://codereview.chromium.org//1318943005 .
2015-09-11 13:05:36 +02:00
srdjan@google.com
6a524865a1
Remove public int.is64Bit.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//1105453003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45407 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 18:53:05 +00:00
lrn@google.com
a8036defab
Ensure that native function throws on bad argument instead of aborting.
...
Review URL: https://codereview.chromium.org//1072193006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45343 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 12:40:45 +00:00
lrn@google.com
f139d0e93b
Add List.unmodifiable constructor.
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1056353004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45334 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 10:48:22 +00:00
vegorov@google.com
c431dbcb3f
Cleanup throwing of the RangeError in the runtime to remove duplicated code.
...
Improve List._copyFromObjectArray native performance for large arrays by using PassiveObject instead of Object.
R=iposva@google.com
BUG=
Review URL: https://codereview.chromium.org//533483003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39911 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-05 13:15:56 +00:00
lrn@google.com
0dbb989cb8
Add internal operation that converts a growable list to a fixed list.
...
The conversion breaks the original list, but doesn't copy data.
Currently only used in List.from(Iterable).
BUG= http://dartbug.com/9458
R=floitsch@google.com , iposva@google.com
Review URL: https://codereview.chromium.org//134893003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32896 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 13:15:16 +00:00
regis@google.com
7830430adf
Implement eager instantiation and canonicalization of type arguments at run
...
time using a cache in uninstantiated type arguments.
Remove InstantiatedTypeArguments class.
Fix a bug in optimized code: do not update unused type test cache for Smi.
Fix a bug in optimized code on ARM and MIPS in type test cache lookup.
R=iposva@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//154393003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32447 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 19:54:33 +00:00
iposva@google.com
e7e2e4bf03
- Rename arrays to lists:
...
_ObjectArray -> _List
_GrowableObjectArray -> _GrowableList
_ImmutableArray -> _ImmutableList
R=srdjan@google.com
Review URL: https://codereview.chromium.org//25813002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28189 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-03 00:15:14 +00:00
fschneider@google.com
965819aed9
Inline native setters for length and data in the optimizer.
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org//18292003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24801 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-08 16:27:46 +00:00
srdjan@google.com
dd9806e023
Fix crashes in debug mode with optimizations turned off.
...
Remove wrong assert. The correct assertion is done within SetTypeArguments.
Review URL: https://codereview.chromium.org//14307007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22079 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-26 18:19:45 +00:00
asiva@google.com
8af296c9c8
Cleanup the exceptions create code to use Arrays instead GrowableArrays so
...
that it is consistent with the DartEntry invoke code that it calls finally.
Review URL: https://codereview.chromium.org//11639007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16295 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 23:47:35 +00:00
regis@google.com
dd6a0ec349
Rename GET_NATIVE_ARGUMENT macro to GET_NON_NULL_NATIVE_ARGUMENT.
...
Introduce new GET_NATIVE_ARGUMENT macro accepting null.
Add test.
Review URL: https://codereview.chromium.org//11468016
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15919 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 17:59:40 +00:00
hausner@google.com
7eb3efc2ba
Fix native argument handling
...
Native functions need to fetch arguments differently if they are
called through a closure.
fixes issue 6696.
Review URL: https://codereview.chromium.org//11293290
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14937 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-15 01:14:01 +00:00
lrn@google.com
7e6ae8ea09
Renaming IndexOutOfRangeException to RangeError.
...
It now extends ArgumentError.
Review URL: https://codereview.chromium.org//11275042
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14405 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 13:46:30 +00:00
turnidge@google.com
14f614da12
Use the return value of vm native methods to set the return value,
...
based on Siva's earlier suggestion (he actually suggested putting it
in the generated stub, which I haven't done).
Added SetReturnUnsafe and use it exactly one place so far.
Review URL: https://chromiumcodereview.appspot.com//10874072
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11633 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 17:41:19 +00:00
asiva@google.com
8f208ad7ca
Wire GrowableArray to use the internal VM object.
...
This also fixes issue (5526318 : Make access to GrowableArray objects through the dart api more efficient)
Review URL: https://chromiumcodereview.appspot.com//10012042
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6341 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-09 21:50:53 +00:00