cf7a63afe6
Account for the size of the a generative constructor factory. The factory evaluates all the initializers up the inheritance/mixin chain, allocates the object, and then calls all the constructors down the inheritance chain. All this is missed by the old code looking at the immediate constructor body, sometimes causing extremely large constructors to be inlined. Change-Id: I8803b0f4b4155dec0f7878fd5527c1dd507b9c80 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153560 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com>
53 lines
1.3 KiB
Dart
53 lines
1.3 KiB
Dart
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// @dart = 2.7
|
|
|
|
/*member: main:[]*/
|
|
main() {
|
|
_var1;
|
|
_var2;
|
|
_var3;
|
|
}
|
|
|
|
var _var1 = <String>[_shortString(), _longStringMany()];
|
|
var _var2 = <String>[_shortString(), _longStringMany(), _longStringOnce()];
|
|
|
|
/*member: _shortString:[_var1,_var2]*/
|
|
String _shortString() => r"""
|
|
hello""";
|
|
|
|
/*member: _longStringMany:[]*/
|
|
String _longStringMany() => r"""
|
|
I wandered lonely as a cloud
|
|
That floats on high o'er vales and hills,
|
|
When all at once I saw a crowd,
|
|
A host, of golden daffodils;
|
|
Beside the lake, beneath the trees,
|
|
Fluttering and dancing in the breeze.
|
|
""";
|
|
|
|
/*member: _longStringOnce:[_var2]*/
|
|
String _longStringOnce() => r"""
|
|
Continuous as the stars that shine
|
|
And twinkle on the milky way,
|
|
They stretched in never-ending line
|
|
Along the margin of a bay:
|
|
Ten thousand saw I at a glance,
|
|
Tossing their heads in sprightly dance.
|
|
""";
|
|
|
|
var _var3 = <int>[Foo().a, (Foo()..a).a];
|
|
|
|
/*member: Foo.:[_var3:Foo]*/
|
|
class Foo {
|
|
int z = 99;
|
|
/*member: Foo.a:[_var3]*/
|
|
get a => b;
|
|
/*member: Foo.b:[_var3]*/
|
|
get b => c;
|
|
/*member: Foo.c:[]*/
|
|
get c => z++;
|
|
}
|