Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vm/tfa] Infer type for indexing into a const list
Before: DartNTZ.NTZ32(RunTime): 351.9357010381841 us. DartNTZ.NTZ64(RunTime): 351.99127771911304 us. After: DartNTZ.NTZ32(RunTime): 150.19256867162275 us. DartNTZ.NTZ64(RunTime): 149.48622578475337 us. Issue: #37789 Change-Id: Ie8b16b2602a15140df9f0f21199ee9eb2bbf158c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115012 Reviewed-by: Aart Bik <ajcbik@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Samir Jindel <sjindel@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
- Loading branch information
1 parent
11a4091
commit 011144b
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
pkg/vm/testcases/transformations/type_flow/summary_collector/constants.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2019, 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. | ||
|
||
smiLiteral() => 42; | ||
|
||
intLiteral() => 0x8000000000000000; | ||
|
||
strLiteral() => 'abc'; | ||
|
||
const _constList1 = [1, 2, 3]; | ||
indexingIntoConstantList1(int i) => _constList1[i]; | ||
|
||
const _constList2 = ['hi', 33, null, -5]; | ||
indexingIntoConstantList2(int i) => _constList2[i]; | ||
|
||
main() {} |
25 changes: 25 additions & 0 deletions
25
pkg/vm/testcases/transformations/type_flow/summary_collector/constants.dart.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
------------ #lib::smiLiteral ------------ | ||
|
||
RESULT: _T (dart.core::_Smi) | ||
------------ #lib::intLiteral ------------ | ||
|
||
RESULT: _T (dart.core::int*)+ | ||
------------ #lib::strLiteral ------------ | ||
|
||
RESULT: _T (dart.core::_OneByteString) | ||
------------ #lib::indexingIntoConstantList1 ------------ | ||
%i = _Parameter #0 [_T (dart.core::int*)+?] | ||
RESULT: _T (dart.core::_Smi) | ||
------------ #lib::indexingIntoConstantList2 ------------ | ||
%i = _Parameter #0 [_T (dart.core::int*)+?] | ||
t1 = _Join [dart.core::Object*] (_T (dart.core::_OneByteString), _T (dart.core::_Smi), _T {}?) | ||
RESULT: t1 | ||
------------ #lib::main ------------ | ||
|
||
RESULT: _T {}? | ||
------------ #lib::_constList1 ------------ | ||
|
||
RESULT: _T (dart.core::_ImmutableList) | ||
------------ #lib::_constList2 ------------ | ||
|
||
RESULT: _T (dart.core::_ImmutableList) |