Version 2.16.0-70.0.dev
Merge commit '6da3725698d2fe1efa618aba2af94cbed06dcf50' into 'dev'
diff --git a/DEPS b/DEPS
index 135c437..434e57a 100644
--- a/DEPS
+++ b/DEPS
@@ -107,7 +107,7 @@
# For more details, see https://github.com/dart-lang/sdk/issues/30164
"dart_style_rev": "08b0294d0a500d5c02168ef57dcb8868d0c3cb48",
- "dartdoc_rev" : "520e64977de7a87b2fd5be56e5c2e1a58d55bdad",
+ "dartdoc_rev" : "ff0d94bdb87f11c04a7e0ddab811bf94211b08a4",
"devtools_rev" : "f2ede24a4ea666d4832d78b813c7d4e376aa77d0",
"jsshell_tag": "version:88.0",
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
@@ -140,7 +140,7 @@
"pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
"process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
"protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31",
- "pub_rev": "b9edfa5e288ea3d1a57d1db054ef844ae7b27d99",
+ "pub_rev": "dcb6abac2d7d43258c03b348be42bf4aab9529b1",
"pub_semver_rev": "a43ad72fb6b7869607581b5fedcb186d1e74276a",
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
"rust_revision": "b7856f695d65a8ebc846754f97d15814bcb1c244",
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index 84c3c2b..d4e63fb 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -2228,13 +2228,13 @@
/// Return `null` if the member is not found in the class or any superclass.
MemberEntity lookupClassMember(ClassEntity cls, String name,
{bool setter = false}) {
- var entity = lookupLocalClassMember(cls, name, setter: setter);
- if (entity != null) return entity;
+ while (true) {
+ final entity = lookupLocalClassMember(cls, name, setter: setter);
+ if (entity != null) return entity;
- var superclass = getSuperClass(cls);
- if (superclass == null) return null;
-
- return lookupClassMember(superclass, name, setter: setter);
+ cls = getSuperClass(cls);
+ if (cls == null) return null;
+ }
}
/// Lookup the constructor [name] in [cls], fail if the class is missing and
diff --git a/pkg/dartdev/lib/src/commands/fix.dart b/pkg/dartdev/lib/src/commands/fix.dart
index 83c2faa..d6c8b5a 100644
--- a/pkg/dartdev/lib/src/commands/fix.dart
+++ b/pkg/dartdev/lib/src/commands/fix.dart
@@ -7,6 +7,7 @@
import 'package:analysis_server_client/protocol.dart' hide AnalysisError;
import 'package:intl/intl.dart';
+import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
import '../analysis_server.dart';
@@ -220,15 +221,22 @@
}
try {
var expectedCode = expectFile.readAsStringSync();
- var actualCode =
- fileContentCache[filePath] ?? originalFile.readAsStringSync();
+ var actualIsOriginal = !fileContentCache.containsKey(filePath);
+ var actualCode = actualIsOriginal
+ ? originalFile.readAsStringSync()
+ : fileContentCache[filePath];
// Use a whitespace insensitive comparison.
if (_compressWhitespace(actualCode) !=
_compressWhitespace(expectedCode)) {
result.failCount++;
// TODO(brianwilkerson) Do a better job of displaying the differences.
// It's very hard to see the diff with large files.
- _reportFailure(filePath, actualCode, expectedCode);
+ _reportFailure(
+ filePath,
+ actualCode,
+ expectedCode,
+ actualIsOriginal: actualIsOriginal,
+ );
} else {
result.passCount++;
}
@@ -314,12 +322,17 @@
/// Report that the [actualCode] produced by applying fixes to the content of
/// [filePath] did not match the [expectedCode].
- void _reportFailure(String filePath, String actualCode, String expectedCode) {
+ void _reportFailure(String filePath, String actualCode, String expectedCode,
+ {@required bool actualIsOriginal}) {
log.stdout('Failed when applying fixes to $filePath');
log.stdout('Expected:');
log.stdout(expectedCode);
log.stdout('');
- log.stdout('Actual:');
+ if (actualIsOriginal) {
+ log.stdout('Actual (original code was unchanged):');
+ } else {
+ log.stdout('Actual:');
+ }
log.stdout(actualCode);
}
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
index c486a01..ac5e9d7 100644
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
@@ -103,11 +103,6 @@
// Skip API category events which sometimes don't have an isolate.
continue;
}
- if (event['name'].contains('VirtualMemory')) {
- // Skip virtual memory events which may or may not have an isolate or
- // isolate group.
- continue;
- }
if (event['cat'] == 'Embedder' &&
(event['name'] == 'DFE::ReadScript' ||
event['name'] == 'CreateIsolateGroupAndSetupHelper')) {
diff --git a/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart b/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart
index 8af7481..38d088e 100644
--- a/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart
@@ -103,11 +103,6 @@
// Skip API category events which sometimes don't have an isolate.
continue;
}
- if (event['name'].contains('VirtualMemory')) {
- // Skip virtual memory events which may or may not have an isolate or
- // isolate group.
- continue;
- }
if (event['cat'] == 'Embedder' &&
(event['name'] == 'DFE::ReadScript' ||
event['name'] == 'CreateIsolateGroupAndSetupHelper')) {
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 515d1bd..11a73d3 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1421,9 +1421,6 @@
} else if (msg_handler.IsNull()) {
// If the port has been closed then the message will be dropped at this
// point. Make sure to post to the delivery failure port in that case.
- if (message->RedirectToDeliveryFailurePort()) {
- PortMap::PostMessage(std::move(message));
- }
} else {
// The handler closure which was used to successfully handle the message.
}
diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc
index e4430e6..0f2d2e4 100644
--- a/runtime/vm/message.cc
+++ b/runtime/vm/message.cc
@@ -20,49 +20,32 @@
uint8_t* snapshot,
intptr_t snapshot_length,
MessageFinalizableData* finalizable_data,
- Priority priority,
- Dart_Port delivery_failure_port)
+ Priority priority)
: dest_port_(dest_port),
- delivery_failure_port_(delivery_failure_port),
payload_(snapshot),
snapshot_length_(snapshot_length),
finalizable_data_(finalizable_data),
priority_(priority) {
- ASSERT((priority == kNormalPriority) ||
- (delivery_failure_port == kIllegalPort));
ASSERT(IsSnapshot());
}
-Message::Message(Dart_Port dest_port,
- ObjectPtr raw_obj,
- Priority priority,
- Dart_Port delivery_failure_port)
- : dest_port_(dest_port),
- delivery_failure_port_(delivery_failure_port),
- payload_(raw_obj),
- priority_(priority) {
+Message::Message(Dart_Port dest_port, ObjectPtr raw_obj, Priority priority)
+ : dest_port_(dest_port), payload_(raw_obj), priority_(priority) {
ASSERT(!raw_obj->IsHeapObject() || raw_obj->untag()->InVMIsolateHeap());
- ASSERT((priority == kNormalPriority) ||
- (delivery_failure_port == kIllegalPort));
ASSERT(IsRaw());
}
Message::Message(Dart_Port dest_port,
PersistentHandle* handle,
- Priority priority,
- Dart_Port delivery_failure_port)
+ Priority priority)
: dest_port_(dest_port),
- delivery_failure_port_(delivery_failure_port),
payload_(handle),
snapshot_length_(kPersistentHandleSnapshotLen),
priority_(priority) {
- ASSERT((priority == kNormalPriority) ||
- (delivery_failure_port == kIllegalPort));
ASSERT(IsPersistentHandle());
}
Message::~Message() {
- ASSERT(delivery_failure_port_ == kIllegalPort);
if (IsSnapshot()) {
free(payload_.snapshot_);
}
@@ -74,15 +57,6 @@
}
}
-bool Message::RedirectToDeliveryFailurePort() {
- if (delivery_failure_port_ == kIllegalPort) {
- return false;
- }
- dest_port_ = delivery_failure_port_;
- delivery_failure_port_ = kIllegalPort;
- return true;
-}
-
intptr_t Message::Id() const {
// Messages are allocated on the C heap. Use the raw address as the id.
return reinterpret_cast<intptr_t>(this);
@@ -179,9 +153,6 @@
tail_ = nullptr;
while (cur != nullptr) {
std::unique_ptr<Message> next(cur->next_);
- if (cur->RedirectToDeliveryFailurePort()) {
- PortMap::PostMessage(std::move(cur));
- }
cur = std::move(next);
}
}
diff --git a/runtime/vm/message.h b/runtime/vm/message.h
index bbdf5f9..4c82bdf 100644
--- a/runtime/vm/message.h
+++ b/runtime/vm/message.h
@@ -56,20 +56,13 @@
uint8_t* snapshot,
intptr_t snapshot_length,
MessageFinalizableData* finalizable_data,
- Priority priority,
- Dart_Port delivery_failure_port = kIllegalPort);
+ Priority priority);
// Message objects can also carry RawObject pointers for Smis and objects in
// the VM heap. This is indicated by setting the len_ field to 0.
- Message(Dart_Port dest_port,
- ObjectPtr raw_obj,
- Priority priority,
- Dart_Port delivery_failure_port = kIllegalPort);
+ Message(Dart_Port dest_port, ObjectPtr raw_obj, Priority priority);
- Message(Dart_Port dest_port,
- PersistentHandle* handle,
- Priority priority,
- Dart_Port delivery_failure_port = kIllegalPort);
+ Message(Dart_Port dest_port, PersistentHandle* handle, Priority priority);
~Message();
@@ -119,8 +112,6 @@
return snapshot_length_ == kPersistentHandleSnapshotLen;
}
- bool RedirectToDeliveryFailurePort();
-
void DropFinalizers() {
if (finalizable_data_ != nullptr) {
finalizable_data_->DropFinalizers();
@@ -138,7 +129,6 @@
Message* next_ = nullptr;
Dart_Port dest_port_;
- Dart_Port delivery_failure_port_;
union Payload {
Payload(uint8_t* snapshot) : snapshot_(snapshot) {}
Payload(ObjectPtr raw_obj) : raw_obj_(raw_obj) {}
diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc
index 6bb4912..ebb4788 100644
--- a/runtime/vm/source_report.cc
+++ b/runtime/vm/source_report.cc
@@ -262,6 +262,27 @@
return line;
}
+bool SourceReport::ShouldCoverageSkipCallSite(const ICData* ic_data) {
+ if (ic_data == NULL) return true;
+ if (!ic_data->is_static_call()) return false;
+ Function& func = Function::Handle(ic_data->GetTargetAt(0));
+
+ // Ignore calls to the LateError functions. These are used to throw errors to
+ // do with late variables. These errors shouldn't be hit in working code, so
+ // shouldn't count against the coverage total.
+ // See https://github.com/dart-lang/coverage/issues/341
+ if (late_error_class_id_ == ClassId::kIllegalCid) {
+ const Class& lateErrorClass =
+ Class::Handle(Library::LookupCoreClass(Symbols::LateError()));
+ late_error_class_id_ = lateErrorClass.id();
+ }
+ Class& cls = Class::Handle(func.Owner());
+ if (late_error_class_id_ == cls.id()) {
+ return true;
+ }
+ return false;
+}
+
void SourceReport::PrintCoverageData(JSONObject* jsobj,
const Function& function,
const Code& code) {
@@ -315,7 +336,7 @@
HANDLESCOPE(thread());
ASSERT(iter.DeoptId() < ic_data_array->length());
const ICData* ic_data = (*ic_data_array)[iter.DeoptId()];
- if (ic_data != NULL) {
+ if (!ShouldCoverageSkipCallSite(ic_data)) {
const TokenPosition& token_pos = iter.TokenPos();
update_coverage(token_pos, ic_data->AggregateCount() > 0);
}
diff --git a/runtime/vm/source_report.h b/runtime/vm/source_report.h
index 070ca0a..874f682 100644
--- a/runtime/vm/source_report.h
+++ b/runtime/vm/source_report.h
@@ -66,6 +66,7 @@
bool IsReportRequested(ReportKind report_kind);
bool ShouldSkipFunction(const Function& func);
bool ShouldSkipField(const Field& field);
+ bool ShouldCoverageSkipCallSite(const ICData* ic_data);
intptr_t GetScriptIndex(const Script& script);
bool ScriptIsLoadedByLibrary(const Script& script, const Library& lib);
intptr_t GetTokenPosOrLine(const Script& script,
@@ -139,6 +140,7 @@
GrowableArray<ScriptTableEntry*> script_table_entries_;
DirectChainedHashMap<ScriptTableTrait> script_table_;
intptr_t next_script_index_;
+ intptr_t late_error_class_id_ = ClassId::kIllegalCid;
};
} // namespace dart
diff --git a/runtime/vm/source_report_test.cc b/runtime/vm/source_report_test.cc
index 3f57b88..b21c588 100644
--- a/runtime/vm/source_report_test.cc
+++ b/runtime/vm/source_report_test.cc
@@ -1015,6 +1015,56 @@
buffer);
}
+ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_IssueCov341_LateFinalVars) {
+ // https://github.com/dart-lang/coverage/issues/341
+ // WARNING: This MUST be big enough for the serialised JSON string.
+ const int kBufferSize = 1024;
+ char buffer[kBufferSize];
+ const char* kScript =
+ "int foo(bool bar) {\n"
+ " late final int baz;\n"
+ " if (bar) {\n"
+ " baz = 123;\n"
+ " } else {\n"
+ " baz = 456;\n"
+ " }\n"
+ " return baz;\n"
+ "}\n"
+ "main() {\n"
+ " foo(true);\n"
+ " foo(false);\n"
+ "}\n";
+
+ Library& lib = Library::Handle();
+ lib ^= ExecuteScript(kScript);
+ ASSERT(!lib.IsNull());
+ const Script& script =
+ Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
+
+ SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
+ JSONStream js;
+ report.PrintJSON(&js, script);
+ const char* json_str = js.ToCString();
+ ASSERT(strlen(json_str) < kBufferSize);
+ ElideJSONSubstring("classes", json_str, buffer);
+ ElideJSONSubstring("libraries", buffer, buffer);
+ EXPECT_STREQ(
+ "{\"type\":\"SourceReport\",\"ranges\":["
+
+ // foo is hit, but the late variable sets and gets are ignored.
+ "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":114,\"compiled\":true,"
+ "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
+
+ // Main is hit.
+ "{\"scriptIndex\":0,\"startPos\":116,\"endPos\":152,\"compiled\":true,\""
+ "coverage\":{\"hits\":[116,127,140],\"misses\":[]}}],"
+
+ // Only one script in the script table.
+ "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
+ "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
+ buffer);
+}
+
#endif // !PRODUCT
} // namespace dart
diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc
index 7ab0d3c..b2717df 100644
--- a/runtime/vm/virtual_memory_posix.cc
+++ b/runtime/vm/virtual_memory_posix.cc
@@ -23,7 +23,6 @@
#include "platform/utils.h"
#include "vm/heap/pages.h"
#include "vm/isolate.h"
-#include "vm/timeline.h"
#include "vm/virtual_memory_compressed.h"
// #define VIRTUAL_MEMORY_LOGGING 1
@@ -304,7 +303,6 @@
bool is_executable,
bool is_compressed,
const char* name) {
- TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "VirtualMemory Allocate");
// When FLAG_write_protect_code is active, code memory (indicated by
// is_executable = true) is allocated as non-executable and later
// changed to executable via VirtualMemory::Protect.
@@ -448,8 +446,6 @@
}
VirtualMemory* VirtualMemory::Reserve(intptr_t size, intptr_t alignment) {
- TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "VirtualMemory Reserve");
-
ASSERT(Utils::IsAligned(size, PageSize()));
ASSERT(Utils::IsPowerOfTwo(alignment));
ASSERT(Utils::IsAligned(alignment, PageSize()));
@@ -494,8 +490,6 @@
}
VirtualMemory::~VirtualMemory() {
- TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "VirtualMemory Deallocate");
-
#if defined(DART_COMPRESSED_POINTERS)
if (VirtualMemoryCompressedHeap::Contains(reserved_.pointer())) {
Decommit(reserved_.pointer(), reserved_.size());
diff --git a/tools/VERSION b/tools/VERSION
index 4d4dd33..ae9a195 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 69
+PRERELEASE 70
PRERELEASE_PATCH 0
\ No newline at end of file