mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:36:59 +00:00
[dart2js] Disable CFE lowering for initialized late statics.
No additional work needs to be done in the late lowering since the existing `_lazy` and `_lazyFinal` mechanisms already do the right thing. Change-Id: I1dd6cb5ce3c882cac5f0206f1cbc87fd53c6fffe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195174 Commit-Queue: Mayank Patke <fishythefish@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
5535b1603f
commit
b23c6fb544
|
@ -62,8 +62,6 @@ int _foldLateLowerings(List<int> lowerings) =>
|
|||
|
||||
/// Late lowerings which the frontend performs for dart2js.
|
||||
const List<int> _allEnabledLateLowerings = [
|
||||
LateLowering.initializedNonFinalStaticField,
|
||||
LateLowering.initializedFinalStaticField,
|
||||
LateLowering.uninitializedNonFinalInstanceField,
|
||||
LateLowering.uninitializedFinalInstanceField,
|
||||
LateLowering.initializedNonFinalInstanceField,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
import "late_statics_lib.dart" as lat;
|
||||
additionalExports = (lat::a,
|
||||
lat::a,
|
||||
|
@ -17,17 +16,11 @@ export "org-dartlang-testcase:///late_statics_lib.dart";
|
|||
class Statics extends core::Object {
|
||||
late static field core::int a;
|
||||
late static final [setter] field core::int b;
|
||||
static field core::int? _#c = null;
|
||||
static field core::int? _#d = null;
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
synthetic constructor •() → self::Statics
|
||||
: super core::Object::•()
|
||||
;
|
||||
static get c() → core::int
|
||||
return let final core::int? #t1 = self::Statics::_#c in #t1 == null ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
|
||||
static set c(core::int #t2) → void
|
||||
self::Statics::_#c = #t2;
|
||||
static get d() → core::int
|
||||
return let final core::int? #t3 = self::Statics::_#d in #t3 == null ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in self::Statics::_#d == null ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3{core::int};
|
||||
}
|
||||
static method main() → void {
|
||||
self::testUninitializedNonFinalStaticField();
|
||||
|
@ -79,15 +72,8 @@ static method testInitializedFinalTopLevelField() → void {
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as lat;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
late static field core::int a;
|
||||
late static final [setter] field core::int b;
|
||||
static field core::int? _#c = null;
|
||||
static field core::int? _#d = null;
|
||||
static get c() → core::int
|
||||
return let final core::int? #t5 = lat::_#c in #t5 == null ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
|
||||
static set c(core::int #t6) → void
|
||||
lat::_#c = #t6;
|
||||
static get d() → core::int
|
||||
return let final core::int? #t7 = lat::_#d in #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in lat::_#d == null ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
import "dart:_late_helper" as _la;
|
||||
import "late_statics_lib.dart" as lat;
|
||||
additionalExports = (lat::c,
|
||||
|
@ -16,17 +15,11 @@ export "org-dartlang-testcase:///late_statics_lib.dart";
|
|||
class Statics extends core::Object {
|
||||
static final field _la::_Cell a = new _la::_Cell::•();
|
||||
static final field _la::_Cell b = new _la::_Cell::•();
|
||||
static field core::int? _#c = null;
|
||||
static field core::int? _#d = null;
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
synthetic constructor •() → self::Statics
|
||||
: super core::Object::•()
|
||||
;
|
||||
static get c() → core::int
|
||||
return let final core::int? #t1 = self::Statics::_#c in #t1 == null ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
|
||||
static set c(core::int #t2) → void
|
||||
self::Statics::_#c = #t2;
|
||||
static get d() → core::int
|
||||
return let final core::int? #t3 = self::Statics::_#d in #t3 == null ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in self::Statics::_#d == null ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3{core::int};
|
||||
}
|
||||
static method main() → void {
|
||||
self::testUninitializedNonFinalStaticField();
|
||||
|
@ -77,27 +70,18 @@ static method testInitializedFinalTopLevelField() → void {
|
|||
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as lat;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
import "dart:_late_helper" as _la;
|
||||
import "dart:core" as core;
|
||||
|
||||
static final field _la::_Cell a = new _la::_Cell::•();
|
||||
static final field _la::_Cell b = new _la::_Cell::•();
|
||||
static field core::int? _#c = null;
|
||||
static field core::int? _#d = null;
|
||||
static get c() → core::int
|
||||
return let final core::int? #t5 = lat::_#c in #t5 == null ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
|
||||
static set c(core::int #t6) → void
|
||||
lat::_#c = #t6;
|
||||
static get d() → core::int
|
||||
return let final core::int? #t7 = lat::_#d in #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in lat::_#d == null ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:22:23 -> DoubleConstant(-1.0)
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:23:29 -> DoubleConstant(-1.0)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///late_statics.dart:23:25 -> DoubleConstant(-1.0)
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:7:14 -> DoubleConstant(-1.0)
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:8:20 -> DoubleConstant(-1.0)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///late_statics_lib.dart:8:16 -> DoubleConstant(-1.0)
|
||||
Extra constant evaluation: evaluated: 108, effectively constant: 6
|
||||
Extra constant evaluation: evaluated: 62, effectively constant: 4
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
import "late_statics_lib.dart" as lat;
|
||||
additionalExports = (lat::a,
|
||||
lat::a,
|
||||
|
@ -17,17 +16,11 @@ export "org-dartlang-testcase:///late_statics_lib.dart";
|
|||
class Statics extends core::Object {
|
||||
late static field core::int a;
|
||||
late static final [setter] field core::int b;
|
||||
static field core::int? _#c = _in::createSentinel<core::int>();
|
||||
static field core::int? _#d = _in::createSentinel<core::int>();
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
synthetic constructor •() → self::Statics
|
||||
: super core::Object::•()
|
||||
;
|
||||
static get c() → core::int
|
||||
return let final core::int? #t1 = self::Statics::_#c in _in::isSentinel(#t1) ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
|
||||
static set c(core::int #t2) → void
|
||||
self::Statics::_#c = #t2;
|
||||
static get d() → core::int
|
||||
return let final core::int #t3 = self::Statics::_#d in _in::isSentinel(#t3) ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(self::Statics::_#d) ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3;
|
||||
}
|
||||
static method main() → void {
|
||||
self::testUninitializedNonFinalStaticField();
|
||||
|
@ -79,15 +72,8 @@ static method testInitializedFinalTopLevelField() → void {
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as lat;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
late static field core::int a;
|
||||
late static final [setter] field core::int b;
|
||||
static field core::int? _#c = _in::createSentinel<core::int>();
|
||||
static field core::int? _#d = _in::createSentinel<core::int>();
|
||||
static get c() → core::int
|
||||
return let final core::int? #t5 = lat::_#c in _in::isSentinel(#t5) ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
|
||||
static set c(core::int #t6) → void
|
||||
lat::_#c = #t6;
|
||||
static get d() → core::int
|
||||
return let final core::int #t7 = lat::_#d in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(lat::_#d) ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
|
|
|
@ -16,13 +16,10 @@ export "org-dartlang-testcase:///late_statics_lib.dart";
|
|||
class Statics extends core::Object {
|
||||
late static field core::int a;
|
||||
late static final [setter] field core::int b;
|
||||
static field core::int? _#c;
|
||||
static field core::int? _#d;
|
||||
late static field core::int c;
|
||||
late static final field core::int d;
|
||||
synthetic constructor •() → self::Statics
|
||||
;
|
||||
static get c() → core::int;
|
||||
static set c(core::int #t1) → void;
|
||||
static get d() → core::int;
|
||||
}
|
||||
static method main() → void
|
||||
;
|
||||
|
@ -49,8 +46,5 @@ import "dart:core" as core;
|
|||
|
||||
late static field core::int a;
|
||||
late static final [setter] field core::int b;
|
||||
static field core::int? _#c;
|
||||
static field core::int? _#d;
|
||||
static get c() → core::int;
|
||||
static set c(core::int #t2) → void;
|
||||
static get d() → core::int;
|
||||
late static field core::int c;
|
||||
late static final field core::int d;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
import "dart:_late_helper" as _la;
|
||||
import "late_statics_lib.dart" as lat;
|
||||
additionalExports = (lat::c,
|
||||
|
@ -16,17 +15,11 @@ export "org-dartlang-testcase:///late_statics_lib.dart";
|
|||
class Statics extends core::Object {
|
||||
static final field _la::_Cell a = new _la::_Cell::•();
|
||||
static final field _la::_Cell b = new _la::_Cell::•();
|
||||
static field core::int? _#c = _in::createSentinel<core::int>();
|
||||
static field core::int? _#d = _in::createSentinel<core::int>();
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
synthetic constructor •() → self::Statics
|
||||
: super core::Object::•()
|
||||
;
|
||||
static get c() → core::int
|
||||
return let final core::int? #t1 = self::Statics::_#c in _in::isSentinel(#t1) ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
|
||||
static set c(core::int #t2) → void
|
||||
self::Statics::_#c = #t2;
|
||||
static get d() → core::int
|
||||
return let final core::int #t3 = self::Statics::_#d in _in::isSentinel(#t3) ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(self::Statics::_#d) ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3;
|
||||
}
|
||||
static method main() → void {
|
||||
self::testUninitializedNonFinalStaticField();
|
||||
|
@ -77,27 +70,18 @@ static method testInitializedFinalTopLevelField() → void {
|
|||
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as lat;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
import "dart:_late_helper" as _la;
|
||||
import "dart:core" as core;
|
||||
|
||||
static final field _la::_Cell a = new _la::_Cell::•();
|
||||
static final field _la::_Cell b = new _la::_Cell::•();
|
||||
static field core::int? _#c = _in::createSentinel<core::int>();
|
||||
static field core::int? _#d = _in::createSentinel<core::int>();
|
||||
static get c() → core::int
|
||||
return let final core::int? #t5 = lat::_#c in _in::isSentinel(#t5) ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
|
||||
static set c(core::int #t6) → void
|
||||
lat::_#c = #t6;
|
||||
static get d() → core::int
|
||||
return let final core::int #t7 = lat::_#d in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(lat::_#d) ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
|
||||
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
|
||||
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
|
||||
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:22:23 -> DoubleConstant(-1.0)
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:23:29 -> DoubleConstant(-1.0)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///late_statics.dart:23:25 -> DoubleConstant(-1.0)
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:7:14 -> DoubleConstant(-1.0)
|
||||
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:8:20 -> DoubleConstant(-1.0)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///late_statics_lib.dart:8:16 -> DoubleConstant(-1.0)
|
||||
Extra constant evaluation: evaluated: 112, effectively constant: 6
|
||||
Extra constant evaluation: evaluated: 62, effectively constant: 4
|
||||
|
|
Loading…
Reference in a new issue