Skip to content

Commit

Permalink
Version 3.5.0-1.0.dev
Browse files Browse the repository at this point in the history
Merge d24b5d1 into dev
  • Loading branch information
Dart CI committed Mar 29, 2024
2 parents 5f2b04b + d24b5d1 commit c2138f2
Show file tree
Hide file tree
Showing 15 changed files with 398 additions and 358 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ vars = {
"boringssl_rev": "d24a38200fef19150eef00cad35b138936c08767",
"browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22
"cpu_features_rev": "936b9ab5515dead115606559502e3864958f7f6e",
"devtools_rev": "05714bd031819a53ebddf1e30678b50e733168f0",
"devtools_rev": "8be1bc8d6862a3fcf8f43917f6e0c783cac06d51",
"icu_rev": "81d656878ec611cb0b42d52c82e9dae93920d9ba",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"libcxx_rev": "44079a4cc04cdeffb9cfe8067bfb3c276fb2bab0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/doc_comment.dart';
import 'package:analyzer/dart/ast/visitor.dart';

import '../analyzer.dart';
Expand Down Expand Up @@ -69,13 +70,14 @@ class _Visitor extends SimpleAstVisitor<void> {
@override
void visitComment(Comment node) {
for (var codeBlock in node.codeBlocks) {
if (codeBlock.infoString == null) {
var openingCodeBlockFence = codeBlock.lines.first;
rule.reportLintForOffset(
openingCodeBlockFence.offset,
openingCodeBlockFence.length,
);
}
if (codeBlock.infoString != null) continue;
if (codeBlock.type != CodeBlockType.fenced) continue;

var openingCodeBlockFence = codeBlock.lines.first;
rule.reportLintForOffset(
openingCodeBlockFence.offset,
openingCodeBlockFence.length,
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class MissingCodeBlockLanguageInDocCommentTest extends LintRuleTest {
/// ```dart
/// test
/// ```
class A {}
''');
}

Expand All @@ -43,6 +44,17 @@ class A {}
''');
}

test_indentedCodeBlock() async {
await assertNoDiagnostics(r'''
/// Example:
///
/// var printer = Printer();
/// printer.printToStdout();
///
class A {}
''');
}

test_missingLanguage() async {
await assertDiagnostics(r'''
/// ```
Expand Down
9 changes: 0 additions & 9 deletions runtime/lib/array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ DEFINE_NATIVE_ENTRY(List_allocate, 0, 2) {
return Object::null();
}

DEFINE_NATIVE_ENTRY(List_getIndexed, 0, 2) {
const Array& array = Array::CheckedHandle(zone, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
Exceptions::ThrowRangeError("index", index, 0, array.Length() - 1);
}
return array.At(index.Value());
}

DEFINE_NATIVE_ENTRY(List_setIndexed, 0, 3) {
const Array& array = Array::CheckedHandle(zone, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
Expand Down
11 changes: 0 additions & 11 deletions runtime/lib/growable_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ DEFINE_NATIVE_ENTRY(GrowableList_allocate, 0, 2) {
return new_array.ptr();
}

DEFINE_NATIVE_ENTRY(GrowableList_getIndexed, 0, 2) {
const GrowableObjectArray& array =
GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
Exceptions::ThrowRangeError("index", index, 0, array.Length() - 1);
}
const Instance& obj = Instance::CheckedHandle(zone, array.At(index.Value()));
return obj.ptr();
}

DEFINE_NATIVE_ENTRY(GrowableList_setIndexed, 0, 3) {
const GrowableObjectArray& array =
GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
Expand Down
2 changes: 0 additions & 2 deletions runtime/vm/bootstrap_natives.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ namespace dart {
V(RegExp_ExecuteMatch, 3) \
V(RegExp_ExecuteMatchSticky, 3) \
V(List_allocate, 2) \
V(List_getIndexed, 2) \
V(List_setIndexed, 3) \
V(List_getLength, 1) \
V(List_slice, 4) \
Expand Down Expand Up @@ -264,7 +263,6 @@ namespace dart {
V(Isolate_spawnFunction, 10) \
V(Isolate_spawnUri, 12) \
V(GrowableList_allocate, 2) \
V(GrowableList_getIndexed, 2) \
V(GrowableList_setIndexed, 3) \
V(GrowableList_getLength, 1) \
V(GrowableList_getCapacity, 1) \
Expand Down
169 changes: 135 additions & 34 deletions runtime/vm/compiler/frontend/kernel_to_il.cc
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,39 @@ Fragment FlowGraphBuilder::NativeFunctionBody(const Function& function,
return body;
}

static bool CanUnboxElements(classid_t cid) {
switch (RepresentationUtils::RepresentationOfArrayElement(cid)) {
case kUnboxedFloat:
case kUnboxedDouble:
return FlowGraphCompiler::SupportsUnboxedDoubles();
case kUnboxedInt32x4:
case kUnboxedFloat32x4:
case kUnboxedFloat64x2:
return FlowGraphCompiler::SupportsUnboxedSimd128();
default:
return true;
}
}

const Function& TypedListGetNativeFunction(Thread* thread, classid_t cid) {
auto& state = thread->compiler_state();
switch (RepresentationUtils::RepresentationOfArrayElement(cid)) {
case kUnboxedFloat:
return state.TypedListGetFloat32();
case kUnboxedDouble:
return state.TypedListGetFloat64();
case kUnboxedInt32x4:
return state.TypedListGetInt32x4();
case kUnboxedFloat32x4:
return state.TypedListGetFloat32x4();
case kUnboxedFloat64x2:
return state.TypedListGetFloat64x2();
default:
UNREACHABLE();
return Object::null_function();
}
}

#define LOAD_NATIVE_FIELD(V) \
V(ByteDataViewLength, TypedDataBase_length) \
V(ByteDataViewOffsetInBytes, TypedDataView_offset_in_bytes) \
Expand Down Expand Up @@ -928,6 +961,36 @@ bool FlowGraphBuilder::IsRecognizedMethodForFlowGraph(
const MethodRecognizer::Kind kind = function.recognized_kind();

switch (kind) {
case MethodRecognizer::kObjectArrayGetIndexed:
case MethodRecognizer::kGrowableArrayGetIndexed:
case MethodRecognizer::kInt8ArrayGetIndexed:
case MethodRecognizer::kExternalInt8ArrayGetIndexed:
case MethodRecognizer::kUint8ArrayGetIndexed:
case MethodRecognizer::kExternalUint8ArrayGetIndexed:
case MethodRecognizer::kUint8ClampedArrayGetIndexed:
case MethodRecognizer::kExternalUint8ClampedArrayGetIndexed:
case MethodRecognizer::kInt16ArrayGetIndexed:
case MethodRecognizer::kExternalInt16ArrayGetIndexed:
case MethodRecognizer::kUint16ArrayGetIndexed:
case MethodRecognizer::kExternalUint16ArrayGetIndexed:
case MethodRecognizer::kInt32ArrayGetIndexed:
case MethodRecognizer::kExternalInt32ArrayGetIndexed:
case MethodRecognizer::kUint32ArrayGetIndexed:
case MethodRecognizer::kExternalUint32ArrayGetIndexed:
case MethodRecognizer::kInt64ArrayGetIndexed:
case MethodRecognizer::kExternalInt64ArrayGetIndexed:
case MethodRecognizer::kUint64ArrayGetIndexed:
case MethodRecognizer::kExternalUint64ArrayGetIndexed:
case MethodRecognizer::kFloat32ArrayGetIndexed:
case MethodRecognizer::kExternalFloat32ArrayGetIndexed:
case MethodRecognizer::kFloat64ArrayGetIndexed:
case MethodRecognizer::kExternalFloat64ArrayGetIndexed:
case MethodRecognizer::kFloat32x4ArrayGetIndexed:
case MethodRecognizer::kExternalFloat32x4ArrayGetIndexed:
case MethodRecognizer::kFloat64x2ArrayGetIndexed:
case MethodRecognizer::kExternalFloat64x2ArrayGetIndexed:
case MethodRecognizer::kInt32x4ArrayGetIndexed:
case MethodRecognizer::kExternalInt32x4ArrayGetIndexed:
case MethodRecognizer::kRecord_fieldAt:
case MethodRecognizer::kRecord_fieldNames:
case MethodRecognizer::kRecord_numFields:
Expand Down Expand Up @@ -1145,6 +1208,78 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfRecognizedMethod(

const MethodRecognizer::Kind kind = function.recognized_kind();
switch (kind) {
case MethodRecognizer::kObjectArrayGetIndexed:
case MethodRecognizer::kGrowableArrayGetIndexed:
case MethodRecognizer::kInt8ArrayGetIndexed:
case MethodRecognizer::kExternalInt8ArrayGetIndexed:
case MethodRecognizer::kUint8ArrayGetIndexed:
case MethodRecognizer::kExternalUint8ArrayGetIndexed:
case MethodRecognizer::kUint8ClampedArrayGetIndexed:
case MethodRecognizer::kExternalUint8ClampedArrayGetIndexed:
case MethodRecognizer::kInt16ArrayGetIndexed:
case MethodRecognizer::kExternalInt16ArrayGetIndexed:
case MethodRecognizer::kUint16ArrayGetIndexed:
case MethodRecognizer::kExternalUint16ArrayGetIndexed:
case MethodRecognizer::kInt32ArrayGetIndexed:
case MethodRecognizer::kExternalInt32ArrayGetIndexed:
case MethodRecognizer::kUint32ArrayGetIndexed:
case MethodRecognizer::kExternalUint32ArrayGetIndexed:
case MethodRecognizer::kInt64ArrayGetIndexed:
case MethodRecognizer::kExternalInt64ArrayGetIndexed:
case MethodRecognizer::kUint64ArrayGetIndexed:
case MethodRecognizer::kExternalUint64ArrayGetIndexed:
case MethodRecognizer::kFloat32ArrayGetIndexed:
case MethodRecognizer::kExternalFloat32ArrayGetIndexed:
case MethodRecognizer::kFloat64ArrayGetIndexed:
case MethodRecognizer::kExternalFloat64ArrayGetIndexed:
case MethodRecognizer::kFloat32x4ArrayGetIndexed:
case MethodRecognizer::kExternalFloat32x4ArrayGetIndexed:
case MethodRecognizer::kFloat64x2ArrayGetIndexed:
case MethodRecognizer::kExternalFloat64x2ArrayGetIndexed:
case MethodRecognizer::kInt32x4ArrayGetIndexed:
case MethodRecognizer::kExternalInt32x4ArrayGetIndexed: {
ASSERT_EQUAL(function.NumParameters(), 2);
intptr_t array_cid = MethodRecognizer::MethodKindToReceiverCid(kind);
const Representation elem_rep =
RepresentationUtils::RepresentationOfArrayElement(array_cid);
body += LoadLocal(parsed_function_->RawParameterVariable(0));
body += LoadNativeField(Slot::GetLengthFieldForArrayCid(array_cid));
body += LoadLocal(parsed_function_->RawParameterVariable(1));
body += GenericCheckBound();
LocalVariable* safe_index = MakeTemporary();
body += LoadLocal(parsed_function_->RawParameterVariable(0));
if (IsTypedDataBaseClassId(array_cid) && !CanUnboxElements(array_cid)) {
const auto& native_function =
TypedListGetNativeFunction(thread_, array_cid);
body += LoadLocal(safe_index);
body += IntConstant(Utils::ShiftForPowerOfTwo(
RepresentationUtils::ValueSize(elem_rep)));
body += BinaryIntegerOp(Token::kSHL, kUnboxedIntPtr,
/*is_truncating=*/true);
body += StaticCall(TokenPosition::kNoSource, native_function, 2,
ICData::kNoRebind);
} else {
if (kind == MethodRecognizer::kGrowableArrayGetIndexed) {
body += LoadNativeField(Slot::GrowableObjectArray_data());
array_cid = kArrayCid;
} else if (IsExternalTypedDataClassId(array_cid)) {
body += LoadNativeField(Slot::PointerBase_data(),
InnerPointerAccess::kCannotBeInnerPointer);
}
body += LoadLocal(safe_index);
body +=
LoadIndexed(array_cid,
/*index_scale=*/
compiler::target::Instance::ElementSizeFor(array_cid),
/*index_unboxed=*/
GenericCheckBoundInstr::UseUnboxedRepresentation());
if (elem_rep == kUnboxedFloat) {
body += FloatToDouble();
}
}
body += DropTempsPreserveTop(1); // Drop [safe_index], keep result.
break;
}
case MethodRecognizer::kRecord_fieldAt:
ASSERT_EQUAL(function.NumParameters(), 2);
body += LoadLocal(parsed_function_->RawParameterVariable(0));
Expand Down Expand Up @@ -1959,40 +2094,6 @@ Fragment FlowGraphBuilder::BuildTypedDataViewFactoryConstructor(
return body;
}

static bool CanUnboxElements(classid_t cid) {
switch (RepresentationUtils::RepresentationOfArrayElement(cid)) {
case kUnboxedFloat:
case kUnboxedDouble:
return FlowGraphCompiler::SupportsUnboxedDoubles();
case kUnboxedInt32x4:
case kUnboxedFloat32x4:
case kUnboxedFloat64x2:
return FlowGraphCompiler::SupportsUnboxedSimd128();
default:
return true;
}
}

static const Function& TypedListGetNativeFunction(Thread* thread,
classid_t cid) {
auto& state = thread->compiler_state();
switch (RepresentationUtils::RepresentationOfArrayElement(cid)) {
case kUnboxedFloat:
return state.TypedListGetFloat32();
case kUnboxedDouble:
return state.TypedListGetFloat64();
case kUnboxedInt32x4:
return state.TypedListGetInt32x4();
case kUnboxedFloat32x4:
return state.TypedListGetFloat32x4();
case kUnboxedFloat64x2:
return state.TypedListGetFloat64x2();
default:
UNREACHABLE();
return Object::null_function();
}
}

Fragment FlowGraphBuilder::BuildTypedListGet(const Function& function,
classid_t cid) {
const intptr_t kNumParameters = 2;
Expand Down
Loading

0 comments on commit c2138f2

Please sign in to comment.