Skip to content

Commit 7a2a396

Browse files
author
Dart CI
committed
Version 2.12.0-98.0.dev
Merge commit 'd2b5aad64aaca693aafdb9005e3f9b87fc976941' into 'dev'
2 parents 02aa785 + d2b5aad commit 7a2a396

File tree

9 files changed

+80
-32
lines changed

9 files changed

+80
-32
lines changed

pkg/dartdev/lib/src/analytics.dart

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,21 @@ import 'package:usage/usage_io.dart';
1515
const String analyticsNoticeOnFirstRunMessage = '''
1616
╔════════════════════════════════════════════════════════════════════════════╗
1717
║ The Dart tool uses Google Analytics to anonymously report feature usage ║
18-
║ statistics, and crash reporting to send basic crash reports. This data is ║
19-
║ used to help improve the Dart platform and tools over time. ║
18+
║ statistics and to send basic crash reports. This data is used to help ║
19+
║ improve the Dart platform and tools over time. ║
20+
║ ║
21+
║ To disable reporting of anonymous analytics, run: ║
22+
║ ║
23+
║ dart --disable-analytics ║
2024
║ ║
21-
║ To disable reporting of anonymous tool usage statistics in general, run ║
22-
║ the command: `dart --disable-analytics`. ║
2325
╚════════════════════════════════════════════════════════════════════════════╝
2426
''';
2527
const String analyticsDisabledNoticeMessage = '''
2628
╔════════════════════════════════════════════════════════════════════════════╗
27-
║ Anonymous analytics disabled. To enable again, run the command: ║
28-
║ `dart --enable-analytics` ║
29+
║ Anonymous analytics reporting disabled. In order to enable it, run: ║
30+
║ ║
31+
║ dart --enable-analytics ║
32+
║ ║
2933
╚════════════════════════════════════════════════════════════════════════════╝
3034
''';
3135
const String _appName = 'dartdev';
@@ -34,8 +38,8 @@ const String _settingsFileName = 'dartdev.json';
3438
const String _trackingId = 'UA-26406144-37';
3539
const String _readmeFileName = 'README.txt';
3640
const String _readmeFileContents = '''
37-
The present directory contains user-level settings for the
38-
Dart programming language (https://dart.dev).
41+
This directory contains user-level settings for the Dart programming language
42+
(https://dart.dev).
3943
''';
4044

4145
const String eventCategory = 'dartdev';
@@ -55,8 +59,10 @@ Analytics createAnalyticsInstance(bool disableAnalytics) {
5559
if (disableAnalytics) {
5660
// Dartdev tests pass a hidden 'disable-dartdev-analytics' flag which is
5761
// handled here.
58-
// Also, stdout.hasTerminal is checked, if there is no terminal we infer that
59-
// a machine is running dartdev so we return analytics shouldn't be set.
62+
//
63+
// Also, stdout.hasTerminal is checked; if there is no terminal we infer
64+
// that a machine is running dartdev so we return that analytics shouldn't
65+
// be set enabled.
6066
return DisabledAnalytics(_trackingId, _appName);
6167
}
6268

pkg/scrape/lib/scrape.dart

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class Scrape {
5050
int get scrapedLineCount => _scrapedLineCount;
5151
int _scrapedLineCount = 0;
5252

53+
/// The number of files that could not be parsed.
54+
int get errorFileCount => _errorFileCount;
55+
int _errorFileCount = 0;
56+
5357
final Map<String, Histogram> _histograms = {};
5458

5559
/// Whether we're in the middle of writing the running file count and need a
@@ -151,10 +155,22 @@ class Scrape {
151155
histogram.printCounts(name);
152156
});
153157

158+
String count(int n, String unit) {
159+
if (n == 1) return '1 $unit';
160+
return '$n ${unit}s';
161+
}
162+
154163
var elapsed = _formatDuration(watch.elapsed);
155-
var lines = _scrapedLineCount != 1 ? '$_scrapedLineCount lines' : '1 line';
156-
var files = _scrapedFileCount != 1 ? '$_scrapedFileCount files' : '1 file';
157-
print('Took $elapsed to scrape $lines in $files.');
164+
var lines = count(_scrapedLineCount, 'line');
165+
var files = count(_scrapedFileCount, 'file');
166+
var message = 'Took $elapsed to scrape $lines in $files.';
167+
168+
if (_errorFileCount > 0) {
169+
var errors = count(_errorFileCount, 'file');
170+
message += ' ($errors could not be parsed.)';
171+
}
172+
173+
print(message);
158174
}
159175

160176
/// Display [message], clearing the line if necessary.
@@ -242,16 +258,18 @@ class Scrape {
242258
var source = file.readAsStringSync();
243259

244260
var errorListener = ErrorListener(this, _printErrors);
261+
var featureSet = FeatureSet.latestLanguageVersion();
245262

246263
// Tokenize the source.
247264
var reader = CharSequenceReader(source);
248265
var stringSource = StringSource(source, file.path);
249266
var scanner = Scanner(stringSource, reader, errorListener);
267+
scanner.configureFeatures(
268+
featureSet: featureSet, featureSetForOverriding: featureSet);
250269
var startToken = scanner.tokenize();
251270

252271
// Parse it.
253-
var parser = Parser(stringSource, errorListener,
254-
featureSet: FeatureSet.latestLanguageVersion());
272+
var parser = Parser(stringSource, errorListener, featureSet: featureSet);
255273
parser.enableOptionalNewAndConst = true;
256274
parser.enableSetLiterals = true;
257275

@@ -277,6 +295,12 @@ class Scrape {
277295
return;
278296
}
279297

298+
// Don't process files with syntax errors.
299+
if (errorListener.hadError) {
300+
_errorFileCount++;
301+
return;
302+
}
303+
280304
var lineInfo = LineInfo(scanner.lineStarts);
281305

282306
_scrapedFileCount++;

pkg/scrape/lib/src/error_listener.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import 'package:scrape/scrape.dart';
99
class ErrorListener implements AnalysisErrorListener {
1010
final Scrape _scrape;
1111
final bool _printErrors;
12+
bool _hadError = false;
1213

1314
ErrorListener(this._scrape, this._printErrors);
1415

16+
bool get hadError => _hadError;
17+
1518
@override
1619
void onError(AnalysisError error) {
20+
_hadError = true;
21+
1722
if (_printErrors) {
1823
_scrape.log(error);
1924
}

runtime/vm/clustered_snapshot.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,16 +1142,16 @@ class FieldDeserializationCluster : public DeserializationCluster {
11421142
field ^= refs.At(i);
11431143
field.set_guarded_cid_unsafe(kDynamicCid);
11441144
field.set_is_nullable_unsafe(true);
1145-
field.set_guarded_list_length(Field::kNoFixedLength);
1146-
field.set_guarded_list_length_in_object_offset(
1145+
field.set_guarded_list_length_unsafe(Field::kNoFixedLength);
1146+
field.set_guarded_list_length_in_object_offset_unsafe(
11471147
Field::kUnknownLengthOffset);
11481148
field.set_static_type_exactness_state(
11491149
StaticTypeExactnessState::NotTracking());
11501150
}
11511151
} else {
11521152
for (intptr_t i = start_index_; i < stop_index_; i++) {
11531153
field ^= refs.At(i);
1154-
field.InitializeGuardedListLengthInObjectOffset();
1154+
field.InitializeGuardedListLengthInObjectOffset(/*unsafe=*/true);
11551155
}
11561156
}
11571157
}

runtime/vm/compiler/ffi/abi.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Abi TargetAbi() {
5151
#elif (defined(TARGET_ARCH_IA32) && /* NOLINT(whitespace/parens) */ \
5252
(defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) || \
5353
defined(TARGET_OS_ANDROID))) || \
54-
(defined(TARGET_ARCH_ARM) && defined(TARGET_OS_IOS))
54+
(defined(TARGET_ARCH_ARM) && defined(TARGET_OS_MACOS_IOS))
5555
return Abi::kWordSize32Align32;
5656
#elif defined(TARGET_ARCH_IA32) && defined(TARGET_OS_WINDOWS) || \
5757
defined(TARGET_ARCH_ARM)

runtime/vm/cpu_arm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ DEFINE_FLAG(bool,
5757
"Use integer division instruction if supported");
5858

5959
#if defined(TARGET_HOST_MISMATCH)
60-
#if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_IOS)
60+
#if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_MACOS_IOS)
6161
DEFINE_FLAG(bool, sim_use_hardfp, false, "Use the hardfp ABI.");
6262
#else
6363
DEFINE_FLAG(bool, sim_use_hardfp, true, "Use the hardfp ABI.");

runtime/vm/object.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10130,12 +10130,13 @@ void Field::InitializeNew(const Field& result,
1013010130
#endif // !defined(PRODUCT)
1013110131
result.set_guarded_cid_unsafe(use_guarded_cid ? kIllegalCid : kDynamicCid);
1013210132
result.set_is_nullable_unsafe(use_guarded_cid ? false : true);
10133-
result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
10133+
result.set_guarded_list_length_in_object_offset_unsafe(
10134+
Field::kUnknownLengthOffset);
1013410135
// Presently, we only attempt to remember the list length for final fields.
1013510136
if (is_final && use_guarded_cid) {
10136-
result.set_guarded_list_length(Field::kUnknownFixedLength);
10137+
result.set_guarded_list_length_unsafe(Field::kUnknownFixedLength);
1013710138
} else {
10138-
result.set_guarded_list_length(Field::kNoFixedLength);
10139+
result.set_guarded_list_length_unsafe(Field::kNoFixedLength);
1013910140
}
1014010141
}
1014110142

@@ -10219,7 +10220,7 @@ intptr_t Field::guarded_list_length() const {
1021910220
return Smi::Value(raw_ptr()->guarded_list_length_);
1022010221
}
1022110222

10222-
void Field::set_guarded_list_length(intptr_t list_length) const {
10223+
void Field::set_guarded_list_length_unsafe(intptr_t list_length) const {
1022310224
ASSERT(Thread::Current()->IsMutatorThread());
1022410225
ASSERT(IsOriginal());
1022510226
StoreSmi(&raw_ptr()->guarded_list_length_, Smi::New(list_length));
@@ -10229,7 +10230,7 @@ intptr_t Field::guarded_list_length_in_object_offset() const {
1022910230
return raw_ptr()->guarded_list_length_in_object_offset_ + kHeapObjectTag;
1023010231
}
1023110232

10232-
void Field::set_guarded_list_length_in_object_offset(
10233+
void Field::set_guarded_list_length_in_object_offset_unsafe(
1023310234
intptr_t list_length_offset) const {
1023410235
ASSERT(Thread::Current()->IsMutatorThread());
1023510236
ASSERT(IsOriginal());
@@ -10610,15 +10611,17 @@ const char* Field::GuardedPropertiesAsCString() const {
1061010611
class_name, exactness);
1061110612
}
1061210613

10613-
void Field::InitializeGuardedListLengthInObjectOffset() const {
10614+
void Field::InitializeGuardedListLengthInObjectOffset(bool unsafe) const {
10615+
auto setter = unsafe ? &Field::set_guarded_list_length_in_object_offset_unsafe
10616+
: &Field::set_guarded_list_length_in_object_offset;
1061410617
ASSERT(IsOriginal());
1061510618
if (needs_length_check() &&
1061610619
(guarded_list_length() != Field::kUnknownFixedLength)) {
1061710620
const intptr_t offset = GetListLengthOffset(guarded_cid());
10618-
set_guarded_list_length_in_object_offset(offset);
10621+
(this->*setter)(offset);
1061910622
ASSERT(offset != Field::kUnknownLengthOffset);
1062010623
} else {
10621-
set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
10624+
(this->*setter)(Field::kUnknownLengthOffset);
1062210625
}
1062310626
}
1062410627

runtime/vm/object.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4188,12 +4188,22 @@ class Field : public Object {
41884188
// been determined. If length is kNoFixedLength this field has multiple
41894189
// list lengths associated with it and cannot be predicted.
41904190
intptr_t guarded_list_length() const;
4191-
void set_guarded_list_length(intptr_t list_length) const;
4191+
void set_guarded_list_length_unsafe(intptr_t list_length) const;
4192+
void set_guarded_list_length(intptr_t list_length) const {
4193+
DEBUG_ASSERT(
4194+
IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4195+
set_guarded_list_length_unsafe(list_length);
4196+
}
41924197
static intptr_t guarded_list_length_offset() {
41934198
return OFFSET_OF(FieldLayout, guarded_list_length_);
41944199
}
41954200
intptr_t guarded_list_length_in_object_offset() const;
4196-
void set_guarded_list_length_in_object_offset(intptr_t offset) const;
4201+
void set_guarded_list_length_in_object_offset_unsafe(intptr_t offset) const;
4202+
void set_guarded_list_length_in_object_offset(intptr_t offset) const {
4203+
DEBUG_ASSERT(
4204+
IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4205+
set_guarded_list_length_in_object_offset_unsafe(offset);
4206+
}
41974207
static intptr_t guarded_list_length_in_object_offset_offset() {
41984208
return OFFSET_OF(FieldLayout, guarded_list_length_in_object_offset_);
41994209
}
@@ -4273,7 +4283,7 @@ class Field : public Object {
42734283
// deoptimization of dependent optimized code.
42744284
void RecordStore(const Object& value) const;
42754285

4276-
void InitializeGuardedListLengthInObjectOffset() const;
4286+
void InitializeGuardedListLengthInObjectOffset(bool unsafe = false) const;
42774287

42784288
// Return the list of optimized code objects that were optimized under
42794289
// assumptions about guarded class id and nullability of this field.

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 12
2929
PATCH 0
30-
PRERELEASE 97
30+
PRERELEASE 98
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)