mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] Migrate away from native 'name'
syntax.
As part of deprecating support for native extensions we are also migrating away from legacy VM-specific `native 'name'` syntax towards metadata based encoding which does not require any special syntax. This CL is a step 1 in migration: - introduces support for `@pragma('vm:external-name', 'name')` which serves as a direct replacement for `native 'name'`; - all core libraries and tests are migrated to use the annotation; Once this CL lands and rolls we will edit internal and external embedders to eliminate uses of the native keyword (step 2) and finally remove support for native keyword across our parsers (step 3). TEST=ci Bug: https://github.com/dart-lang/sdk/issues/28791 Change-Id: Id6dea878db82dd4fd81149243c425b5c5dc6df86 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212461 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
fbc70d8be6
commit
d8d7af15ce
|
@ -564,37 +564,37 @@ library;
|
|||
// Try adding explicit types.
|
||||
// operator ==<T>(a) => true;
|
||||
// ^^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is one of the overridden members.
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is one of the overridden members.
|
||||
// external bool operator ==(Object other);
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:6:12: Error: The method 'Operators1.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// operator ==() => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:27:12: Error: The method 'Operators2.==' has more required arguments than those of overridden method 'Object.=='.
|
||||
// operator ==(a, b) => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:71:12: Error: The method 'Operators4.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// operator ==({a}) => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:137:12: Error: Declared type variables of 'Operators7.==' doesn't match those on overridden method 'Object.=='.
|
||||
// operator ==<T>(a) => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -564,37 +564,37 @@ library;
|
|||
// Try adding explicit types.
|
||||
// operator ==<T>(a) => true;
|
||||
// ^^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is one of the overridden members.
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is one of the overridden members.
|
||||
// external bool operator ==(Object other);
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:6:12: Error: The method 'Operators1.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// operator ==() => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:27:12: Error: The method 'Operators2.==' has more required arguments than those of overridden method 'Object.=='.
|
||||
// operator ==(a, b) => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:71:12: Error: The method 'Operators4.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// operator ==({a}) => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/invalid_operator.dart:137:12: Error: Declared type variables of 'Operators7.==' doesn't match those on overridden method 'Object.=='.
|
||||
// operator ==<T>(a) => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -9,9 +9,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/nnbd/issue42603.dart:18:17: Error: The method 'E.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// bool operator ==() => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue42603.dart:22:17: Error: The method 'F.==' has more required arguments than those of overridden method 'E.=='.
|
||||
// bool operator ==(Object? other) => super == other;
|
||||
|
|
|
@ -9,9 +9,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/nnbd/issue42603.dart:18:17: Error: The method 'E.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// bool operator ==() => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue42603.dart:22:17: Error: The method 'F.==' has more required arguments than those of overridden method 'E.=='.
|
||||
// bool operator ==(Object? other) => super == other;
|
||||
|
|
|
@ -9,9 +9,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/nnbd/issue42603.dart:18:17: Error: The method 'E.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
||||
// bool operator ==() => true;
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:26:17: Context: This is the overridden method ('==').
|
||||
// bool operator ==(Object other) native "Object_equals";
|
||||
// ^
|
||||
// sdk/lib/_internal/vm/lib/object_patch.dart:29:26: Context: This is the overridden method ('==').
|
||||
// external bool operator ==(Object other);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue42603.dart:22:17: Error: The method 'F.==' has more required arguments than those of overridden method 'E.=='.
|
||||
// bool operator ==(Object? other) => super == other;
|
||||
|
|
|
@ -5,22 +5,30 @@
|
|||
library kernel.external_name;
|
||||
|
||||
import 'ast.dart';
|
||||
import 'core_types.dart';
|
||||
|
||||
/// Returns external (native) name of given [Member].
|
||||
String? getExternalName(Member procedure) {
|
||||
String? getExternalName(CoreTypes coreTypes, Member procedure) {
|
||||
// Native procedures are marked as external and have an annotation,
|
||||
// which looks like this:
|
||||
//
|
||||
// @pragma("vm:external-name", "<name-of-native>")
|
||||
// external Object foo(arg0, ...);
|
||||
//
|
||||
// Previously the following encoding was used, which is still supported
|
||||
// until all users are migrated away from it:
|
||||
//
|
||||
// import 'dart:_internal' as internal;
|
||||
//
|
||||
// @internal.ExternalName("<name-of-native>")
|
||||
// external Object foo(arg0, ...);
|
||||
//
|
||||
|
||||
if (!procedure.isExternal) {
|
||||
return null;
|
||||
}
|
||||
for (final Expression annotation in procedure.annotations) {
|
||||
final String? value = _getExternalNameValue(annotation);
|
||||
final String? value = _getExternalNameValue(coreTypes, annotation);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
|
@ -28,28 +36,25 @@ String? getExternalName(Member procedure) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/// Returns native extension URIs for given [library].
|
||||
List<String> getNativeExtensionUris(Library library) {
|
||||
final List<String> uris = <String>[];
|
||||
for (Expression annotation in library.annotations) {
|
||||
final String? value = _getExternalNameValue(annotation);
|
||||
if (value != null) {
|
||||
uris.add(value);
|
||||
}
|
||||
}
|
||||
return uris;
|
||||
}
|
||||
|
||||
String? _getExternalNameValue(Expression annotation) {
|
||||
if (annotation is ConstructorInvocation) {
|
||||
if (_isExternalName(annotation.target.enclosingClass)) {
|
||||
return (annotation.arguments.positional.single as StringLiteral).value;
|
||||
}
|
||||
} else if (annotation is ConstantExpression) {
|
||||
String? _getExternalNameValue(CoreTypes coreTypes, Expression annotation) {
|
||||
if (annotation is ConstantExpression) {
|
||||
final Constant constant = annotation.constant;
|
||||
if (constant is InstanceConstant) {
|
||||
if (_isExternalName(constant.classNode)) {
|
||||
return (constant.fieldValues.values.single as StringConstant).value;
|
||||
} else if (_isPragma(constant.classNode)) {
|
||||
final String pragmaName =
|
||||
(constant.fieldValues[coreTypes.pragmaName.getterReference]
|
||||
as StringConstant)
|
||||
.value;
|
||||
final Constant? pragmaOptionsValue =
|
||||
constant.fieldValues[coreTypes.pragmaOptions.getterReference];
|
||||
final String? pragmaOptions = pragmaOptionsValue is StringConstant
|
||||
? pragmaOptionsValue.value
|
||||
: null;
|
||||
if (pragmaName == _externalNamePragma && pragmaOptions != null) {
|
||||
return pragmaOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,3 +64,9 @@ String? _getExternalNameValue(Expression annotation) {
|
|||
bool _isExternalName(Class klass) =>
|
||||
klass.name == 'ExternalName' &&
|
||||
klass.enclosingLibrary.importUri.toString() == 'dart:_internal';
|
||||
|
||||
bool _isPragma(Class klass) =>
|
||||
klass.name == 'pragma' &&
|
||||
klass.enclosingLibrary.importUri.toString() == 'dart:core';
|
||||
|
||||
const String _externalNamePragma = 'vm:external-name';
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/core_types.dart';
|
||||
import 'package:kernel/external_name.dart';
|
||||
import 'package:kernel/type_environment.dart';
|
||||
|
||||
|
@ -200,6 +201,7 @@ class _ParameterInfo {
|
|||
|
||||
class _Collect extends RecursiveVisitor {
|
||||
final SignatureShaker shaker;
|
||||
final CoreTypes coreTypes;
|
||||
|
||||
/// Parameters of the current function.
|
||||
final Map<VariableDeclaration, _ParameterInfo> localParameters = {};
|
||||
|
@ -209,7 +211,8 @@ class _Collect extends RecursiveVisitor {
|
|||
/// via [_ParameterInfo.useDependencies] and not marked as read immediately.
|
||||
final Set<VariableGet> useDependencies = {};
|
||||
|
||||
_Collect(this.shaker);
|
||||
_Collect(this.shaker)
|
||||
: coreTypes = shaker.typeFlowAnalysis.environment.coreTypes;
|
||||
|
||||
void enterFunction(Member member) {
|
||||
final _ProcedureInfo? info = shaker._infoForMember(member);
|
||||
|
@ -233,7 +236,7 @@ class _Collect extends RecursiveVisitor {
|
|||
shaker.typeFlowAnalysis.nativeCodeOracle
|
||||
.isMemberReferencedFromNativeCode(member) ||
|
||||
shaker.typeFlowAnalysis.nativeCodeOracle.isRecognized(member) ||
|
||||
getExternalName(member) != null ||
|
||||
getExternalName(coreTypes, member) != null ||
|
||||
member.name.text == '==') {
|
||||
info.eligible = false;
|
||||
}
|
||||
|
|
|
@ -205,5 +205,5 @@ class UnboxingInfoManager {
|
|||
_nativeCodeOracle.hasDisableUnboxedParameters(member);
|
||||
}
|
||||
|
||||
bool _isNative(Member member) => getExternalName(member) != null;
|
||||
bool _isNative(Member member) => getExternalName(_coreTypes, member) != null;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ These pragmas are part of the VM's API and are safe for use in external code.
|
|||
| `vm:never-inline` | [Never inline a function or method](compiler/pragmas_recognized_by_compiler.md#requesting-a-function-never-be-inlined) |
|
||||
| `vm:prefer-inline` | [Inline a function or method when possible](compiler/pragmas_recognized_by_compiler.md#requesting-a-function-be-inlined) |
|
||||
| `vm:notify-debugger-on-exception` | Marks a function that catches exceptions, making the VM treat any caught exception as if they were uncaught. This can be used to notify an attached debugger during debugging, without pausing the app during regular execution. |
|
||||
| `vm:external-name` | Allows to specify an external (native) name for an `external` function. This name is used to lookup native implementation via native resolver associated with the current library through embedding APIs. This is a replacement for legacy VM specific `native "name"` syntax. |
|
||||
|
||||
## Unsafe pragmas for general use
|
||||
|
||||
|
|
|
@ -166,20 +166,23 @@ static Dart_NativeFunction bm_uda_lookup(Dart_Handle name,
|
|||
|
||||
BENCHMARK(UseDartApi) {
|
||||
const int kNumIterations = 1000000;
|
||||
const char* kScriptChars =
|
||||
"import 'dart:nativewrappers';\n"
|
||||
"class Class extends NativeFieldWrapperClass1 {\n"
|
||||
" void init() native 'init';\n"
|
||||
" int method(int param1, int param2) native 'method';\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void benchmark(int count) {\n"
|
||||
" Class c = Class();\n"
|
||||
" c.init();\n"
|
||||
" for (int i = 0; i < count; i++) {\n"
|
||||
" c.method(i,7);\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:nativewrappers';
|
||||
|
||||
class Class extends NativeFieldWrapperClass1 {
|
||||
@pragma("vm:external-name", "init")
|
||||
external void init();
|
||||
@pragma("vm:external-name", "method")
|
||||
external int method(int param1, int param2);
|
||||
}
|
||||
|
||||
void benchmark(int count) {
|
||||
Class c = Class();
|
||||
c.init();
|
||||
for (int i = 0; i < count; i++) {
|
||||
c.method(i,7);
|
||||
}
|
||||
})";
|
||||
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, bm_uda_lookup,
|
||||
RESOLVED_USER_TEST_URI, false);
|
||||
|
|
|
@ -40,23 +40,24 @@ static Dart_NativeFunction native_resolver(Dart_Handle name,
|
|||
}
|
||||
|
||||
TEST_CASE(StackMapGC) {
|
||||
const char* kScriptChars =
|
||||
"class A {"
|
||||
" static void func(var i, var k) native 'NativeFunc';"
|
||||
" static foo() {"
|
||||
" var i;"
|
||||
" var s1;"
|
||||
" var k;"
|
||||
" var s2;"
|
||||
" var s3;"
|
||||
" i = 10; s1 = 'abcd'; k = 20; s2 = 'B'; s3 = 'C';"
|
||||
" func(i, k);"
|
||||
" return i + k; }"
|
||||
" static void moo() {"
|
||||
" var i = A.foo();"
|
||||
" if (i != 30) throw '$i != 30';"
|
||||
" }\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
class A {
|
||||
@pragma("vm:external-name", "NativeFunc")
|
||||
external static void func(var i, var k);
|
||||
static foo() {
|
||||
var i;
|
||||
var s1;
|
||||
var k;
|
||||
var s2;
|
||||
var s3;
|
||||
i = 10; s1 = 'abcd'; k = 20; s2 = 'B'; s3 = 'C';
|
||||
func(i, k);
|
||||
return i + k; }
|
||||
static void moo() {
|
||||
var i = A.foo();
|
||||
if (i != 30) throw '$i != 30';
|
||||
}
|
||||
})";
|
||||
// First setup the script and compile the script.
|
||||
TestCase::LoadTestScript(kScriptChars, native_resolver);
|
||||
TransitionNativeToVM transition(thread);
|
||||
|
|
|
@ -120,7 +120,8 @@ static void TryCatchOptimizerTest(
|
|||
|
||||
ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Simple1) {
|
||||
const char* script_chars = R"(
|
||||
dynamic blackhole([dynamic val]) native 'BlackholeNative';
|
||||
@pragma("vm:external-name", "BlackholeNative")
|
||||
external dynamic blackhole([dynamic val]);
|
||||
foo(int p) {
|
||||
var a = blackhole(), b = blackhole();
|
||||
try {
|
||||
|
@ -139,7 +140,8 @@ ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Simple1) {
|
|||
|
||||
ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Simple2) {
|
||||
const char* script_chars = R"(
|
||||
dynamic blackhole([dynamic val]) native 'BlackholeNative';
|
||||
@pragma("vm:external-name", "BlackholeNative")
|
||||
external dynamic blackhole([dynamic val]);
|
||||
foo(int p) {
|
||||
var a = blackhole(), b = blackhole();
|
||||
try {
|
||||
|
@ -159,7 +161,8 @@ ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Simple2) {
|
|||
|
||||
ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Cyclic1) {
|
||||
const char* script_chars = R"(
|
||||
dynamic blackhole([dynamic val]) native 'BlackholeNative';
|
||||
@pragma("vm:external-name", "BlackholeNative")
|
||||
external dynamic blackhole([dynamic val]);
|
||||
foo(int p) {
|
||||
var a = blackhole(), b;
|
||||
for (var i = 0; i < 42; i++) {
|
||||
|
@ -181,7 +184,8 @@ ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Cyclic1) {
|
|||
|
||||
ISOLATE_UNIT_TEST_CASE(TryCatchOptimizer_DeadParameterElimination_Cyclic2) {
|
||||
const char* script_chars = R"(
|
||||
dynamic blackhole([dynamic val]) native 'BlackholeNative';
|
||||
@pragma("vm:external-name", "BlackholeNative")
|
||||
external dynamic blackhole([dynamic val]);
|
||||
foo(int p) {
|
||||
var a = blackhole(), b = blackhole();
|
||||
for (var i = 0; i < 42; i++) {
|
||||
|
@ -211,7 +215,8 @@ static void TestAliasingViaRedefinition(
|
|||
std::function<Definition*(CompilerState* S, FlowGraph*, Definition*)>
|
||||
make_redefinition) {
|
||||
const char* script_chars = R"(
|
||||
dynamic blackhole([a, b, c, d, e, f]) native 'BlackholeNative';
|
||||
@pragma("vm:external-name", "BlackholeNative")
|
||||
external dynamic blackhole([a, b, c, d, e, f]);
|
||||
class K {
|
||||
var field;
|
||||
}
|
||||
|
@ -375,7 +380,8 @@ static void TestAliasingViaStore(
|
|||
std::function<Definition*(CompilerState* S, FlowGraph*, Definition*)>
|
||||
make_redefinition) {
|
||||
const char* script_chars = R"(
|
||||
dynamic blackhole([a, b, c, d, e, f]) native 'BlackholeNative';
|
||||
@pragma("vm:external-name", "BlackholeNative")
|
||||
external dynamic blackhole([a, b, c, d, e, f]);
|
||||
class K {
|
||||
var field;
|
||||
}
|
||||
|
|
|
@ -3125,7 +3125,6 @@ void TypeTranslator::BuildInterfaceType(bool simple) {
|
|||
result_ = Type::New(klass, type_arguments, nullability);
|
||||
result_ = result_.NormalizeFutureOrType(Heap::kOld);
|
||||
if (finalize_) {
|
||||
ASSERT(active_class_->klass != NULL);
|
||||
result_ = ClassFinalizer::FinalizeType(result_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -478,8 +478,8 @@ void CurrentStackTraceNative(Dart_NativeArguments args) {
|
|||
EXPECT_STREQ("inspectStack", cstr);
|
||||
Dart_StringToCString(script_url, &cstr);
|
||||
EXPECT_STREQ(test_lib, cstr);
|
||||
EXPECT_EQ(1, line_number);
|
||||
EXPECT_EQ(47, column_number);
|
||||
EXPECT_EQ(3, line_number);
|
||||
EXPECT_EQ(24, column_number);
|
||||
|
||||
// Second frame is foo() positioned at call to inspectStack().
|
||||
result = Dart_GetActivationFrame(stacktrace, 1, &frame);
|
||||
|
@ -491,7 +491,7 @@ void CurrentStackTraceNative(Dart_NativeArguments args) {
|
|||
EXPECT_STREQ("foo", cstr);
|
||||
Dart_StringToCString(script_url, &cstr);
|
||||
EXPECT_STREQ(test_lib, cstr);
|
||||
EXPECT_EQ(2, line_number);
|
||||
EXPECT_EQ(4, line_number);
|
||||
EXPECT_EQ(20, column_number);
|
||||
|
||||
// Middle frames positioned at the recursive call.
|
||||
|
@ -506,7 +506,7 @@ void CurrentStackTraceNative(Dart_NativeArguments args) {
|
|||
EXPECT_STREQ("foo", cstr);
|
||||
Dart_StringToCString(script_url, &cstr);
|
||||
EXPECT_STREQ(test_lib, cstr);
|
||||
EXPECT_EQ(2, line_number);
|
||||
EXPECT_EQ(4, line_number);
|
||||
EXPECT_EQ(37, column_number);
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ void CurrentStackTraceNative(Dart_NativeArguments args) {
|
|||
EXPECT_STREQ("testMain", cstr);
|
||||
Dart_StringToCString(script_url, &cstr);
|
||||
EXPECT_STREQ(test_lib, cstr);
|
||||
EXPECT_EQ(3, line_number);
|
||||
EXPECT_EQ(5, line_number);
|
||||
EXPECT_EQ(15, column_number);
|
||||
|
||||
// Out-of-bounds frames.
|
||||
|
@ -543,10 +543,12 @@ static Dart_NativeFunction CurrentStackTraceNativeLookup(
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_CurrentStackTraceInfo) {
|
||||
const char* kScriptChars =
|
||||
"inspectStack() native 'CurrentStackTraceNatve';\n"
|
||||
"foo(n) => n == 1 ? inspectStack() : foo(n-1);\n"
|
||||
"testMain() => foo(100);\n";
|
||||
const char* kScriptChars = R"(
|
||||
@pragma("vm:external-name", "CurrentStackTraceNatve")
|
||||
external inspectStack();
|
||||
foo(n) => n == 1 ? inspectStack() : foo(n-1);
|
||||
testMain() => foo(100);
|
||||
)";
|
||||
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &CurrentStackTraceNativeLookup);
|
||||
|
@ -692,16 +694,18 @@ static Dart_NativeFunction PropagateError_native_lookup(
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_PropagateCompileTimeError) {
|
||||
const char* kScriptChars =
|
||||
"raiseCompileError() {\n"
|
||||
" return missing_semicolon\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void nativeFunc(closure) native 'Test_nativeFunc';\n"
|
||||
"\n"
|
||||
"void Func1() {\n"
|
||||
" nativeFunc(() => raiseCompileError());\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
raiseCompileError() {
|
||||
return missing_semicolon
|
||||
}
|
||||
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void nativeFunc(closure);
|
||||
|
||||
void Func1() {
|
||||
nativeFunc(() => raiseCompileError());
|
||||
}
|
||||
)";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &PropagateError_native_lookup);
|
||||
Dart_Handle result;
|
||||
|
@ -733,16 +737,18 @@ TEST_CASE(DartAPI_PropagateCompileTimeError) {
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_PropagateError) {
|
||||
const char* kScriptChars =
|
||||
"void throwException() {\n"
|
||||
" throw new Exception('myException');\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void nativeFunc(closure) native 'Test_nativeFunc';\n"
|
||||
"\n"
|
||||
"void Func2() {\n"
|
||||
" nativeFunc(() => throwException());\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
void throwException() {
|
||||
throw new Exception('myException');
|
||||
}
|
||||
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void nativeFunc(closure);
|
||||
|
||||
void Func2() {
|
||||
nativeFunc(() => throwException());
|
||||
}
|
||||
)";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &PropagateError_native_lookup);
|
||||
Dart_Handle result;
|
||||
|
@ -2149,28 +2155,30 @@ static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name,
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_ByteDataAccess) {
|
||||
const char* kScriptChars =
|
||||
"import 'dart:typed_data';\n"
|
||||
"class Expect {\n"
|
||||
" static equals(a, b) {\n"
|
||||
" if (a != b) {\n"
|
||||
" throw 'not equal. expected: $a, got: $b';\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"ByteData createByteData() native 'CreateByteData';"
|
||||
"ByteData main() {"
|
||||
" var length = 16;"
|
||||
" var a = createByteData();"
|
||||
" Expect.equals(length, a.lengthInBytes);"
|
||||
" for (int i = 0; i < length; i+=1) {"
|
||||
" a.setInt8(i, 0x42);"
|
||||
" }"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" Expect.equals(0x4242, a.getInt16(i));"
|
||||
" }"
|
||||
" return a;"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:typed_data';
|
||||
class Expect {
|
||||
static equals(a, b) {
|
||||
if (a != b) {
|
||||
throw 'not equal. expected: $a, got: $b';
|
||||
}
|
||||
}
|
||||
}
|
||||
@pragma("vm:external-name", "CreateByteData")
|
||||
external ByteData createByteData();
|
||||
ByteData main() {
|
||||
var length = 16;
|
||||
var a = createByteData();
|
||||
Expect.equals(length, a.lengthInBytes);
|
||||
for (int i = 0; i < length; i+=1) {
|
||||
a.setInt8(i, 0x42);
|
||||
}
|
||||
for (int i = 0; i < length; i+=2) {
|
||||
Expect.equals(0x4242, a.getInt16(i));
|
||||
}
|
||||
return a;
|
||||
}
|
||||
)";
|
||||
// Create a test library and Load up a test script in it.
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
|
||||
|
||||
|
@ -2212,32 +2220,34 @@ static Dart_NativeFunction ExternalByteDataNativeResolver(
|
|||
TEST_CASE(DartAPI_ExternalByteDataAccess) {
|
||||
// TODO(asiva): Once we have getInt16LE and getInt16BE support use the
|
||||
// appropriate getter instead of the host endian format used now.
|
||||
const char* kScriptChars =
|
||||
"import 'dart:typed_data';\n"
|
||||
"class Expect {\n"
|
||||
" static equals(a, b) {\n"
|
||||
" if (a != b) {\n"
|
||||
" throw 'not equal. expected: $a, got: $b';\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"ByteData createExternalByteData() native 'CreateExternalByteData';"
|
||||
"ByteData main() {"
|
||||
" var length = 16;"
|
||||
" var a = createExternalByteData();"
|
||||
" Expect.equals(length, a.lengthInBytes);"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" Expect.equals(0x4241, a.getInt16(i, Endian.little));"
|
||||
" }"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" a.setInt8(i, 0x24);"
|
||||
" a.setInt8(i + 1, 0x28);"
|
||||
" }"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" Expect.equals(0x2824, a.getInt16(i, Endian.little));"
|
||||
" }"
|
||||
" return a;"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:typed_data';
|
||||
class Expect {
|
||||
static equals(a, b) {
|
||||
if (a != b) {
|
||||
throw 'not equal. expected: $a, got: $b';
|
||||
}
|
||||
}
|
||||
}
|
||||
@pragma("vm:external-name", "CreateExternalByteData")
|
||||
external ByteData createExternalByteData();
|
||||
ByteData main() {
|
||||
var length = 16;
|
||||
var a = createExternalByteData();
|
||||
Expect.equals(length, a.lengthInBytes);
|
||||
for (int i = 0; i < length; i+=2) {
|
||||
Expect.equals(0x4241, a.getInt16(i, Endian.little));
|
||||
}
|
||||
for (int i = 0; i < length; i+=2) {
|
||||
a.setInt8(i, 0x24);
|
||||
a.setInt8(i + 1, 0x28);
|
||||
}
|
||||
for (int i = 0; i < length; i+=2) {
|
||||
Expect.equals(0x2824, a.getInt16(i, Endian.little));
|
||||
}
|
||||
return a;
|
||||
}
|
||||
)";
|
||||
// Create a test library and Load up a test script in it.
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
|
||||
|
||||
|
@ -2347,31 +2357,33 @@ static Dart_NativeFunction OptExternalByteDataNativeResolver(
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_OptimizedExternalByteDataAccess) {
|
||||
const char* kScriptChars =
|
||||
"import 'dart:typed_data';\n"
|
||||
"class Expect {\n"
|
||||
" static equals(a, b) {\n"
|
||||
" if (a != b) {\n"
|
||||
" throw 'not equal. expected: $a, got: $b';\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"ByteData createExternalByteData() native 'CreateExternalByteData';"
|
||||
"access(ByteData a) {"
|
||||
" Expect.equals(0x04030201, a.getUint32(0, Endian.little));"
|
||||
" Expect.equals(0x08070605, a.getUint32(4, Endian.little));"
|
||||
" Expect.equals(0x0c0b0a09, a.getUint32(8, Endian.little));"
|
||||
" Expect.equals(0x100f0e0d, a.getUint32(12, Endian.little));"
|
||||
"}"
|
||||
"ByteData main() {"
|
||||
" var length = 16;"
|
||||
" var a = createExternalByteData();"
|
||||
" Expect.equals(length, a.lengthInBytes);"
|
||||
" for (int i = 0; i < 20; i++) {"
|
||||
" access(a);"
|
||||
" }"
|
||||
" return a;"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:typed_data';
|
||||
class Expect {
|
||||
static equals(a, b) {
|
||||
if (a != b) {
|
||||
throw 'not equal. expected: $a, got: $b';
|
||||
}
|
||||
}
|
||||
}
|
||||
@pragma("vm:external-name", "CreateExternalByteData")
|
||||
external ByteData createExternalByteData();
|
||||
access(ByteData a) {
|
||||
Expect.equals(0x04030201, a.getUint32(0, Endian.little));
|
||||
Expect.equals(0x08070605, a.getUint32(4, Endian.little));
|
||||
Expect.equals(0x0c0b0a09, a.getUint32(8, Endian.little));
|
||||
Expect.equals(0x100f0e0d, a.getUint32(12, Endian.little));
|
||||
}
|
||||
ByteData main() {
|
||||
var length = 16;
|
||||
var a = createExternalByteData();
|
||||
Expect.equals(length, a.lengthInBytes);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
access(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
)";
|
||||
// Create a test library and Load up a test script in it.
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
|
||||
|
||||
|
@ -4141,9 +4153,12 @@ TEST_CASE(DartAPI_WeakPersistentHandleUpdateSize) {
|
|||
import "dart:nativewrappers";
|
||||
class ExampleResource extends NativeFieldWrapperClass1 {
|
||||
ExampleResource() { _allocate(); }
|
||||
void _allocate() native "ExampleResource_Allocate";
|
||||
void use() native "ExampleResource_Use";
|
||||
void dispose() native "ExampleResource_Dispose";
|
||||
@pragma("vm:external-name", "ExampleResource_Allocate")
|
||||
external void _allocate();
|
||||
@pragma("vm:external-name", "ExampleResource_Use")
|
||||
external void use();
|
||||
@pragma("vm:external-name", "ExampleResource_Dispose")
|
||||
external void dispose();
|
||||
}
|
||||
main() {
|
||||
var res = new ExampleResource();
|
||||
|
@ -4185,7 +4200,8 @@ TEST_CASE(DartAPI_NativeFieldAccess) {
|
|||
import 'dart:nativewrappers';
|
||||
class SecretKeeper extends NativeFieldWrapperClass1 {
|
||||
SecretKeeper(int secret) { _keepSecret(secret); }
|
||||
void _keepSecret(int secret) native "SecretKeeper_KeepSecret";
|
||||
@pragma("vm:external-name", "SecretKeeper_KeepSecret")
|
||||
external void _keepSecret(int secret);
|
||||
}
|
||||
main() => getNativeField(SecretKeeper(321));
|
||||
)";
|
||||
|
@ -5346,29 +5362,32 @@ TEST_CASE(DartAPI_TestNativeFieldsAccess) {
|
|||
// clang-format off
|
||||
auto kScriptChars = Utils::CStringUniquePtr(
|
||||
OS::SCreate(
|
||||
nullptr,
|
||||
"import 'dart:nativewrappers';"
|
||||
"class NativeFields extends NativeFieldWrapperClass2 {\n"
|
||||
" NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
|
||||
" int fld1;\n"
|
||||
" final int fld2;\n"
|
||||
" static int%s fld3;\n"
|
||||
" static const int fld4 = 10;\n"
|
||||
" int%s initNativeFlds() native 'TestNativeFieldsAccess_init';\n"
|
||||
" int%s accessNativeFlds(int%s i) native "
|
||||
"'TestNativeFieldsAccess_access';\n"
|
||||
"}\n"
|
||||
"class NoNativeFields {\n"
|
||||
" int neitherATypedDataNorNull = 0;\n"
|
||||
" invalidAccess() native 'TestNativeFieldsAccess_invalidAccess';\n"
|
||||
"}\n"
|
||||
"NativeFields testMain() {\n"
|
||||
" NativeFields obj = new NativeFields(10, 20);\n"
|
||||
" obj.initNativeFlds();\n"
|
||||
" obj.accessNativeFlds(null);\n"
|
||||
" new NoNativeFields().invalidAccess();\n"
|
||||
" return obj;\n"
|
||||
"}\n",
|
||||
nullptr, R"(
|
||||
import 'dart:nativewrappers';
|
||||
class NativeFields extends NativeFieldWrapperClass2 {
|
||||
NativeFields(int i, int j) : fld1 = i, fld2 = j {}
|
||||
int fld1;
|
||||
final int fld2;
|
||||
static int%s fld3;
|
||||
static const int fld4 = 10;
|
||||
@pragma('vm:external-name', 'TestNativeFieldsAccess_init')
|
||||
external int%s initNativeFlds();
|
||||
@pragma('vm:external-name', 'TestNativeFieldsAccess_access')
|
||||
external int%s accessNativeFlds(int%s i);
|
||||
}
|
||||
class NoNativeFields {
|
||||
int neitherATypedDataNorNull = 0;
|
||||
@pragma('vm:external-name', 'TestNativeFieldsAccess_invalidAccess')
|
||||
external invalidAccess();
|
||||
}
|
||||
NativeFields testMain() {
|
||||
NativeFields obj = new NativeFields(10, 20);
|
||||
obj.initNativeFlds();
|
||||
obj.accessNativeFlds(null);
|
||||
new NoNativeFields().invalidAccess();
|
||||
return obj;
|
||||
}
|
||||
)",
|
||||
nullable_tag, nullable_tag, nullable_tag, nullable_tag),
|
||||
std::free);
|
||||
// clang-format on
|
||||
|
@ -6937,30 +6956,32 @@ static Dart_NativeFunction native_args_lookup(Dart_Handle name,
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_GetNativeArguments) {
|
||||
const char* kScriptChars =
|
||||
"import 'dart:nativewrappers';"
|
||||
"class MyObject extends NativeFieldWrapperClass2 {"
|
||||
" static MyObject createObject() native 'NativeArgument_Create';"
|
||||
" int accessFields(int arg1,"
|
||||
" int arg2,"
|
||||
" bool arg3,"
|
||||
" double arg4,"
|
||||
" String arg5,"
|
||||
" String arg6,"
|
||||
" MyObject arg7) native 'NativeArgument_Access';"
|
||||
"}"
|
||||
"int testMain(String extstr) {"
|
||||
" String str = 'abcdefg';"
|
||||
" MyObject obj1 = MyObject.createObject();"
|
||||
" MyObject obj2 = MyObject.createObject();"
|
||||
" return obj1.accessFields(77,"
|
||||
" 0x8000000000000000,"
|
||||
" true,"
|
||||
" 3.14,"
|
||||
" str,"
|
||||
" extstr,"
|
||||
" obj2);"
|
||||
"}";
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:nativewrappers';
|
||||
class MyObject extends NativeFieldWrapperClass2 {
|
||||
@pragma("vm:external-name", "NativeArgument_Create")
|
||||
external static MyObject createObject();
|
||||
@pragma("vm:external-name", "NativeArgument_Access")
|
||||
external int accessFields(int arg1,
|
||||
int arg2,
|
||||
bool arg3,
|
||||
double arg4,
|
||||
String arg5,
|
||||
String arg6,
|
||||
MyObject arg7);
|
||||
}
|
||||
int testMain(String extstr) {
|
||||
String str = 'abcdefg';
|
||||
MyObject obj1 = MyObject.createObject();
|
||||
MyObject obj2 = MyObject.createObject();
|
||||
return obj1.accessFields(77,
|
||||
0x8000000000000000,
|
||||
true,
|
||||
3.14,
|
||||
str,
|
||||
extstr,
|
||||
obj2);
|
||||
})";
|
||||
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_args_lookup);
|
||||
|
||||
|
@ -6994,14 +7015,15 @@ static Dart_NativeFunction gnac_lookup(Dart_Handle name,
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_GetNativeArgumentCount) {
|
||||
const char* kScriptChars =
|
||||
"class MyObject {"
|
||||
" int method1(int i, int j) native 'Name_Does_Not_Matter';"
|
||||
"}"
|
||||
"testMain() {"
|
||||
" MyObject obj = new MyObject();"
|
||||
" return obj.method1(77, 125);"
|
||||
"}";
|
||||
const char* kScriptChars = R"(
|
||||
class MyObject {
|
||||
@pragma("vm:external-name", "Name_Does_Not_Matter")
|
||||
external int method1(int i, int j);
|
||||
}
|
||||
testMain() {
|
||||
MyObject obj = new MyObject();
|
||||
return obj.method1(77, 125);
|
||||
})";
|
||||
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, gnac_lookup);
|
||||
|
||||
|
@ -9164,19 +9186,20 @@ static Dart_NativeFunction HintFreed_native_lookup(Dart_Handle name,
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_HintFreed) {
|
||||
const char* kScriptChars =
|
||||
"void hintFreed(int size) native 'Test_nativeFunc';\n"
|
||||
"void main() {\n"
|
||||
" var v;\n"
|
||||
" for (var i = 0; i < 100; i++) {\n"
|
||||
" var t = [];\n"
|
||||
" for (var j = 0; j < 10000; j++) {\n"
|
||||
" t.add(List.filled(100, null));\n"
|
||||
" }\n"
|
||||
" v = t;\n"
|
||||
" hintFreed(100 * 10000 * 4);\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void hintFreed(int size);
|
||||
void main() {
|
||||
var v;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var t = [];
|
||||
for (var j = 0; j < 10000; j++) {
|
||||
t.add(List.filled(100, null));
|
||||
}
|
||||
v = t;
|
||||
hintFreed(100 * 10000 * 4);
|
||||
}
|
||||
})";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &HintFreed_native_lookup);
|
||||
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
|
@ -9195,19 +9218,20 @@ static Dart_NativeFunction NotifyIdleShort_native_lookup(
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_NotifyIdleShort) {
|
||||
const char* kScriptChars =
|
||||
"void notifyIdle() native 'Test_nativeFunc';\n"
|
||||
"void main() {\n"
|
||||
" var v;\n"
|
||||
" for (var i = 0; i < 100; i++) {\n"
|
||||
" var t = [];\n"
|
||||
" for (var j = 0; j < 10000; j++) {\n"
|
||||
" t.add(List.filled(100, null));\n"
|
||||
" }\n"
|
||||
" v = t;\n"
|
||||
" notifyIdle();\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void notifyIdle();
|
||||
void main() {
|
||||
var v;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var t = [];
|
||||
for (var j = 0; j < 10000; j++) {
|
||||
t.add(List.filled(100, null));
|
||||
}
|
||||
v = t;
|
||||
notifyIdle();
|
||||
}
|
||||
})";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &NotifyIdleShort_native_lookup);
|
||||
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
|
@ -9226,19 +9250,21 @@ static Dart_NativeFunction NotifyIdleLong_native_lookup(
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_NotifyIdleLong) {
|
||||
const char* kScriptChars =
|
||||
"void notifyIdle() native 'Test_nativeFunc';\n"
|
||||
"void main() {\n"
|
||||
" var v;\n"
|
||||
" for (var i = 0; i < 100; i++) {\n"
|
||||
" var t = [];\n"
|
||||
" for (var j = 0; j < 10000; j++) {\n"
|
||||
" t.add(List.filled(100, null));\n"
|
||||
" }\n"
|
||||
" v = t;\n"
|
||||
" notifyIdle();\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void notifyIdle();
|
||||
void main() {
|
||||
var v;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var t = [];
|
||||
for (var j = 0; j < 10000; j++) {
|
||||
t.add(List.filled(100, null));
|
||||
}
|
||||
v = t;
|
||||
notifyIdle();
|
||||
}
|
||||
}
|
||||
)";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &NotifyIdleLong_native_lookup);
|
||||
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
|
@ -9257,20 +9283,21 @@ static Dart_NativeFunction NotifyLowMemory_native_lookup(
|
|||
}
|
||||
|
||||
TEST_CASE(DartAPI_NotifyLowMemory) {
|
||||
const char* kScriptChars =
|
||||
"import 'dart:isolate';\n"
|
||||
"void notifyLowMemory() native 'Test_nativeFunc';\n"
|
||||
"void main() {\n"
|
||||
" var v;\n"
|
||||
" for (var i = 0; i < 100; i++) {\n"
|
||||
" var t = [];\n"
|
||||
" for (var j = 0; j < 10000; j++) {\n"
|
||||
" t.add(List.filled(100, null));\n"
|
||||
" }\n"
|
||||
" v = t;\n"
|
||||
" notifyLowMemory();\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:isolate';
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void notifyLowMemory();
|
||||
void main() {
|
||||
var v;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var t = [];
|
||||
for (var j = 0; j < 10000; j++) {
|
||||
t.add(List.filled(100, null));
|
||||
}
|
||||
v = t;
|
||||
notifyLowMemory();
|
||||
}
|
||||
})";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &NotifyLowMemory_native_lookup);
|
||||
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
|
|
|
@ -215,6 +215,8 @@ KernelLoader::KernelLoader(Program* program,
|
|||
potential_pragma_functions_(GrowableObjectArray::Handle(Z)),
|
||||
static_field_value_(Object::Handle(Z)),
|
||||
pragma_class_(Class::Handle(Z)),
|
||||
pragma_name_field_(Field::Handle(Z)),
|
||||
pragma_options_field_(Field::Handle(Z)),
|
||||
name_index_handle_(Smi::Handle(Z)),
|
||||
expression_evaluation_library_(Library::Handle(Z)) {
|
||||
if (!program->is_single_program()) {
|
||||
|
@ -485,6 +487,8 @@ KernelLoader::KernelLoader(const Script& script,
|
|||
potential_pragma_functions_(GrowableObjectArray::Handle(Z)),
|
||||
static_field_value_(Object::Handle(Z)),
|
||||
pragma_class_(Class::Handle(Z)),
|
||||
pragma_name_field_(Field::Handle(Z)),
|
||||
pragma_options_field_(Field::Handle(Z)),
|
||||
name_index_handle_(Smi::Handle(Z)),
|
||||
expression_evaluation_library_(Library::Handle(Z)) {
|
||||
ASSERT(T.active_class_ == &active_class_);
|
||||
|
@ -524,8 +528,12 @@ void KernelLoader::AnnotateNativeProcedures() {
|
|||
|
||||
// Obtain `dart:_internal::ExternalName.name`.
|
||||
EnsureExternalClassIsLookedUp();
|
||||
EnsurePragmaClassIsLookedUp();
|
||||
|
||||
Instance& constant = Instance::Handle(Z);
|
||||
String& native_name = String::Handle(Z);
|
||||
String& pragma_name = String::Handle(Z);
|
||||
Object& pragma_options = Object::Handle(Z);
|
||||
|
||||
// Start scanning all candidates in [potential_natives] for the annotation
|
||||
// constant. If the annotation is found, flag the [Function] as native and
|
||||
|
@ -533,6 +541,7 @@ void KernelLoader::AnnotateNativeProcedures() {
|
|||
Function& function = Function::Handle(Z);
|
||||
for (intptr_t i = 0; i < length; ++i) {
|
||||
function ^= potential_natives_.At(i);
|
||||
|
||||
helper_.SetOffset(function.KernelDataProgramOffset() +
|
||||
function.kernel_offset());
|
||||
{
|
||||
|
@ -562,6 +571,22 @@ void KernelLoader::AnnotateNativeProcedures() {
|
|||
function.set_native_name(native_name);
|
||||
function.set_is_external(false);
|
||||
break;
|
||||
} else if (constant_reader.IsInstanceConstant(constant_table_index,
|
||||
pragma_class_)) {
|
||||
constant = constant_reader.ReadConstant(constant_table_index);
|
||||
ASSERT(constant.clazz() == pragma_class_.ptr());
|
||||
// We found the annotation, let's flag the function as native and
|
||||
// set the native name!
|
||||
pragma_name ^= constant.GetField(pragma_name_field_);
|
||||
if (pragma_name.ptr() == Symbols::vm_external_name().ptr()) {
|
||||
pragma_options = constant.GetField(pragma_options_field_);
|
||||
if (pragma_options.IsString()) {
|
||||
function.set_is_native(true);
|
||||
function.set_native_name(String::Cast(pragma_options));
|
||||
function.set_is_external(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
helper_.SkipExpression();
|
||||
|
@ -1091,12 +1116,8 @@ void KernelLoader::FinishTopLevelClassLoading(
|
|||
field_helper.ReadUntilExcluding(FieldHelper::kAnnotations);
|
||||
intptr_t annotation_count = helper_.ReadListLength();
|
||||
bool has_pragma_annotation;
|
||||
{
|
||||
String& native_name_unused = String::Handle();
|
||||
bool is_potential_native_unused;
|
||||
ReadVMAnnotations(library, annotation_count, &native_name_unused,
|
||||
&is_potential_native_unused, &has_pragma_annotation);
|
||||
}
|
||||
ReadVMAnnotations(library, annotation_count, /*native_name=*/nullptr,
|
||||
/*is_potential_native=*/nullptr, &has_pragma_annotation);
|
||||
field_helper.SetJustRead(FieldHelper::kAnnotations);
|
||||
|
||||
field_helper.ReadUntilExcluding(FieldHelper::kType);
|
||||
|
@ -1387,12 +1408,8 @@ void KernelLoader::LoadClass(const Library& library,
|
|||
class_helper.ReadUntilExcluding(ClassHelper::kAnnotations);
|
||||
intptr_t annotation_count = helper_.ReadListLength();
|
||||
bool has_pragma_annotation = false;
|
||||
{
|
||||
String& native_name_unused = String::Handle(Z);
|
||||
bool is_potential_native_unused = false;
|
||||
ReadVMAnnotations(library, annotation_count, &native_name_unused,
|
||||
&is_potential_native_unused, &has_pragma_annotation);
|
||||
}
|
||||
ReadVMAnnotations(library, annotation_count, /*native_name=*/nullptr,
|
||||
/*is_potential_native=*/nullptr, &has_pragma_annotation);
|
||||
if (has_pragma_annotation) {
|
||||
out_class->set_has_pragma(true);
|
||||
}
|
||||
|
@ -1467,12 +1484,9 @@ void KernelLoader::FinishClassLoading(const Class& klass,
|
|||
field_helper.ReadUntilExcluding(FieldHelper::kAnnotations);
|
||||
intptr_t annotation_count = helper_.ReadListLength();
|
||||
bool has_pragma_annotation;
|
||||
{
|
||||
String& native_name_unused = String::Handle();
|
||||
bool is_potential_native_unused;
|
||||
ReadVMAnnotations(library, annotation_count, &native_name_unused,
|
||||
&is_potential_native_unused, &has_pragma_annotation);
|
||||
}
|
||||
ReadVMAnnotations(library, annotation_count, /*native_name=*/nullptr,
|
||||
/*is_potential_native=*/nullptr,
|
||||
&has_pragma_annotation);
|
||||
field_helper.SetJustRead(FieldHelper::kAnnotations);
|
||||
|
||||
field_helper.ReadUntilExcluding(FieldHelper::kType);
|
||||
|
@ -1578,12 +1592,8 @@ void KernelLoader::FinishClassLoading(const Class& klass,
|
|||
constructor_helper.ReadUntilExcluding(ConstructorHelper::kAnnotations);
|
||||
intptr_t annotation_count = helper_.ReadListLength();
|
||||
bool has_pragma_annotation;
|
||||
{
|
||||
String& native_name_unused = String::Handle();
|
||||
bool is_potential_native_unused;
|
||||
ReadVMAnnotations(library, annotation_count, &native_name_unused,
|
||||
&is_potential_native_unused, &has_pragma_annotation);
|
||||
}
|
||||
ReadVMAnnotations(library, annotation_count, /*native_name=*/nullptr,
|
||||
/*is_potential_native=*/nullptr, &has_pragma_annotation);
|
||||
constructor_helper.SetJustRead(ConstructorHelper::kAnnotations);
|
||||
constructor_helper.ReadUntilExcluding(ConstructorHelper::kFunction);
|
||||
|
||||
|
@ -1744,21 +1754,33 @@ void KernelLoader::ReadVMAnnotations(const Library& library,
|
|||
String* native_name,
|
||||
bool* is_potential_native,
|
||||
bool* has_pragma_annotation) {
|
||||
*is_potential_native = false;
|
||||
if (is_potential_native != nullptr) {
|
||||
*is_potential_native = false;
|
||||
}
|
||||
*has_pragma_annotation = false;
|
||||
if (annotation_count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Array& constant_table_array =
|
||||
Array::Handle(Z, kernel_program_info_.constants());
|
||||
const bool have_read_constant_table = !constant_table_array.IsNull();
|
||||
|
||||
Instance& constant = Instance::Handle(Z);
|
||||
String& pragma_name = String::Handle(Z);
|
||||
Object& pragma_options = Object::Handle(Z);
|
||||
for (intptr_t i = 0; i < annotation_count; ++i) {
|
||||
const intptr_t tag = helper_.PeekTag();
|
||||
if (tag == kConstantExpression) {
|
||||
const Array& constant_table_array =
|
||||
Array::Handle(kernel_program_info_.constants());
|
||||
if (constant_table_array.IsNull()) {
|
||||
if (!have_read_constant_table) {
|
||||
// We can only read in the constant table once all classes have been
|
||||
// finalized (otherwise we can't create instances of the classes!).
|
||||
//
|
||||
// We therefore delay the scanning for `ExternalName {name: ... }`
|
||||
// constants in the annotation list to later.
|
||||
*is_potential_native = true;
|
||||
if (is_potential_native != nullptr) {
|
||||
*is_potential_native = true;
|
||||
}
|
||||
|
||||
ASSERT(kernel_program_info_.constants_table() !=
|
||||
ExternalTypedData::null());
|
||||
|
@ -1825,12 +1847,25 @@ void KernelLoader::ReadVMAnnotations(const Library& library,
|
|||
// ExternalName or Pragma class.
|
||||
if (constant_reader.IsInstanceConstant(constant_table_index,
|
||||
external_name_class_)) {
|
||||
constant = constant_reader.ReadConstant(constant_table_index);
|
||||
ASSERT(constant.clazz() == external_name_class_.ptr());
|
||||
*native_name ^= constant.GetField(external_name_field_);
|
||||
if (native_name != nullptr) {
|
||||
constant = constant_reader.ReadConstant(constant_table_index);
|
||||
ASSERT(constant.clazz() == external_name_class_.ptr());
|
||||
*native_name ^= constant.GetField(external_name_field_);
|
||||
}
|
||||
} else if (constant_reader.IsInstanceConstant(constant_table_index,
|
||||
pragma_class_)) {
|
||||
*has_pragma_annotation = true;
|
||||
if (native_name != nullptr) {
|
||||
constant = constant_reader.ReadConstant(constant_table_index);
|
||||
ASSERT(constant.clazz() == pragma_class_.ptr());
|
||||
pragma_name ^= constant.GetField(pragma_name_field_);
|
||||
if (pragma_name.ptr() == Symbols::vm_external_name().ptr()) {
|
||||
pragma_options = constant.GetField(pragma_options_field_);
|
||||
if (pragma_options.IsString()) {
|
||||
*native_name ^= pragma_options.ptr();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -351,8 +351,12 @@ class KernelLoader : public ValueObject {
|
|||
const Library& core_lib =
|
||||
Library::Handle(zone_, dart::Library::CoreLibrary());
|
||||
pragma_class_ = core_lib.LookupLocalClass(Symbols::Pragma());
|
||||
pragma_name_field_ = pragma_class_.LookupField(Symbols::name());
|
||||
pragma_options_field_ = pragma_class_.LookupField(Symbols::options());
|
||||
}
|
||||
ASSERT(!pragma_class_.IsNull());
|
||||
ASSERT(!pragma_name_field_.IsNull());
|
||||
ASSERT(!pragma_options_field_.IsNull());
|
||||
ASSERT(pragma_class_.is_declaration_loaded());
|
||||
}
|
||||
|
||||
|
@ -404,6 +408,8 @@ class KernelLoader : public ValueObject {
|
|||
Object& static_field_value_;
|
||||
|
||||
Class& pragma_class_;
|
||||
Field& pragma_name_field_;
|
||||
Field& pragma_options_field_;
|
||||
|
||||
Smi& name_index_handle_;
|
||||
|
||||
|
|
|
@ -4551,7 +4551,7 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
|
|||
"\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
|
||||
"\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-patch\\/"
|
||||
"array.dart\",\"_kind\":\"kernel\"},\"tokenPos\":248,\"endTokenPos\":"
|
||||
"7758},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
|
||||
"7917},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
|
||||
"\"name\":\"dart.core\",\"uri\":\"dart:core\"},\"typeParameters\":[{"
|
||||
"\"type\":\"@"
|
||||
"Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
|
||||
|
@ -4559,8 +4559,8 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
|
|||
"vmName\":\"\",\"location\":{\"type\":"
|
||||
"\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
|
||||
"\"id\":\"\",\"uri\":\"dart:core-patch\\/"
|
||||
"type_patch.dart\",\"_kind\":\"kernel\"},\"tokenPos\":1584,"
|
||||
"\"endTokenPos\":1729},\"library\":{\"type\":\"@Library\",\"fixedId\":"
|
||||
"type_patch.dart\",\"_kind\":\"kernel\"},\"tokenPos\":1749,"
|
||||
"\"endTokenPos\":1894},\"library\":{\"type\":\"@Library\",\"fixedId\":"
|
||||
"true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
|
||||
"\"identityHashCode\":",
|
||||
buffer);
|
||||
|
|
|
@ -165,12 +165,14 @@ TEST_CASE(ValidateStackFrameIteration) {
|
|||
OS::SCreate(
|
||||
nullptr,
|
||||
"class StackFrame {"
|
||||
" static equals(var obj1, var obj2) native \"StackFrame_equals\";"
|
||||
" static int frameCount() native \"StackFrame_frameCount\";"
|
||||
" static int dartFrameCount() native \"StackFrame_dartFrameCount\";"
|
||||
" static validateFrame(int index,"
|
||||
" String name) native "
|
||||
"\"StackFrame_validateFrame\";"
|
||||
" @pragma('vm:external-name', 'StackFrame_equals')\n"
|
||||
" external static equals(var obj1, var obj2);\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_frameCount')\n"
|
||||
" external static int frameCount();\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_dartFrameCount')\n"
|
||||
" external static int dartFrameCount();\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_validateFrame')\n"
|
||||
" external static validateFrame(int index, String name);"
|
||||
"} "
|
||||
"class First {"
|
||||
" First() { }"
|
||||
|
@ -262,12 +264,14 @@ TEST_CASE(ValidateNoSuchMethodStackFrameIteration) {
|
|||
if (FLAG_lazy_dispatchers) {
|
||||
kScriptChars =
|
||||
"class StackFrame {"
|
||||
" static equals(var obj1, var obj2) native \"StackFrame_equals\";"
|
||||
" static int frameCount() native \"StackFrame_frameCount\";"
|
||||
" static int dartFrameCount() native \"StackFrame_dartFrameCount\";"
|
||||
" static validateFrame(int index,"
|
||||
" String name) native "
|
||||
"\"StackFrame_validateFrame\";"
|
||||
" @pragma('vm:external-name', 'StackFrame_equals')\n"
|
||||
" external static equals(var obj1, var obj2);\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_frameCount')\n"
|
||||
" external static int frameCount();\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_dartFrameCount')\n"
|
||||
" external static int dartFrameCount();\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_validateFrame')\n"
|
||||
" external static validateFrame(int index, String name);"
|
||||
"} "
|
||||
"class StackFrame2Test {"
|
||||
" StackFrame2Test() {}"
|
||||
|
@ -299,12 +303,14 @@ TEST_CASE(ValidateNoSuchMethodStackFrameIteration) {
|
|||
} else {
|
||||
kScriptChars =
|
||||
"class StackFrame {"
|
||||
" static equals(var obj1, var obj2) native \"StackFrame_equals\";"
|
||||
" static int frameCount() native \"StackFrame_frameCount\";"
|
||||
" static int dartFrameCount() native \"StackFrame_dartFrameCount\";"
|
||||
" static validateFrame(int index,"
|
||||
" String name) native "
|
||||
"\"StackFrame_validateFrame\";"
|
||||
" @pragma('vm:external-name', 'StackFrame_equals')\n"
|
||||
" external static equals(var obj1, var obj2);\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_frameCount')\n"
|
||||
" external static int frameCount();\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_dartFrameCount')\n"
|
||||
" external static int dartFrameCount();\n"
|
||||
" @pragma('vm:external-name', 'StackFrame_validateFrame')\n"
|
||||
" external static validateFrame(int index, String name);"
|
||||
"} "
|
||||
"class StackFrame2Test {"
|
||||
" StackFrame2Test() {}"
|
||||
|
|
|
@ -467,7 +467,8 @@ class ObjectPointerVisitor;
|
|||
V(vm_recognized, "vm:recognized") \
|
||||
V(vm_trace_entrypoints, "vm:testing.unsafe.trace-entrypoints-fn") \
|
||||
V(vm_ffi_struct_fields, "vm:ffi:struct-fields") \
|
||||
V(vm_unsafe_no_interrupts, "vm:unsafe:no-interrupts")
|
||||
V(vm_unsafe_no_interrupts, "vm:unsafe:no-interrupts") \
|
||||
V(vm_external_name, "vm:external-name")
|
||||
|
||||
// Contains a list of frequently used strings in a canonicalized form. This
|
||||
// list is kept in the vm_isolate in order to share the copy across isolates
|
||||
|
|
|
@ -219,10 +219,14 @@ bool TestCase::IsNNBD() {
|
|||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
static const char* kIsolateReloadTestLibSource =
|
||||
"void reloadTest() native 'Test_Reload';\n"
|
||||
"void collectNewSpace() native 'Test_CollectNewSpace';\n"
|
||||
"void collectOldSpace() native 'Test_CollectOldSpace';\n";
|
||||
static const char* kIsolateReloadTestLibSource = R"(
|
||||
@pragma("vm:external-name", "Test_Reload")
|
||||
external void reloadTest();
|
||||
@pragma("vm:external-name", "Test_CollectNewSpace")
|
||||
external void collectNewSpace();
|
||||
@pragma("vm:external-name", "Test_CollectOldSpace")
|
||||
external void collectOldSpace();
|
||||
)";
|
||||
|
||||
static const char* IsolateReloadTestLibUri() {
|
||||
return "test:isolate_reload_helper";
|
||||
|
|
|
@ -24,7 +24,8 @@ bool _setupCompleted = false;
|
|||
// 'print' implementation.
|
||||
// The standalone embedder registers the closurized _print function with the
|
||||
// dart:core library.
|
||||
void _printString(String s) native "Builtin_PrintString";
|
||||
@pragma("vm:external-name", "Builtin_PrintString")
|
||||
external void _printString(String s);
|
||||
|
||||
void _print(arg) {
|
||||
_printString(arg.toString());
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
import "dart:_internal" show patch;
|
||||
|
||||
@patch
|
||||
void _waitForEvent(int timeoutMillis) native "CLI_WaitForEvent";
|
||||
@pragma("vm:external-name", "CLI_WaitForEvent")
|
||||
external void _waitForEvent(int timeoutMillis);
|
||||
|
|
|
@ -65,13 +65,15 @@ bool _isDirectIOCapableTypedList(List<int> buffer) {
|
|||
@patch
|
||||
class OSError {
|
||||
@patch
|
||||
static int inProgressErrorCode() native "OSError_inProgressErrorCode";
|
||||
@pragma("vm:external-name", "OSError_inProgressErrorCode")
|
||||
external static int inProgressErrorCode();
|
||||
}
|
||||
|
||||
@patch
|
||||
class _IOCrypto {
|
||||
@patch
|
||||
static Uint8List getRandomBytes(int count) native "Crypto_GetRandomBytes";
|
||||
@pragma("vm:external-name", "Crypto_GetRandomBytes")
|
||||
external static Uint8List getRandomBytes(int count);
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
|
|
@ -7,34 +7,39 @@
|
|||
@patch
|
||||
class _Directory {
|
||||
@patch
|
||||
static _current(_Namespace namespace) native "Directory_Current";
|
||||
@pragma("vm:external-name", "Directory_Current")
|
||||
external static _current(_Namespace namespace);
|
||||
@patch
|
||||
static _setCurrent(_Namespace namespace, Uint8List rawPath)
|
||||
native "Directory_SetCurrent";
|
||||
@pragma("vm:external-name", "Directory_SetCurrent")
|
||||
external static _setCurrent(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _createTemp(_Namespace namespace, Uint8List rawPath)
|
||||
native "Directory_CreateTemp";
|
||||
@pragma("vm:external-name", "Directory_CreateTemp")
|
||||
external static _createTemp(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static String _systemTemp(_Namespace namespace) native "Directory_SystemTemp";
|
||||
@pragma("vm:external-name", "Directory_SystemTemp")
|
||||
external static String _systemTemp(_Namespace namespace);
|
||||
@patch
|
||||
static _exists(_Namespace namespace, Uint8List rawPath)
|
||||
native "Directory_Exists";
|
||||
@pragma("vm:external-name", "Directory_Exists")
|
||||
external static _exists(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _create(_Namespace namespace, Uint8List rawPath)
|
||||
native "Directory_Create";
|
||||
@pragma("vm:external-name", "Directory_Create")
|
||||
external static _create(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _deleteNative(_Namespace namespace, Uint8List rawPath, bool recursive)
|
||||
native "Directory_Delete";
|
||||
@pragma("vm:external-name", "Directory_Delete")
|
||||
external static _deleteNative(
|
||||
_Namespace namespace, Uint8List rawPath, bool recursive);
|
||||
@patch
|
||||
static _rename(_Namespace namespace, Uint8List rawPath, String newPath)
|
||||
native "Directory_Rename";
|
||||
@pragma("vm:external-name", "Directory_Rename")
|
||||
external static _rename(
|
||||
_Namespace namespace, Uint8List rawPath, String newPath);
|
||||
@patch
|
||||
static void _fillWithDirectoryListing(
|
||||
@pragma("vm:external-name", "Directory_FillWithDirectoryListing")
|
||||
external static void _fillWithDirectoryListing(
|
||||
_Namespace namespace,
|
||||
List<FileSystemEntity> list,
|
||||
Uint8List rawPath,
|
||||
bool recursive,
|
||||
bool followLinks) native "Directory_FillWithDirectoryListing";
|
||||
bool followLinks);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -51,9 +56,11 @@ class _AsyncDirectoryListerOpsImpl extends NativeFieldWrapperClass1
|
|||
factory _AsyncDirectoryListerOpsImpl(int pointer) =>
|
||||
new _AsyncDirectoryListerOpsImpl._().._setPointer(pointer);
|
||||
|
||||
void _setPointer(int pointer)
|
||||
native "Directory_SetAsyncDirectoryListerPointer";
|
||||
int getPointer() native "Directory_GetAsyncDirectoryListerPointer";
|
||||
@pragma("vm:external-name", "Directory_SetAsyncDirectoryListerPointer")
|
||||
external void _setPointer(int pointer);
|
||||
|
||||
@pragma("vm:external-name", "Directory_GetAsyncDirectoryListerPointer")
|
||||
external int getPointer();
|
||||
}
|
||||
|
||||
// Corelib 'Uri.base' implementation.
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
@patch
|
||||
class _EventHandler {
|
||||
@patch
|
||||
static void _sendData(Object? sender, SendPort sendPort, int data)
|
||||
native "EventHandler_SendData";
|
||||
@pragma("vm:external-name", "EventHandler_SendData")
|
||||
external static void _sendData(Object? sender, SendPort sendPort, int data);
|
||||
|
||||
static int _timerMillisecondClock()
|
||||
native "EventHandler_TimerMillisecondClock";
|
||||
@pragma("vm:external-name", "EventHandler_TimerMillisecondClock")
|
||||
external static int _timerMillisecondClock();
|
||||
}
|
||||
|
|
|
@ -7,50 +7,59 @@
|
|||
@patch
|
||||
class _File {
|
||||
@patch
|
||||
static _exists(_Namespace namespace, Uint8List rawPath) native "File_Exists";
|
||||
@pragma("vm:external-name", "File_Exists")
|
||||
external static _exists(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _create(_Namespace namespace, Uint8List rawPath) native "File_Create";
|
||||
@pragma("vm:external-name", "File_Create")
|
||||
external static _create(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _createLink(_Namespace namespace, Uint8List rawPath, String target)
|
||||
native "File_CreateLink";
|
||||
@pragma("vm:external-name", "File_CreateLink")
|
||||
external static _createLink(
|
||||
_Namespace namespace, Uint8List rawPath, String target);
|
||||
@patch
|
||||
static _linkTarget(_Namespace namespace, Uint8List rawPath)
|
||||
native "File_LinkTarget";
|
||||
@pragma("vm:external-name", "File_LinkTarget")
|
||||
external static _linkTarget(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _deleteNative(_Namespace namespace, Uint8List rawPath)
|
||||
native "File_Delete";
|
||||
@pragma("vm:external-name", "File_Delete")
|
||||
external static _deleteNative(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _deleteLinkNative(_Namespace namespace, Uint8List rawPath)
|
||||
native "File_DeleteLink";
|
||||
@pragma("vm:external-name", "File_DeleteLink")
|
||||
external static _deleteLinkNative(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _rename(_Namespace namespace, Uint8List oldPath, String newPath)
|
||||
native "File_Rename";
|
||||
@pragma("vm:external-name", "File_Rename")
|
||||
external static _rename(
|
||||
_Namespace namespace, Uint8List oldPath, String newPath);
|
||||
@patch
|
||||
static _renameLink(_Namespace namespace, Uint8List oldPath, String newPath)
|
||||
native "File_RenameLink";
|
||||
@pragma("vm:external-name", "File_RenameLink")
|
||||
external static _renameLink(
|
||||
_Namespace namespace, Uint8List oldPath, String newPath);
|
||||
@patch
|
||||
static _copy(_Namespace namespace, Uint8List oldPath, String newPath)
|
||||
native "File_Copy";
|
||||
@pragma("vm:external-name", "File_Copy")
|
||||
external static _copy(
|
||||
_Namespace namespace, Uint8List oldPath, String newPath);
|
||||
@patch
|
||||
static _lengthFromPath(_Namespace namespace, Uint8List rawPath)
|
||||
native "File_LengthFromPath";
|
||||
@pragma("vm:external-name", "File_LengthFromPath")
|
||||
external static _lengthFromPath(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _lastModified(_Namespace namespace, Uint8List rawPath)
|
||||
native "File_LastModified";
|
||||
@pragma("vm:external-name", "File_LastModified")
|
||||
external static _lastModified(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _setLastModified(_Namespace namespace, Uint8List rawPath, int millis)
|
||||
native "File_SetLastModified";
|
||||
@pragma("vm:external-name", "File_SetLastModified")
|
||||
external static _setLastModified(
|
||||
_Namespace namespace, Uint8List rawPath, int millis);
|
||||
@patch
|
||||
static _lastAccessed(_Namespace namespace, Uint8List rawPath)
|
||||
native "File_LastAccessed";
|
||||
@pragma("vm:external-name", "File_LastAccessed")
|
||||
external static _lastAccessed(_Namespace namespace, Uint8List rawPath);
|
||||
@patch
|
||||
static _setLastAccessed(_Namespace namespace, Uint8List rawPath, int millis)
|
||||
native "File_SetLastAccessed";
|
||||
@pragma("vm:external-name", "File_SetLastAccessed")
|
||||
external static _setLastAccessed(
|
||||
_Namespace namespace, Uint8List rawPath, int millis);
|
||||
@patch
|
||||
static _open(_Namespace namespace, Uint8List rawPath, int mode)
|
||||
native "File_Open";
|
||||
@pragma("vm:external-name", "File_Open")
|
||||
external static _open(_Namespace namespace, Uint8List rawPath, int mode);
|
||||
@patch
|
||||
static int _openStdio(int fd) native "File_OpenStdio";
|
||||
@pragma("vm:external-name", "File_OpenStdio")
|
||||
external static int _openStdio(int fd);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -68,21 +77,35 @@ class _RandomAccessFileOpsImpl extends NativeFieldWrapperClass1
|
|||
factory _RandomAccessFileOpsImpl(int pointer) =>
|
||||
new _RandomAccessFileOpsImpl._().._setPointer(pointer);
|
||||
|
||||
void _setPointer(int pointer) native "File_SetPointer";
|
||||
@pragma("vm:external-name", "File_SetPointer")
|
||||
external void _setPointer(int pointer);
|
||||
|
||||
int getPointer() native "File_GetPointer";
|
||||
int close() native "File_Close";
|
||||
readByte() native "File_ReadByte";
|
||||
read(int bytes) native "File_Read";
|
||||
readInto(List<int> buffer, int start, int? end) native "File_ReadInto";
|
||||
writeByte(int value) native "File_WriteByte";
|
||||
writeFrom(List<int> buffer, int start, int? end) native "File_WriteFrom";
|
||||
position() native "File_Position";
|
||||
setPosition(int position) native "File_SetPosition";
|
||||
truncate(int length) native "File_Truncate";
|
||||
length() native "File_Length";
|
||||
flush() native "File_Flush";
|
||||
lock(int lock, int start, int end) native "File_Lock";
|
||||
@pragma("vm:external-name", "File_GetPointer")
|
||||
external int getPointer();
|
||||
@pragma("vm:external-name", "File_Close")
|
||||
external int close();
|
||||
@pragma("vm:external-name", "File_ReadByte")
|
||||
external readByte();
|
||||
@pragma("vm:external-name", "File_Read")
|
||||
external read(int bytes);
|
||||
@pragma("vm:external-name", "File_ReadInto")
|
||||
external readInto(List<int> buffer, int start, int? end);
|
||||
@pragma("vm:external-name", "File_WriteByte")
|
||||
external writeByte(int value);
|
||||
@pragma("vm:external-name", "File_WriteFrom")
|
||||
external writeFrom(List<int> buffer, int start, int? end);
|
||||
@pragma("vm:external-name", "File_Position")
|
||||
external position();
|
||||
@pragma("vm:external-name", "File_SetPosition")
|
||||
external setPosition(int position);
|
||||
@pragma("vm:external-name", "File_Truncate")
|
||||
external truncate(int length);
|
||||
@pragma("vm:external-name", "File_Length")
|
||||
external length();
|
||||
@pragma("vm:external-name", "File_Flush")
|
||||
external flush();
|
||||
@pragma("vm:external-name", "File_Lock")
|
||||
external lock(int lock, int start, int end);
|
||||
}
|
||||
|
||||
class _WatcherPath {
|
||||
|
@ -339,19 +362,23 @@ abstract class _FileSystemWatcher {
|
|||
}
|
||||
|
||||
@patch
|
||||
static bool get isSupported native "FileSystemWatcher_IsSupported";
|
||||
@pragma("vm:external-name", "FileSystemWatcher_IsSupported")
|
||||
external static bool get isSupported;
|
||||
|
||||
static int _initWatcher() native "FileSystemWatcher_InitWatcher";
|
||||
static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher";
|
||||
@pragma("vm:external-name", "FileSystemWatcher_InitWatcher")
|
||||
external static int _initWatcher();
|
||||
@pragma("vm:external-name", "FileSystemWatcher_CloseWatcher")
|
||||
external static void _closeWatcher(int id);
|
||||
|
||||
static int _watchPath(int id, _Namespace namespace, String path, int events,
|
||||
bool recursive) native "FileSystemWatcher_WatchPath";
|
||||
static void _unwatchPath(int id, int path_id)
|
||||
native "FileSystemWatcher_UnwatchPath";
|
||||
static List _readEvents(int id, int path_id)
|
||||
native "FileSystemWatcher_ReadEvents";
|
||||
static int _getSocketId(int id, int path_id)
|
||||
native "FileSystemWatcher_GetSocketId";
|
||||
@pragma("vm:external-name", "FileSystemWatcher_WatchPath")
|
||||
external static int _watchPath(
|
||||
int id, _Namespace namespace, String path, int events, bool recursive);
|
||||
@pragma("vm:external-name", "FileSystemWatcher_UnwatchPath")
|
||||
external static void _unwatchPath(int id, int path_id);
|
||||
@pragma("vm:external-name", "FileSystemWatcher_ReadEvents")
|
||||
external static List _readEvents(int id, int path_id);
|
||||
@pragma("vm:external-name", "FileSystemWatcher_GetSocketId")
|
||||
external static int _getSocketId(int id, int path_id);
|
||||
}
|
||||
|
||||
class _InotifyFileSystemWatcher extends _FileSystemWatcher {
|
||||
|
|
|
@ -7,18 +7,21 @@
|
|||
@patch
|
||||
class FileStat {
|
||||
@patch
|
||||
static _statSync(_Namespace namespace, String path) native "File_Stat";
|
||||
@pragma("vm:external-name", "File_Stat")
|
||||
external static _statSync(_Namespace namespace, String path);
|
||||
}
|
||||
|
||||
@patch
|
||||
class FileSystemEntity {
|
||||
@patch
|
||||
static _getTypeNative(_Namespace namespace, Uint8List rawPath,
|
||||
bool followLinks) native "File_GetType";
|
||||
@pragma("vm:external-name", "File_GetType")
|
||||
external static _getTypeNative(
|
||||
_Namespace namespace, Uint8List rawPath, bool followLinks);
|
||||
@patch
|
||||
static _identicalNative(_Namespace namespace, String path1, String path2)
|
||||
native "File_AreIdentical";
|
||||
@pragma("vm:external-name", "File_AreIdentical")
|
||||
external static _identicalNative(
|
||||
_Namespace namespace, String path1, String path2);
|
||||
@patch
|
||||
static _resolveSymbolicLinks(_Namespace namespace, Uint8List path)
|
||||
native "File_ResolveSymbolicLinks";
|
||||
@pragma("vm:external-name", "File_ResolveSymbolicLinks")
|
||||
external static _resolveSymbolicLinks(_Namespace namespace, Uint8List path);
|
||||
}
|
||||
|
|
|
@ -5,18 +5,19 @@
|
|||
// part of "common_patch.dart";
|
||||
|
||||
class _FilterImpl extends NativeFieldWrapperClass1 implements RawZLibFilter {
|
||||
void process(List<int> data, int start, int end) native "Filter_Process";
|
||||
@pragma("vm:external-name", "Filter_Process")
|
||||
external void process(List<int> data, int start, int end);
|
||||
|
||||
List<int>? processed({bool flush: true, bool end: false})
|
||||
native "Filter_Processed";
|
||||
@pragma("vm:external-name", "Filter_Processed")
|
||||
external List<int>? processed({bool flush: true, bool end: false});
|
||||
}
|
||||
|
||||
class _ZLibInflateFilter extends _FilterImpl {
|
||||
_ZLibInflateFilter(int windowBits, List<int>? dictionary, bool raw) {
|
||||
_init(windowBits, dictionary, raw);
|
||||
}
|
||||
void _init(int windowBits, List<int>? dictionary, bool raw)
|
||||
native "Filter_CreateZLibInflate";
|
||||
@pragma("vm:external-name", "Filter_CreateZLibInflate")
|
||||
external void _init(int windowBits, List<int>? dictionary, bool raw);
|
||||
}
|
||||
|
||||
class _ZLibDeflateFilter extends _FilterImpl {
|
||||
|
@ -24,8 +25,9 @@ class _ZLibDeflateFilter extends _FilterImpl {
|
|||
int strategy, List<int>? dictionary, bool raw) {
|
||||
_init(gzip, level, windowBits, memLevel, strategy, dictionary, raw);
|
||||
}
|
||||
void _init(bool gzip, int level, int windowBits, int memLevel, int strategy,
|
||||
List<int>? dictionary, bool raw) native "Filter_CreateZLibDeflate";
|
||||
@pragma("vm:external-name", "Filter_CreateZLibDeflate")
|
||||
external void _init(bool gzip, int level, int windowBits, int memLevel,
|
||||
int strategy, List<int>? dictionary, bool raw);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
|
|
@ -40,7 +40,8 @@ class _IOServicePorts {
|
|||
}
|
||||
}
|
||||
|
||||
static SendPort _newServicePort() native "IOService_NewServicePort";
|
||||
@pragma("vm:external-name", "IOService_NewServicePort")
|
||||
external static SendPort _newServicePort();
|
||||
}
|
||||
|
||||
@patch
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
class _NamespaceImpl extends NativeFieldWrapperClass1 implements _Namespace {
|
||||
_NamespaceImpl._();
|
||||
|
||||
static _NamespaceImpl _create(_NamespaceImpl namespace, var n)
|
||||
native "Namespace_Create";
|
||||
static int _getPointer(_NamespaceImpl namespace)
|
||||
native "Namespace_GetPointer";
|
||||
static int _getDefault() native "Namespace_GetDefault";
|
||||
@pragma("vm:external-name", "Namespace_Create")
|
||||
external static _NamespaceImpl _create(_NamespaceImpl namespace, var n);
|
||||
@pragma("vm:external-name", "Namespace_GetPointer")
|
||||
external static int _getPointer(_NamespaceImpl namespace);
|
||||
@pragma("vm:external-name", "Namespace_GetDefault")
|
||||
external static int _getDefault();
|
||||
|
||||
// If the platform supports "namespaces", this method is called by the
|
||||
// embedder with the platform-specific namespace information.
|
||||
|
|
|
@ -8,29 +8,39 @@
|
|||
@pragma("vm:entry-point")
|
||||
class _Platform {
|
||||
@patch
|
||||
static int _numberOfProcessors() native "Platform_NumberOfProcessors";
|
||||
@pragma("vm:external-name", "Platform_NumberOfProcessors")
|
||||
external static int _numberOfProcessors();
|
||||
@patch
|
||||
static String _pathSeparator() native "Platform_PathSeparator";
|
||||
@pragma("vm:external-name", "Platform_PathSeparator")
|
||||
external static String _pathSeparator();
|
||||
@patch
|
||||
static String _operatingSystem() native "Platform_OperatingSystem";
|
||||
@pragma("vm:external-name", "Platform_OperatingSystem")
|
||||
external static String _operatingSystem();
|
||||
@patch
|
||||
static _operatingSystemVersion() native "Platform_OperatingSystemVersion";
|
||||
@pragma("vm:external-name", "Platform_OperatingSystemVersion")
|
||||
external static _operatingSystemVersion();
|
||||
@patch
|
||||
static _localHostname() native "Platform_LocalHostname";
|
||||
@pragma("vm:external-name", "Platform_LocalHostname")
|
||||
external static _localHostname();
|
||||
@patch
|
||||
static _executable() native "Platform_ExecutableName";
|
||||
@pragma("vm:external-name", "Platform_ExecutableName")
|
||||
external static _executable();
|
||||
@patch
|
||||
static _resolvedExecutable() native "Platform_ResolvedExecutableName";
|
||||
@pragma("vm:external-name", "Platform_ResolvedExecutableName")
|
||||
external static _resolvedExecutable();
|
||||
@patch
|
||||
static _environment() native "Platform_Environment";
|
||||
@pragma("vm:external-name", "Platform_Environment")
|
||||
external static _environment();
|
||||
@patch
|
||||
static List<String> _executableArguments()
|
||||
native "Platform_ExecutableArguments";
|
||||
@pragma("vm:external-name", "Platform_ExecutableArguments")
|
||||
external static List<String> _executableArguments();
|
||||
@patch
|
||||
static String _version() native "Platform_GetVersion";
|
||||
@pragma("vm:external-name", "Platform_GetVersion")
|
||||
external static String _version();
|
||||
|
||||
@patch
|
||||
static String _localeName() native "Platform_LocaleName";
|
||||
@pragma("vm:external-name", "Platform_LocaleName")
|
||||
external static String _localeName();
|
||||
|
||||
@patch
|
||||
static String? _packageRoot() => VMLibraryHooks.packageRootString;
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
@patch
|
||||
class _WindowsCodePageDecoder {
|
||||
@patch
|
||||
static String _decodeBytes(List<int> bytes) native "SystemEncodingToString";
|
||||
@pragma("vm:external-name", "SystemEncodingToString")
|
||||
external static String _decodeBytes(List<int> bytes);
|
||||
}
|
||||
|
||||
@patch
|
||||
class _WindowsCodePageEncoder {
|
||||
@patch
|
||||
static List<int> _encodeString(String string) native "StringToSystemEncoding";
|
||||
@pragma("vm:external-name", "StringToSystemEncoding")
|
||||
external static List<int> _encodeString(String string);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -124,9 +126,10 @@ class _SignalController {
|
|||
}
|
||||
}
|
||||
|
||||
static _setSignalHandler(int signal) native "Process_SetSignalHandler";
|
||||
static void _clearSignalHandler(int signal)
|
||||
native "Process_ClearSignalHandler";
|
||||
@pragma("vm:external-name", "Process_SetSignalHandler")
|
||||
external static _setSignalHandler(int signal);
|
||||
@pragma("vm:external-name", "Process_ClearSignalHandler")
|
||||
external static void _clearSignalHandler(int signal);
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
@ -135,16 +138,22 @@ Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal;
|
|||
@patch
|
||||
class _ProcessUtils {
|
||||
@patch
|
||||
static Never _exit(int status) native "Process_Exit";
|
||||
@pragma("vm:external-name", "Process_Exit")
|
||||
external static Never _exit(int status);
|
||||
@patch
|
||||
static void _setExitCode(int status) native "Process_SetExitCode";
|
||||
@pragma("vm:external-name", "Process_SetExitCode")
|
||||
external static void _setExitCode(int status);
|
||||
@patch
|
||||
static int _getExitCode() native "Process_GetExitCode";
|
||||
@pragma("vm:external-name", "Process_GetExitCode")
|
||||
external static int _getExitCode();
|
||||
@patch
|
||||
static void _sleep(int millis) native "Process_Sleep";
|
||||
@pragma("vm:external-name", "Process_Sleep")
|
||||
external static void _sleep(int millis);
|
||||
@patch
|
||||
static int _pid(Process? process) native "Process_Pid";
|
||||
static bool _killPid(int pid, int signal) native "Process_KillPid";
|
||||
@pragma("vm:external-name", "Process_Pid")
|
||||
external static int _pid(Process? process);
|
||||
@pragma("vm:external-name", "Process_KillPid")
|
||||
external static bool _killPid(int pid, int signal);
|
||||
@patch
|
||||
static Stream<ProcessSignal> _watchSignal(ProcessSignal signal) {
|
||||
if (signal != ProcessSignal.sighup &&
|
||||
|
@ -188,8 +197,10 @@ class ProcessInfo {
|
|||
return result;
|
||||
}
|
||||
|
||||
static _maxRss() native "ProcessInfo_MaxRSS";
|
||||
static _currentRss() native "ProcessInfo_CurrentRSS";
|
||||
@pragma("vm:external-name", "ProcessInfo_MaxRSS")
|
||||
external static _maxRss();
|
||||
@pragma("vm:external-name", "ProcessInfo_CurrentRSS")
|
||||
external static _currentRss();
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -496,7 +507,8 @@ class _ProcessImpl extends _ProcessImplNativeWrapper implements Process {
|
|||
getOutput(result[3], stderrEncoding));
|
||||
}
|
||||
|
||||
bool _startNative(
|
||||
@pragma("vm:external-name", "Process_Start")
|
||||
external bool _startNative(
|
||||
_Namespace namespace,
|
||||
String path,
|
||||
List<String> arguments,
|
||||
|
@ -507,10 +519,11 @@ class _ProcessImpl extends _ProcessImplNativeWrapper implements Process {
|
|||
_NativeSocket? stdout,
|
||||
_NativeSocket? stderr,
|
||||
_NativeSocket? exitHandler,
|
||||
_ProcessStartStatus status) native "Process_Start";
|
||||
_ProcessStartStatus status);
|
||||
|
||||
_wait(_NativeSocket? stdin, _NativeSocket? stdout, _NativeSocket? stderr,
|
||||
_NativeSocket exitHandler) native "Process_Wait";
|
||||
@pragma("vm:external-name", "Process_Wait")
|
||||
external _wait(_NativeSocket? stdin, _NativeSocket? stdout,
|
||||
_NativeSocket? stderr, _NativeSocket exitHandler);
|
||||
|
||||
Stream<List<int>> get stdout =>
|
||||
_stdout ?? (throw StateError("stdio is not connected"));
|
||||
|
|
|
@ -83,28 +83,32 @@ class _SecureFilterImpl extends NativeFieldWrapperClass1
|
|||
];
|
||||
}
|
||||
|
||||
void connect(
|
||||
@pragma("vm:external-name", "SecureSocket_Connect")
|
||||
external void connect(
|
||||
String hostName,
|
||||
SecurityContext context,
|
||||
bool isServer,
|
||||
bool requestClientCertificate,
|
||||
bool requireClientCertificate,
|
||||
Uint8List protocols) native "SecureSocket_Connect";
|
||||
Uint8List protocols);
|
||||
|
||||
void destroy() {
|
||||
buffers = null;
|
||||
_destroy();
|
||||
}
|
||||
|
||||
void _destroy() native "SecureSocket_Destroy";
|
||||
@pragma("vm:external-name", "SecureSocket_Destroy")
|
||||
external void _destroy();
|
||||
|
||||
int _handshake(SendPort replyPort) native "SecureSocket_Handshake";
|
||||
@pragma("vm:external-name", "SecureSocket_Handshake")
|
||||
external int _handshake(SendPort replyPort);
|
||||
|
||||
void _markAsTrusted(int certificatePtr, bool isTrusted)
|
||||
native "SecureSocket_MarkAsTrusted";
|
||||
@pragma("vm:external-name", "SecureSocket_MarkAsTrusted")
|
||||
external void _markAsTrusted(int certificatePtr, bool isTrusted);
|
||||
|
||||
static X509Certificate _newX509CertificateWrapper(int certificatePtr)
|
||||
native "SecureSocket_NewX509CertificateWrapper";
|
||||
@pragma("vm:external-name", "SecureSocket_NewX509CertificateWrapper")
|
||||
external static X509Certificate _newX509CertificateWrapper(
|
||||
int certificatePtr);
|
||||
|
||||
Future<bool> handshake() {
|
||||
Completer<bool> evaluatorCompleter = Completer<bool>();
|
||||
|
@ -158,17 +162,21 @@ class _SecureFilterImpl extends NativeFieldWrapperClass1
|
|||
|
||||
int processBuffer(int bufferIndex) => throw new UnimplementedError();
|
||||
|
||||
String? selectedProtocol() native "SecureSocket_GetSelectedProtocol";
|
||||
@pragma("vm:external-name", "SecureSocket_GetSelectedProtocol")
|
||||
external String? selectedProtocol();
|
||||
|
||||
void renegotiate(bool useSessionCache, bool requestClientCertificate,
|
||||
bool requireClientCertificate) native "SecureSocket_Renegotiate";
|
||||
@pragma("vm:external-name", "SecureSocket_Renegotiate")
|
||||
external void renegotiate(bool useSessionCache, bool requestClientCertificate,
|
||||
bool requireClientCertificate);
|
||||
|
||||
void init() native "SecureSocket_Init";
|
||||
@pragma("vm:external-name", "SecureSocket_Init")
|
||||
external void init();
|
||||
|
||||
X509Certificate? get peerCertificate native "SecureSocket_PeerCertificate";
|
||||
@pragma("vm:external-name", "SecureSocket_PeerCertificate")
|
||||
external X509Certificate? get peerCertificate;
|
||||
|
||||
void _registerBadCertificateCallback(Function callback)
|
||||
native "SecureSocket_RegisterBadCertificateCallback";
|
||||
@pragma("vm:external-name", "SecureSocket_RegisterBadCertificateCallback")
|
||||
external void _registerBadCertificateCallback(Function callback);
|
||||
|
||||
Function? badCertificateCallback;
|
||||
|
||||
|
@ -177,11 +185,13 @@ class _SecureFilterImpl extends NativeFieldWrapperClass1
|
|||
_registerBadCertificateCallback(callback);
|
||||
}
|
||||
|
||||
void registerHandshakeCompleteCallback(Function handshakeCompleteHandler)
|
||||
native "SecureSocket_RegisterHandshakeCompleteCallback";
|
||||
@pragma("vm:external-name", "SecureSocket_RegisterHandshakeCompleteCallback")
|
||||
external void registerHandshakeCompleteCallback(
|
||||
Function handshakeCompleteHandler);
|
||||
|
||||
// This is a security issue, as it exposes a raw pointer to Dart code.
|
||||
int _pointer() native "SecureSocket_FilterPointer";
|
||||
@pragma("vm:external-name", "SecureSocket_FilterPointer")
|
||||
external int _pointer();
|
||||
|
||||
@pragma("vm:entry-point", "get")
|
||||
List<_ExternalBuffer>? buffers;
|
||||
|
@ -212,7 +222,8 @@ class _SecurityContext extends NativeFieldWrapperClass1
|
|||
}
|
||||
}
|
||||
|
||||
void _createNativeContext() native "SecurityContext_Allocate";
|
||||
@pragma("vm:external-name", "SecurityContext_Allocate")
|
||||
external void _createNativeContext();
|
||||
|
||||
static final SecurityContext defaultContext = new _SecurityContext(true);
|
||||
|
||||
|
@ -221,32 +232,35 @@ class _SecurityContext extends NativeFieldWrapperClass1
|
|||
usePrivateKeyBytes(bytes, password: password);
|
||||
}
|
||||
|
||||
void usePrivateKeyBytes(List<int> keyBytes, {String? password})
|
||||
native "SecurityContext_UsePrivateKeyBytes";
|
||||
@pragma("vm:external-name", "SecurityContext_UsePrivateKeyBytes")
|
||||
external void usePrivateKeyBytes(List<int> keyBytes, {String? password});
|
||||
|
||||
void setTrustedCertificates(String file, {String? password}) {
|
||||
List<int> bytes = (new File(file)).readAsBytesSync();
|
||||
setTrustedCertificatesBytes(bytes, password: password);
|
||||
}
|
||||
|
||||
void setTrustedCertificatesBytes(List<int> certBytes, {String? password})
|
||||
native "SecurityContext_SetTrustedCertificatesBytes";
|
||||
@pragma("vm:external-name", "SecurityContext_SetTrustedCertificatesBytes")
|
||||
external void setTrustedCertificatesBytes(List<int> certBytes,
|
||||
{String? password});
|
||||
|
||||
void useCertificateChain(String file, {String? password}) {
|
||||
List<int> bytes = (new File(file)).readAsBytesSync();
|
||||
useCertificateChainBytes(bytes, password: password);
|
||||
}
|
||||
|
||||
void useCertificateChainBytes(List<int> chainBytes, {String? password})
|
||||
native "SecurityContext_UseCertificateChainBytes";
|
||||
@pragma("vm:external-name", "SecurityContext_UseCertificateChainBytes")
|
||||
external void useCertificateChainBytes(List<int> chainBytes,
|
||||
{String? password});
|
||||
|
||||
void setClientAuthorities(String file, {String? password}) {
|
||||
List<int> bytes = (new File(file)).readAsBytesSync();
|
||||
setClientAuthoritiesBytes(bytes, password: password);
|
||||
}
|
||||
|
||||
void setClientAuthoritiesBytes(List<int> authCertBytes, {String? password})
|
||||
native "SecurityContext_SetClientAuthoritiesBytes";
|
||||
@pragma("vm:external-name", "SecurityContext_SetClientAuthoritiesBytes")
|
||||
external void setClientAuthoritiesBytes(List<int> authCertBytes,
|
||||
{String? password});
|
||||
|
||||
void setAlpnProtocols(List<String> protocols, bool isServer) {
|
||||
Uint8List encodedProtocols =
|
||||
|
@ -254,9 +268,10 @@ class _SecurityContext extends NativeFieldWrapperClass1
|
|||
_setAlpnProtocols(encodedProtocols, isServer);
|
||||
}
|
||||
|
||||
void _setAlpnProtocols(Uint8List protocols, bool isServer)
|
||||
native "SecurityContext_SetAlpnProtocols";
|
||||
void _trustBuiltinRoots() native "SecurityContext_TrustBuiltinRoots";
|
||||
@pragma("vm:external-name", "SecurityContext_SetAlpnProtocols")
|
||||
external void _setAlpnProtocols(Uint8List protocols, bool isServer);
|
||||
@pragma("vm:external-name", "SecurityContext_TrustBuiltinRoots")
|
||||
external void _trustBuiltinRoots();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,17 +284,22 @@ class _X509CertificateImpl extends NativeFieldWrapperClass1
|
|||
// This is done by WrappedX509Certificate in security_context.cc.
|
||||
_X509CertificateImpl._();
|
||||
|
||||
Uint8List get _der native "X509_Der";
|
||||
@pragma("vm:external-name", "X509_Der")
|
||||
external Uint8List get _der;
|
||||
late final Uint8List der = _der;
|
||||
|
||||
String get _pem native "X509_Pem";
|
||||
@pragma("vm:external-name", "X509_Pem")
|
||||
external String get _pem;
|
||||
late final String pem = _pem;
|
||||
|
||||
Uint8List get _sha1 native "X509_Sha1";
|
||||
@pragma("vm:external-name", "X509_Sha1")
|
||||
external Uint8List get _sha1;
|
||||
late final Uint8List sha1 = _sha1;
|
||||
|
||||
String get subject native "X509_Subject";
|
||||
String get issuer native "X509_Issuer";
|
||||
@pragma("vm:external-name", "X509_Subject")
|
||||
external String get subject;
|
||||
@pragma("vm:external-name", "X509_Issuer")
|
||||
external String get issuer;
|
||||
DateTime get startValidity {
|
||||
return new DateTime.fromMillisecondsSinceEpoch(_startValidity(),
|
||||
isUtc: true);
|
||||
|
@ -289,6 +309,8 @@ class _X509CertificateImpl extends NativeFieldWrapperClass1
|
|||
return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), isUtc: true);
|
||||
}
|
||||
|
||||
int _startValidity() native "X509_StartValidity";
|
||||
int _endValidity() native "X509_EndValidity";
|
||||
@pragma("vm:external-name", "X509_StartValidity")
|
||||
external int _startValidity();
|
||||
@pragma("vm:external-name", "X509_EndValidity")
|
||||
external int _endValidity();
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ class RawSocketOption {
|
|||
return _optionsCache[key] ??= _getNativeOptionValue(key);
|
||||
}
|
||||
|
||||
static int _getNativeOptionValue(int key)
|
||||
native "RawSocketOption_GetOptionValue";
|
||||
@pragma("vm:external-name", "RawSocketOption_GetOptionValue")
|
||||
external static int _getNativeOptionValue(int key);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -114,7 +114,8 @@ class NetworkInterface {
|
|||
type: type);
|
||||
}
|
||||
|
||||
static bool _listSupported() native "NetworkInterface_ListSupported";
|
||||
@pragma("vm:external-name", "NetworkInterface_ListSupported")
|
||||
external static bool _listSupported();
|
||||
}
|
||||
|
||||
void _throwOnBadPort(int port) {
|
||||
|
@ -351,11 +352,13 @@ class _InternetAddress implements InternetAddress {
|
|||
return "InternetAddress('$address', ${type.name})";
|
||||
}
|
||||
|
||||
static String _rawAddrToString(Uint8List address)
|
||||
native "InternetAddress_RawAddrToString";
|
||||
static dynamic /* int | OSError */ _parseScopedLinkLocalAddress(
|
||||
String address) native "InternetAddress_ParseScopedLinkLocalAddress";
|
||||
static Uint8List? _parse(String address) native "InternetAddress_Parse";
|
||||
@pragma("vm:external-name", "InternetAddress_RawAddrToString")
|
||||
external static String _rawAddrToString(Uint8List address);
|
||||
@pragma("vm:external-name", "InternetAddress_ParseScopedLinkLocalAddress")
|
||||
external static dynamic /* int | OSError */ _parseScopedLinkLocalAddress(
|
||||
String address);
|
||||
@pragma("vm:external-name", "InternetAddress_Parse")
|
||||
external static Uint8List? _parse(String address);
|
||||
}
|
||||
|
||||
class _NetworkInterface implements NetworkInterface {
|
||||
|
@ -375,7 +378,8 @@ class _NetworkInterface implements NetworkInterface {
|
|||
class _NativeSocketNativeWrapper extends NativeFieldWrapperClass1 {}
|
||||
|
||||
/// Returns error code that corresponds to EINPROGRESS OS error.
|
||||
int get _inProgressErrorCode native "OSError_inProgressErrorCode";
|
||||
@pragma("vm:external-name", "OSError_inProgressErrorCode")
|
||||
external int get _inProgressErrorCode;
|
||||
|
||||
// The _NativeSocket class encapsulates an OS socket.
|
||||
class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
||||
|
@ -1526,46 +1530,66 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
|||
interfaceAddr?._in_addr, interfaceIndex);
|
||||
}
|
||||
|
||||
void nativeSetSocketId(int id, int typeFlags) native "Socket_SetSocketId";
|
||||
int nativeAvailable() native "Socket_Available";
|
||||
bool nativeAvailableDatagram() native "Socket_AvailableDatagram";
|
||||
Uint8List? nativeRead(int len) native "Socket_Read";
|
||||
Datagram? nativeRecvFrom() native "Socket_RecvFrom";
|
||||
int nativeWrite(List<int> buffer, int offset, int bytes)
|
||||
native "Socket_WriteList";
|
||||
int nativeSendTo(List<int> buffer, int offset, int bytes, Uint8List address,
|
||||
int port) native "Socket_SendTo";
|
||||
nativeCreateConnect(Uint8List addr, int port, int scope_id)
|
||||
native "Socket_CreateConnect";
|
||||
nativeCreateUnixDomainConnect(String addr, _Namespace namespace)
|
||||
native "Socket_CreateUnixDomainConnect";
|
||||
nativeCreateBindConnect(Uint8List addr, int port, Uint8List sourceAddr,
|
||||
int scope_id) native "Socket_CreateBindConnect";
|
||||
nativeCreateUnixDomainBindConnect(String addr, String sourceAddr,
|
||||
_Namespace namespace) native "Socket_CreateUnixDomainBindConnect";
|
||||
bool isBindError(int errorNumber) native "SocketBase_IsBindError";
|
||||
nativeCreateBindListen(Uint8List addr, int port, int backlog, bool v6Only,
|
||||
bool shared, int scope_id) native "ServerSocket_CreateBindListen";
|
||||
nativeCreateUnixDomainBindListen(String addr, int backlog, bool shared,
|
||||
_Namespace namespace) native "ServerSocket_CreateUnixDomainBindListen";
|
||||
nativeCreateBindDatagram(Uint8List addr, int port, bool reuseAddress,
|
||||
bool reusePort, int ttl) native "Socket_CreateBindDatagram";
|
||||
bool nativeAccept(_NativeSocket socket) native "ServerSocket_Accept";
|
||||
dynamic nativeGetPort() native "Socket_GetPort";
|
||||
List nativeGetRemotePeer() native "Socket_GetRemotePeer";
|
||||
int nativeGetSocketId() native "Socket_GetSocketId";
|
||||
OSError nativeGetError() native "Socket_GetError";
|
||||
nativeGetOption(int option, int protocol) native "Socket_GetOption";
|
||||
void nativeGetRawOption(int level, int option, Uint8List data)
|
||||
native "Socket_GetRawOption";
|
||||
void nativeSetOption(int option, int protocol, value)
|
||||
native "Socket_SetOption";
|
||||
void nativeSetRawOption(int level, int option, Uint8List data)
|
||||
native "Socket_SetRawOption";
|
||||
void nativeJoinMulticast(Uint8List addr, Uint8List? interfaceAddr,
|
||||
int interfaceIndex) native "Socket_JoinMulticast";
|
||||
void nativeLeaveMulticast(Uint8List addr, Uint8List? interfaceAddr,
|
||||
int interfaceIndex) native "Socket_LeaveMulticast";
|
||||
@pragma("vm:external-name", "Socket_SetSocketId")
|
||||
external void nativeSetSocketId(int id, int typeFlags);
|
||||
@pragma("vm:external-name", "Socket_Available")
|
||||
external int nativeAvailable();
|
||||
@pragma("vm:external-name", "Socket_AvailableDatagram")
|
||||
external bool nativeAvailableDatagram();
|
||||
@pragma("vm:external-name", "Socket_Read")
|
||||
external Uint8List? nativeRead(int len);
|
||||
@pragma("vm:external-name", "Socket_RecvFrom")
|
||||
external Datagram? nativeRecvFrom();
|
||||
@pragma("vm:external-name", "Socket_WriteList")
|
||||
external int nativeWrite(List<int> buffer, int offset, int bytes);
|
||||
@pragma("vm:external-name", "Socket_SendTo")
|
||||
external int nativeSendTo(
|
||||
List<int> buffer, int offset, int bytes, Uint8List address, int port);
|
||||
@pragma("vm:external-name", "Socket_CreateConnect")
|
||||
external nativeCreateConnect(Uint8List addr, int port, int scope_id);
|
||||
@pragma("vm:external-name", "Socket_CreateUnixDomainConnect")
|
||||
external nativeCreateUnixDomainConnect(String addr, _Namespace namespace);
|
||||
@pragma("vm:external-name", "Socket_CreateBindConnect")
|
||||
external nativeCreateBindConnect(
|
||||
Uint8List addr, int port, Uint8List sourceAddr, int scope_id);
|
||||
@pragma("vm:external-name", "Socket_CreateUnixDomainBindConnect")
|
||||
external nativeCreateUnixDomainBindConnect(
|
||||
String addr, String sourceAddr, _Namespace namespace);
|
||||
@pragma("vm:external-name", "SocketBase_IsBindError")
|
||||
external bool isBindError(int errorNumber);
|
||||
@pragma("vm:external-name", "ServerSocket_CreateBindListen")
|
||||
external nativeCreateBindListen(Uint8List addr, int port, int backlog,
|
||||
bool v6Only, bool shared, int scope_id);
|
||||
@pragma("vm:external-name", "ServerSocket_CreateUnixDomainBindListen")
|
||||
external nativeCreateUnixDomainBindListen(
|
||||
String addr, int backlog, bool shared, _Namespace namespace);
|
||||
@pragma("vm:external-name", "Socket_CreateBindDatagram")
|
||||
external nativeCreateBindDatagram(
|
||||
Uint8List addr, int port, bool reuseAddress, bool reusePort, int ttl);
|
||||
@pragma("vm:external-name", "ServerSocket_Accept")
|
||||
external bool nativeAccept(_NativeSocket socket);
|
||||
@pragma("vm:external-name", "Socket_GetPort")
|
||||
external dynamic nativeGetPort();
|
||||
@pragma("vm:external-name", "Socket_GetRemotePeer")
|
||||
external List nativeGetRemotePeer();
|
||||
@pragma("vm:external-name", "Socket_GetSocketId")
|
||||
external int nativeGetSocketId();
|
||||
@pragma("vm:external-name", "Socket_GetError")
|
||||
external OSError nativeGetError();
|
||||
@pragma("vm:external-name", "Socket_GetOption")
|
||||
external nativeGetOption(int option, int protocol);
|
||||
@pragma("vm:external-name", "Socket_GetRawOption")
|
||||
external void nativeGetRawOption(int level, int option, Uint8List data);
|
||||
@pragma("vm:external-name", "Socket_SetOption")
|
||||
external void nativeSetOption(int option, int protocol, value);
|
||||
@pragma("vm:external-name", "Socket_SetRawOption")
|
||||
external void nativeSetRawOption(int level, int option, Uint8List data);
|
||||
@pragma("vm:external-name", "Socket_JoinMulticast")
|
||||
external void nativeJoinMulticast(
|
||||
Uint8List addr, Uint8List? interfaceAddr, int interfaceIndex);
|
||||
@pragma("vm:external-name", "Socket_LeaveMulticast")
|
||||
external void nativeLeaveMulticast(
|
||||
Uint8List addr, Uint8List? interfaceAddr, int interfaceIndex);
|
||||
}
|
||||
|
||||
class _RawServerSocket extends Stream<RawSocket> implements RawServerSocket {
|
||||
|
|
|
@ -50,7 +50,8 @@ class _StdIOUtils {
|
|||
}
|
||||
|
||||
@patch
|
||||
static _getStdioHandleType(int fd) native "File_GetStdioHandleType";
|
||||
@pragma("vm:external-name", "File_GetStdioHandleType")
|
||||
external static _getStdioHandleType(int fd);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -115,12 +116,18 @@ class Stdin {
|
|||
return result;
|
||||
}
|
||||
|
||||
static _echoMode(int fd) native "Stdin_GetEchoMode";
|
||||
static _setEchoMode(int fd, bool enabled) native "Stdin_SetEchoMode";
|
||||
static _lineMode(int fd) native "Stdin_GetLineMode";
|
||||
static _setLineMode(int fd, bool enabled) native "Stdin_SetLineMode";
|
||||
static _readByte(int fd) native "Stdin_ReadByte";
|
||||
static _supportsAnsiEscapes(int fd) native "Stdin_AnsiSupported";
|
||||
@pragma("vm:external-name", "Stdin_GetEchoMode")
|
||||
external static _echoMode(int fd);
|
||||
@pragma("vm:external-name", "Stdin_SetEchoMode")
|
||||
external static _setEchoMode(int fd, bool enabled);
|
||||
@pragma("vm:external-name", "Stdin_GetLineMode")
|
||||
external static _lineMode(int fd);
|
||||
@pragma("vm:external-name", "Stdin_SetLineMode")
|
||||
external static _setLineMode(int fd, bool enabled);
|
||||
@pragma("vm:external-name", "Stdin_ReadByte")
|
||||
external static _readByte(int fd);
|
||||
@pragma("vm:external-name", "Stdin_AnsiSupported")
|
||||
external static _supportsAnsiEscapes(int fd);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -140,7 +147,8 @@ class Stdout {
|
|||
return size;
|
||||
}
|
||||
|
||||
static _getTerminalSize(int fd) native "Stdout_GetTerminalSize";
|
||||
@pragma("vm:external-name", "Stdout_GetTerminalSize")
|
||||
external static _getTerminalSize(int fd);
|
||||
|
||||
@patch
|
||||
static bool _supportsAnsiEscapes(int fd) {
|
||||
|
@ -151,9 +159,11 @@ class Stdout {
|
|||
return result;
|
||||
}
|
||||
|
||||
static _getAnsiSupported(int fd) native "Stdout_AnsiSupported";
|
||||
@pragma("vm:external-name", "Stdout_AnsiSupported")
|
||||
external static _getAnsiSupported(int fd);
|
||||
}
|
||||
|
||||
bool _getStdioHandle(_NativeSocket socket, int num)
|
||||
native "Socket_GetStdioHandle";
|
||||
_getSocketType(_NativeSocket nativeSocket) native "Socket_GetType";
|
||||
@pragma("vm:external-name", "Socket_GetStdioHandle")
|
||||
external bool _getStdioHandle(_NativeSocket socket, int num);
|
||||
@pragma("vm:external-name", "Socket_GetType")
|
||||
external _getSocketType(_NativeSocket nativeSocket);
|
||||
|
|
|
@ -298,19 +298,26 @@ class _NativeSynchronousSocket extends _NativeSynchronousSocketNativeWrapper {
|
|||
}
|
||||
|
||||
// Native method declarations.
|
||||
static _nativeLookupRequest(host, int type)
|
||||
native "SynchronousSocket_LookupRequest";
|
||||
_nativeCreateConnectSync(host, int port)
|
||||
native "SynchronousSocket_CreateConnectSync";
|
||||
_nativeAvailable() native "SynchronousSocket_Available";
|
||||
_nativeCloseSync() native "SynchronousSocket_CloseSync";
|
||||
int _nativeGetPort() native "SynchronousSocket_GetPort";
|
||||
List _nativeGetRemotePeer() native "SynchronousSocket_GetRemotePeer";
|
||||
_nativeRead(int len) native "SynchronousSocket_Read";
|
||||
_nativeReadInto(List<int> buffer, int offset, int bytes)
|
||||
native "SynchronousSocket_ReadList";
|
||||
_nativeShutdownRead() native "SynchronousSocket_ShutdownRead";
|
||||
_nativeShutdownWrite() native "SynchronousSocket_ShutdownWrite";
|
||||
_nativeWrite(List<int> buffer, int offset, int bytes)
|
||||
native "SynchronousSocket_WriteList";
|
||||
@pragma("vm:external-name", "SynchronousSocket_LookupRequest")
|
||||
external static _nativeLookupRequest(host, int type);
|
||||
@pragma("vm:external-name", "SynchronousSocket_CreateConnectSync")
|
||||
external _nativeCreateConnectSync(host, int port);
|
||||
@pragma("vm:external-name", "SynchronousSocket_Available")
|
||||
external _nativeAvailable();
|
||||
@pragma("vm:external-name", "SynchronousSocket_CloseSync")
|
||||
external _nativeCloseSync();
|
||||
@pragma("vm:external-name", "SynchronousSocket_GetPort")
|
||||
external int _nativeGetPort();
|
||||
@pragma("vm:external-name", "SynchronousSocket_GetRemotePeer")
|
||||
external List _nativeGetRemotePeer();
|
||||
@pragma("vm:external-name", "SynchronousSocket_Read")
|
||||
external _nativeRead(int len);
|
||||
@pragma("vm:external-name", "SynchronousSocket_ReadList")
|
||||
external _nativeReadInto(List<int> buffer, int offset, int bytes);
|
||||
@pragma("vm:external-name", "SynchronousSocket_ShutdownRead")
|
||||
external _nativeShutdownRead();
|
||||
@pragma("vm:external-name", "SynchronousSocket_ShutdownWrite")
|
||||
external _nativeShutdownWrite();
|
||||
@pragma("vm:external-name", "SynchronousSocket_WriteList")
|
||||
external _nativeWrite(List<int> buffer, int offset, int bytes);
|
||||
}
|
||||
|
|
|
@ -384,4 +384,5 @@ main() {
|
|||
_registerSignalHandlerTimer = Timer(shortDelay, _registerSignalHandler);
|
||||
}
|
||||
|
||||
_shutdown() native 'VMServiceIO_Shutdown';
|
||||
@pragma("vm:external-name", "VMServiceIO_Shutdown")
|
||||
external _shutdown();
|
||||
|
|
|
@ -522,4 +522,5 @@ class Server {
|
|||
}
|
||||
}
|
||||
|
||||
void _notifyServerState(String uri) native 'VMServiceIO_NotifyServerState';
|
||||
@pragma("vm:external-name", "VMServiceIO_NotifyServerState")
|
||||
external void _notifyServerState(String uri);
|
||||
|
|
|
@ -10,7 +10,8 @@ class _List<E> extends FixedLengthListBase<E> {
|
|||
@pragma("vm:exact-result-type",
|
||||
<dynamic>[_List, "result-type-uses-passed-type-arguments"])
|
||||
@pragma("vm:prefer-inline")
|
||||
factory _List(length) native "List_allocate";
|
||||
@pragma("vm:external-name", "List_allocate")
|
||||
external factory _List(length);
|
||||
|
||||
// Specialization of List.empty constructor for growable == false.
|
||||
// Used by pkg/vm/lib/transformations/list_factory_specializer.dart.
|
||||
|
@ -107,7 +108,8 @@ class _List<E> extends FixedLengthListBase<E> {
|
|||
}
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
E operator [](int index) native "List_getIndexed";
|
||||
@pragma("vm:external-name", "List_getIndexed")
|
||||
external E operator [](int index);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void operator []=(int index, E value) {
|
||||
|
@ -115,12 +117,14 @@ class _List<E> extends FixedLengthListBase<E> {
|
|||
}
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
void _setIndexed(int index, E value) native "List_setIndexed";
|
||||
@pragma("vm:external-name", "List_setIndexed")
|
||||
external void _setIndexed(int index, E value);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get length native "List_getLength";
|
||||
@pragma("vm:external-name", "List_getLength")
|
||||
external int get length;
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
_List _slice(int start, int count, bool needsTypeArgument) {
|
||||
|
@ -135,8 +139,8 @@ class _List<E> extends FixedLengthListBase<E> {
|
|||
}
|
||||
}
|
||||
|
||||
_List _sliceInternal(int start, int count, bool needsTypeArgument)
|
||||
native "List_slice";
|
||||
@pragma("vm:external-name", "List_slice")
|
||||
external _List _sliceInternal(int start, int count, bool needsTypeArgument);
|
||||
|
||||
// List interface.
|
||||
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
|
||||
|
@ -261,16 +265,18 @@ class _ImmutableList<E> extends UnmodifiableListBase<E> {
|
|||
"ImmutableArray can only be allocated by the VM");
|
||||
}
|
||||
|
||||
factory _ImmutableList._from(List from, int offset, int length)
|
||||
native "ImmutableList_from";
|
||||
@pragma("vm:external-name", "ImmutableList_from")
|
||||
external factory _ImmutableList._from(List from, int offset, int length);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
E operator [](int index) native "List_getIndexed";
|
||||
@pragma("vm:external-name", "List_getIndexed")
|
||||
external E operator [](int index);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get length native "List_getLength";
|
||||
@pragma("vm:external-name", "List_getLength")
|
||||
external int get length;
|
||||
|
||||
List<E> sublist(int start, [int? end]) {
|
||||
final int actualEnd = RangeError.checkValidRange(start, end, this.length);
|
||||
|
|
|
@ -13,7 +13,8 @@ class List<E> {
|
|||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
factory List([int? length]) native "List_new";
|
||||
@pragma("vm:external-name", "List_new")
|
||||
external factory List([int? length]);
|
||||
|
||||
@patch
|
||||
factory List.filled(int length, E fill, {bool growable: false}) {
|
||||
|
|
|
@ -15,7 +15,8 @@ import "dart:_internal" show VMLibraryHooks, patch;
|
|||
// part "timer_patch.dart";
|
||||
|
||||
// Equivalent of calling FATAL from C++ code.
|
||||
_fatal(msg) native "DartAsync_fatal";
|
||||
@pragma("vm:external-name", "DartAsync_fatal")
|
||||
external _fatal(msg);
|
||||
|
||||
// We need to pass the value as first argument and leave the second and third
|
||||
// arguments empty (used for error handling).
|
||||
|
@ -244,7 +245,8 @@ class _AsyncStarStreamController<T> {
|
|||
}
|
||||
|
||||
@patch
|
||||
void _rethrow(Object error, StackTrace stackTrace) native "Async_rethrow";
|
||||
@pragma("vm:external-name", "Async_rethrow")
|
||||
external void _rethrow(Object error, StackTrace stackTrace);
|
||||
|
||||
@patch
|
||||
class _StreamImpl<T> {
|
||||
|
@ -275,5 +277,5 @@ void _completeOnAsyncError(
|
|||
}
|
||||
}
|
||||
|
||||
void _moveNextDebuggerStepCheck(Function async_op)
|
||||
native "AsyncStarMoveNext_debuggerStepCheck";
|
||||
@pragma("vm:external-name", "AsyncStarMoveNext_debuggerStepCheck")
|
||||
external void _moveNextDebuggerStepCheck(Function async_op);
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
@pragma("vm:entry-point")
|
||||
class bool {
|
||||
@patch
|
||||
const factory bool.fromEnvironment(String name, {bool defaultValue: false})
|
||||
native "Bool_fromEnvironment";
|
||||
@pragma("vm:external-name", "Bool_fromEnvironment")
|
||||
external const factory bool.fromEnvironment(String name,
|
||||
{bool defaultValue: false});
|
||||
|
||||
@patch
|
||||
const factory bool.hasEnvironment(String name) native "Bool_hasEnvironment";
|
||||
@pragma("vm:external-name", "Bool_hasEnvironment")
|
||||
external const factory bool.hasEnvironment(String name);
|
||||
|
||||
@patch
|
||||
int get hashCode => this ? 1231 : 1237;
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
class ClassID {
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
static int getID(Object? value) native "ClassID_getID";
|
||||
@pragma("vm:external-name", "ClassID_getID")
|
||||
external static int getID(Object? value);
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
static final int cidArray = 0;
|
||||
|
|
|
@ -51,42 +51,52 @@ abstract class _HashVMBase {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:typed_data#_Uint32List")
|
||||
@pragma("vm:prefer-inline")
|
||||
Uint32List get _index native "LinkedHashBase_getIndex";
|
||||
@pragma("vm:external-name", "LinkedHashBase_getIndex")
|
||||
external Uint32List get _index;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
void set _index(Uint32List value) native "LinkedHashBase_setIndex";
|
||||
@pragma("vm:external-name", "LinkedHashBase_setIndex")
|
||||
external void set _index(Uint32List value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get _hashMask native "LinkedHashBase_getHashMask";
|
||||
@pragma("vm:external-name", "LinkedHashBase_getHashMask")
|
||||
external int get _hashMask;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
void set _hashMask(int value) native "LinkedHashBase_setHashMask";
|
||||
@pragma("vm:external-name", "LinkedHashBase_setHashMask")
|
||||
external void set _hashMask(int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_List")
|
||||
@pragma("vm:prefer-inline")
|
||||
List get _data native "LinkedHashBase_getData";
|
||||
@pragma("vm:external-name", "LinkedHashBase_getData")
|
||||
external List get _data;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
void set _data(List value) native "LinkedHashBase_setData";
|
||||
@pragma("vm:external-name", "LinkedHashBase_setData")
|
||||
external void set _data(List value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get _usedData native "LinkedHashBase_getUsedData";
|
||||
@pragma("vm:external-name", "LinkedHashBase_getUsedData")
|
||||
external int get _usedData;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
void set _usedData(int value) native "LinkedHashBase_setUsedData";
|
||||
@pragma("vm:external-name", "LinkedHashBase_setUsedData")
|
||||
external void set _usedData(int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get _deletedKeys native "LinkedHashBase_getDeletedKeys";
|
||||
@pragma("vm:external-name", "LinkedHashBase_getDeletedKeys")
|
||||
external int get _deletedKeys;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
void set _deletedKeys(int value) native "LinkedHashBase_setDeletedKeys";
|
||||
@pragma("vm:external-name", "LinkedHashBase_setDeletedKeys")
|
||||
external void set _deletedKeys(int value);
|
||||
}
|
||||
|
||||
// Base class for VM-internal classes; keep in sync with _HashFieldBase.
|
||||
|
|
|
@ -1574,7 +1574,8 @@ class _JsonUtf8Parser extends _ChunkedJsonParser<List<int>> {
|
|||
}
|
||||
}
|
||||
|
||||
double _parseDouble(String source, int start, int end) native "Double_parse";
|
||||
@pragma("vm:external-name", "Double_parse")
|
||||
external double _parseDouble(String source, int start, int end);
|
||||
|
||||
/**
|
||||
* Implements the chunked conversion from a UTF-8 encoding of JSON
|
||||
|
|
|
@ -231,5 +231,6 @@ class _SyncIterator<T> implements Iterator<T> {
|
|||
@patch
|
||||
class StackTrace {
|
||||
@patch
|
||||
static StackTrace get current native "StackTrace_current";
|
||||
@pragma("vm:external-name", "StackTrace_current")
|
||||
external static StackTrace get current;
|
||||
}
|
||||
|
|
|
@ -9,17 +9,19 @@
|
|||
class DateTime {
|
||||
// Natives.
|
||||
// The natives have been moved up here to work around Issue 10401.
|
||||
static int _getCurrentMicros() native "DateTime_currentTimeMicros";
|
||||
@pragma("vm:external-name", "DateTime_currentTimeMicros")
|
||||
external static int _getCurrentMicros();
|
||||
|
||||
static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch)
|
||||
native "DateTime_timeZoneName";
|
||||
@pragma("vm:external-name", "DateTime_timeZoneName")
|
||||
external static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch);
|
||||
|
||||
static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch)
|
||||
native "DateTime_timeZoneOffsetInSeconds";
|
||||
@pragma("vm:external-name", "DateTime_timeZoneOffsetInSeconds")
|
||||
external static int _timeZoneOffsetInSecondsForClampedSeconds(
|
||||
int secondsSinceEpoch);
|
||||
|
||||
// Daylight-savings independent adjustment for the local time zone.
|
||||
static int _localTimeZoneAdjustmentInSeconds()
|
||||
native "DateTime_localTimeZoneAdjustmentInSeconds";
|
||||
@pragma("vm:external-name", "DateTime_localTimeZoneAdjustmentInSeconds")
|
||||
external static int _localTimeZoneAdjustmentInSeconds();
|
||||
|
||||
static const _MICROSECOND_INDEX = 0;
|
||||
static const _MILLISECOND_INDEX = 1;
|
||||
|
|
|
@ -18,10 +18,12 @@ import "dart:isolate" show SendPort;
|
|||
// part "timeline.dart"
|
||||
|
||||
@patch
|
||||
bool debugger({bool when: true, String? message}) native "Developer_debugger";
|
||||
@pragma("vm:external-name", "Developer_debugger")
|
||||
external bool debugger({bool when: true, String? message});
|
||||
|
||||
@patch
|
||||
Object? inspect(Object? object) native "Developer_inspect";
|
||||
@pragma("vm:external-name", "Developer_inspect")
|
||||
external Object? inspect(Object? object);
|
||||
|
||||
@patch
|
||||
void log(String message,
|
||||
|
@ -50,20 +52,21 @@ void log(String message,
|
|||
|
||||
int _nextSequenceNumber = 0;
|
||||
|
||||
_log(String message, int timestamp, int sequenceNumber, int level, String name,
|
||||
Zone? zone, Object? error, StackTrace? stackTrace) native "Developer_log";
|
||||
@pragma("vm:external-name", "Developer_log")
|
||||
external _log(String message, int timestamp, int sequenceNumber, int level,
|
||||
String name, Zone? zone, Object? error, StackTrace? stackTrace);
|
||||
|
||||
@patch
|
||||
void _postEvent(String eventKind, String eventData)
|
||||
native "Developer_postEvent";
|
||||
@pragma("vm:external-name", "Developer_postEvent")
|
||||
external void _postEvent(String eventKind, String eventData);
|
||||
|
||||
@patch
|
||||
ServiceExtensionHandler? _lookupExtension(String method)
|
||||
native "Developer_lookupExtension";
|
||||
@pragma("vm:external-name", "Developer_lookupExtension")
|
||||
external ServiceExtensionHandler? _lookupExtension(String method);
|
||||
|
||||
@patch
|
||||
_registerExtension(String method, ServiceExtensionHandler handler)
|
||||
native "Developer_registerExtension";
|
||||
@pragma("vm:external-name", "Developer_registerExtension")
|
||||
external _registerExtension(String method, ServiceExtensionHandler handler);
|
||||
|
||||
// This code is only invoked when there is no other Dart code on the stack.
|
||||
@pragma("vm:entry-point", !const bool.fromEnvironment("dart.vm.product"))
|
||||
|
@ -152,18 +155,22 @@ _postResponse(SendPort replyPort, Object id, ServiceExtensionResponse response,
|
|||
}
|
||||
|
||||
@patch
|
||||
int _getServiceMajorVersion() native "Developer_getServiceMajorVersion";
|
||||
@pragma("vm:external-name", "Developer_getServiceMajorVersion")
|
||||
external int _getServiceMajorVersion();
|
||||
|
||||
@patch
|
||||
int _getServiceMinorVersion() native "Developer_getServiceMinorVersion";
|
||||
@pragma("vm:external-name", "Developer_getServiceMinorVersion")
|
||||
external int _getServiceMinorVersion();
|
||||
|
||||
@patch
|
||||
void _getServerInfo(SendPort sendPort) native "Developer_getServerInfo";
|
||||
@pragma("vm:external-name", "Developer_getServerInfo")
|
||||
external void _getServerInfo(SendPort sendPort);
|
||||
|
||||
@patch
|
||||
void _webServerControl(SendPort sendPort, bool enable, bool? silenceOutput)
|
||||
native "Developer_webServerControl";
|
||||
@pragma("vm:external-name", "Developer_webServerControl")
|
||||
external void _webServerControl(
|
||||
SendPort sendPort, bool enable, bool? silenceOutput);
|
||||
|
||||
@patch
|
||||
String _getIsolateIDFromSendPort(SendPort sendPort)
|
||||
native "Developer_getIsolateIDFromSendPort";
|
||||
@pragma("vm:external-name", "Developer_getIsolateIDFromSendPort")
|
||||
external String _getIsolateIDFromSendPort(SendPort sendPort);
|
||||
|
|
|
@ -8,12 +8,15 @@
|
|||
class _Double implements double {
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
factory _Double.fromInteger(int value) native "Double_doubleFromInteger";
|
||||
@pragma("vm:external-name", "Double_doubleFromInteger")
|
||||
external factory _Double.fromInteger(int value);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
int get hashCode native "Double_hashCode";
|
||||
@pragma("vm:external-name", "Double_hashCode")
|
||||
external int get hashCode;
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
int get _identityHashCode native "Double_hashCode";
|
||||
@pragma("vm:external-name", "Double_hashCode")
|
||||
external int get _identityHashCode;
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
|
@ -24,7 +27,8 @@ class _Double implements double {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double _add(double other) native "Double_add";
|
||||
@pragma("vm:external-name", "Double_add")
|
||||
external double _add(double other);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
|
@ -35,7 +39,8 @@ class _Double implements double {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double _sub(double other) native "Double_sub";
|
||||
@pragma("vm:external-name", "Double_sub")
|
||||
external double _sub(double other);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
|
@ -46,7 +51,8 @@ class _Double implements double {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double _mul(double other) native "Double_mul";
|
||||
@pragma("vm:external-name", "Double_mul")
|
||||
external double _mul(double other);
|
||||
|
||||
int operator ~/(num other) {
|
||||
return (this / other.toDouble()).truncate();
|
||||
|
@ -61,7 +67,8 @@ class _Double implements double {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double _div(double other) native "Double_div";
|
||||
@pragma("vm:external-name", "Double_div")
|
||||
external double _div(double other);
|
||||
|
||||
double operator %(num other) {
|
||||
return _modulo(other.toDouble());
|
||||
|
@ -70,17 +77,20 @@ class _Double implements double {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double _modulo(double other) native "Double_modulo";
|
||||
@pragma("vm:external-name", "Double_modulo")
|
||||
external double _modulo(double other);
|
||||
|
||||
double remainder(num other) {
|
||||
return _remainder(other.toDouble());
|
||||
}
|
||||
|
||||
double _remainder(double other) native "Double_remainder";
|
||||
@pragma("vm:external-name", "Double_remainder")
|
||||
external double _remainder(double other);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double operator -() native "Double_flipSignBit";
|
||||
@pragma("vm:external-name", "Double_flipSignBit")
|
||||
external double operator -();
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
|
@ -90,9 +100,11 @@ class _Double implements double {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool _equal(double other) native "Double_equal";
|
||||
@pragma("vm:external-name", "Double_equal")
|
||||
external bool _equal(double other);
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool _equalToInteger(int other) native "Double_equalToInteger";
|
||||
@pragma("vm:external-name", "Double_equalToInteger")
|
||||
external bool _equalToInteger(int other);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
|
@ -109,7 +121,8 @@ class _Double implements double {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool _greaterThan(double other) native "Double_greaterThan";
|
||||
@pragma("vm:external-name", "Double_greaterThan")
|
||||
external bool _greaterThan(double other);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
|
@ -151,18 +164,21 @@ class _Double implements double {
|
|||
return new _Double.fromInteger(other)._remainder(this);
|
||||
}
|
||||
|
||||
bool _greaterThanFromInteger(int other)
|
||||
native "Double_greaterThanFromInteger";
|
||||
@pragma("vm:external-name", "Double_greaterThanFromInteger")
|
||||
external bool _greaterThanFromInteger(int other);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get isNegative native "Double_getIsNegative";
|
||||
@pragma("vm:external-name", "Double_getIsNegative")
|
||||
external bool get isNegative;
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get isInfinite native "Double_getIsInfinite";
|
||||
@pragma("vm:external-name", "Double_getIsInfinite")
|
||||
external bool get isInfinite;
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get isNaN native "Double_getIsNaN";
|
||||
@pragma("vm:external-name", "Double_getIsNaN")
|
||||
external bool get isNaN;
|
||||
bool get isFinite => !isInfinite && !isNaN; // Can be optimized.
|
||||
|
||||
double abs() {
|
||||
|
@ -190,19 +206,23 @@ class _Double implements double {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double roundToDouble() native "Double_round";
|
||||
@pragma("vm:external-name", "Double_round")
|
||||
external double roundToDouble();
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double floorToDouble() native "Double_floor";
|
||||
@pragma("vm:external-name", "Double_floor")
|
||||
external double floorToDouble();
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double ceilToDouble() native "Double_ceil";
|
||||
@pragma("vm:external-name", "Double_ceil")
|
||||
external double ceilToDouble();
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
@pragma("vm:exact-result-type", _Double)
|
||||
double truncateToDouble() native "Double_truncate";
|
||||
@pragma("vm:external-name", "Double_truncate")
|
||||
external double truncateToDouble();
|
||||
|
||||
num clamp(num lowerLimit, num upperLimit) {
|
||||
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
|
||||
|
@ -224,7 +244,8 @@ class _Double implements double {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int toInt() native "Double_toInt";
|
||||
@pragma("vm:external-name", "Double_toInt")
|
||||
external int toInt();
|
||||
|
||||
double toDouble() {
|
||||
return this;
|
||||
|
@ -237,7 +258,8 @@ class _Double implements double {
|
|||
static final List _cache = new List.filled(CACHE_LENGTH, null);
|
||||
static int _cacheEvictIndex = 0;
|
||||
|
||||
String _toString() native "Double_toString";
|
||||
@pragma("vm:external-name", "Double_toString")
|
||||
external String _toString();
|
||||
|
||||
String toString() {
|
||||
// TODO(koda): Consider starting at most recently inserted.
|
||||
|
@ -288,7 +310,8 @@ class _Double implements double {
|
|||
return _toStringAsFixed(fractionDigits);
|
||||
}
|
||||
|
||||
String _toStringAsFixed(int fractionDigits) native "Double_toStringAsFixed";
|
||||
@pragma("vm:external-name", "Double_toStringAsFixed")
|
||||
external String _toStringAsFixed(int fractionDigits);
|
||||
|
||||
String toStringAsExponential([int? fractionDigits]) {
|
||||
// See ECMAScript-262, 15.7.4.6 for details.
|
||||
|
@ -315,8 +338,8 @@ class _Double implements double {
|
|||
return _toStringAsExponential(fractionDigits);
|
||||
}
|
||||
|
||||
String _toStringAsExponential(int fractionDigits)
|
||||
native "Double_toStringAsExponential";
|
||||
@pragma("vm:external-name", "Double_toStringAsExponential")
|
||||
external String _toStringAsExponential(int fractionDigits);
|
||||
|
||||
String toStringAsPrecision(int precision) {
|
||||
// See ECMAScript-262, 15.7.4.7 for details.
|
||||
|
@ -340,8 +363,8 @@ class _Double implements double {
|
|||
return _toStringAsPrecision(precision);
|
||||
}
|
||||
|
||||
String _toStringAsPrecision(int fractionDigits)
|
||||
native "Double_toStringAsPrecision";
|
||||
@pragma("vm:external-name", "Double_toStringAsPrecision")
|
||||
external String _toStringAsPrecision(int fractionDigits);
|
||||
|
||||
// Order is: NaN > Infinity > ... > 0.0 > -0.0 > ... > -Infinity.
|
||||
int compareTo(num other) {
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
@patch
|
||||
class double {
|
||||
static double? _nativeParse(String str, int start, int end)
|
||||
native "Double_parse";
|
||||
@pragma("vm:external-name", "Double_parse")
|
||||
external static double? _nativeParse(String str, int start, int end);
|
||||
|
||||
static double? _tryParseDouble(String str, int start, int end) {
|
||||
assert(start < end);
|
||||
|
|
|
@ -42,10 +42,12 @@ class _AssertionError extends Error implements AssertionError {
|
|||
_doThrowNewSource('$name != null', line, column, null);
|
||||
}
|
||||
|
||||
static _doThrowNew(int assertionStart, int assertionEnd, Object? message)
|
||||
native "AssertionError_throwNew";
|
||||
static _doThrowNewSource(String failedAssertion, int line, int column,
|
||||
Object? message) native "AssertionError_throwNewSource";
|
||||
@pragma("vm:external-name", "AssertionError_throwNew")
|
||||
external static _doThrowNew(
|
||||
int assertionStart, int assertionEnd, Object? message);
|
||||
@pragma("vm:external-name", "AssertionError_throwNewSource")
|
||||
external static _doThrowNewSource(
|
||||
String failedAssertion, int line, int column, Object? message);
|
||||
|
||||
@pragma("vm:entry-point", "call")
|
||||
static _evaluateAssertion(condition) {
|
||||
|
@ -94,8 +96,9 @@ class _TypeError extends Error implements TypeError, CastError {
|
|||
_TypeError._create(this._url, this._line, this._column, this._message);
|
||||
|
||||
@pragma("vm:entry-point", "call")
|
||||
static _throwNew(int location, Object srcValue, _Type dstType, String dstName)
|
||||
native "TypeError_throwNew";
|
||||
@pragma("vm:external-name", "TypeError_throwNew")
|
||||
external static _throwNew(
|
||||
int location, Object srcValue, _Type dstType, String dstName);
|
||||
|
||||
String toString() => _message;
|
||||
|
||||
|
@ -127,7 +130,8 @@ class FallThroughError {
|
|||
@pragma("vm:entry-point")
|
||||
FallThroughError._create(this._url, this._line);
|
||||
|
||||
static _throwNew(int caseClausePos) native "FallThroughError_throwNew";
|
||||
@pragma("vm:external-name", "FallThroughError_throwNew")
|
||||
external static _throwNew(int caseClausePos);
|
||||
|
||||
@patch
|
||||
String toString() {
|
||||
|
@ -168,8 +172,8 @@ class AbstractClassInstantiationError {
|
|||
AbstractClassInstantiationError._create(
|
||||
this._className, this._url, this._line);
|
||||
|
||||
static _throwNew(int caseClausePos, String className)
|
||||
native "AbstractClassInstantiationError_throwNew";
|
||||
@pragma("vm:external-name", "AbstractClassInstantiationError_throwNew")
|
||||
external static _throwNew(int caseClausePos, String className);
|
||||
|
||||
@patch
|
||||
String toString() {
|
||||
|
@ -264,8 +268,9 @@ class NoSuchMethodError {
|
|||
? _NamedArgumentsMap(arguments!, argumentNames)
|
||||
: null);
|
||||
|
||||
static String? _existingMethodSignature(Object? receiver, String methodName,
|
||||
int invocationType) native "NoSuchMethodError_existingMethodSignature";
|
||||
@pragma("vm:external-name", "NoSuchMethodError_existingMethodSignature")
|
||||
external static String? _existingMethodSignature(
|
||||
Object? receiver, String methodName, int invocationType);
|
||||
|
||||
@patch
|
||||
String toString() {
|
||||
|
@ -445,7 +450,9 @@ class NoSuchMethodError {
|
|||
if (invocation.typeArguments.isNotEmpty) {
|
||||
buffer.write("<");
|
||||
for (var type in invocation.typeArguments) {
|
||||
buffer..write(separator)..write("_");
|
||||
buffer
|
||||
..write(separator)
|
||||
..write("_");
|
||||
separator = ", ";
|
||||
}
|
||||
buffer.write(">");
|
||||
|
@ -453,14 +460,21 @@ class NoSuchMethodError {
|
|||
}
|
||||
buffer.write("(");
|
||||
for (var argument in invocation.positionalArguments) {
|
||||
buffer..write(separator)..write("_");
|
||||
buffer
|
||||
..write(separator)
|
||||
..write("_");
|
||||
separator = ", ";
|
||||
}
|
||||
if (invocation.namedArguments.isNotEmpty) {
|
||||
buffer..write(separator)..write("{");
|
||||
buffer
|
||||
..write(separator)
|
||||
..write("{");
|
||||
separator = "";
|
||||
for (var name in invocation.namedArguments.keys) {
|
||||
buffer..write(separator)..write(_symbolToString(name))..write(": _");
|
||||
buffer
|
||||
..write(separator)
|
||||
..write(_symbolToString(name))
|
||||
..write(": _");
|
||||
separator = ",";
|
||||
}
|
||||
buffer.write("}");
|
||||
|
|
|
@ -8,9 +8,12 @@ import "dart:_internal" show patch;
|
|||
import 'dart:typed_data';
|
||||
import 'dart:isolate';
|
||||
|
||||
DynamicLibrary _open(String path) native "Ffi_dl_open";
|
||||
DynamicLibrary _processLibrary() native "Ffi_dl_processLibrary";
|
||||
DynamicLibrary _executableLibrary() native "Ffi_dl_executableLibrary";
|
||||
@pragma("vm:external-name", "Ffi_dl_open")
|
||||
external DynamicLibrary _open(String path);
|
||||
@pragma("vm:external-name", "Ffi_dl_processLibrary")
|
||||
external DynamicLibrary _processLibrary();
|
||||
@pragma("vm:external-name", "Ffi_dl_executableLibrary")
|
||||
external DynamicLibrary _executableLibrary();
|
||||
|
||||
@patch
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -27,15 +30,17 @@ class DynamicLibrary {
|
|||
factory DynamicLibrary.executable() => _executableLibrary();
|
||||
|
||||
@patch
|
||||
Pointer<T> lookup<T extends NativeType>(String symbolName)
|
||||
native "Ffi_dl_lookup";
|
||||
@pragma("vm:external-name", "Ffi_dl_lookup")
|
||||
external Pointer<T> lookup<T extends NativeType>(String symbolName);
|
||||
|
||||
@patch
|
||||
bool providesSymbol(String symbolName) native "Ffi_dl_providesSymbol";
|
||||
@pragma("vm:external-name", "Ffi_dl_providesSymbol")
|
||||
external bool providesSymbol(String symbolName);
|
||||
|
||||
// TODO(dacoharkes): Expose this to users, or extend Pointer?
|
||||
// https://github.com/dart-lang/sdk/issues/35881
|
||||
int getHandle() native "Ffi_dl_getHandle";
|
||||
@pragma("vm:external-name", "Ffi_dl_getHandle")
|
||||
external int getHandle();
|
||||
|
||||
@patch
|
||||
bool operator ==(Object other) {
|
||||
|
|
|
@ -31,18 +31,19 @@ int sizeOf<T extends NativeType>() {
|
|||
}
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
Pointer<T> _fromAddress<T extends NativeType>(int ptr) native "Ffi_fromAddress";
|
||||
@pragma("vm:external-name", "Ffi_fromAddress")
|
||||
external Pointer<T> _fromAddress<T extends NativeType>(int ptr);
|
||||
|
||||
// The real implementation of this function (for interface calls) lives in
|
||||
// BuildFfiAsFunctionCall in the Kernel frontend. No calls can actually reach
|
||||
// this function.
|
||||
@pragma("vm:recognized", "other")
|
||||
DS _asFunctionInternal<DS extends Function, NS extends Function>(
|
||||
Pointer<NativeFunction<NS>> ptr,
|
||||
bool isLeaf) native "Ffi_asFunctionInternal";
|
||||
@pragma("vm:external-name", "Ffi_asFunctionInternal")
|
||||
external DS _asFunctionInternal<DS extends Function, NS extends Function>(
|
||||
Pointer<NativeFunction<NS>> ptr, bool isLeaf);
|
||||
|
||||
dynamic _asExternalTypedData(Pointer ptr, int count)
|
||||
native "Ffi_asExternalTypedData";
|
||||
@pragma("vm:external-name", "Ffi_asExternalTypedData")
|
||||
external dynamic _asExternalTypedData(Pointer ptr, int count);
|
||||
|
||||
// Returns a Function object for a native callback.
|
||||
//
|
||||
|
@ -61,11 +62,13 @@ dynamic _asExternalTypedData(Pointer ptr, int count)
|
|||
// Function objects returned by this native method are not Dart instances,
|
||||
// so we need to use top type as a return type to avoid type check.
|
||||
@pragma("vm:recognized", "other")
|
||||
dynamic _nativeCallbackFunction<NS extends Function>(Function target,
|
||||
Object? exceptionalReturn) native "Ffi_nativeCallbackFunction";
|
||||
@pragma("vm:external-name", "Ffi_nativeCallbackFunction")
|
||||
external dynamic _nativeCallbackFunction<NS extends Function>(
|
||||
Function target, Object? exceptionalReturn);
|
||||
|
||||
Pointer<NS> _pointerFromFunction<NS extends NativeFunction>(dynamic function)
|
||||
native "Ffi_pointerFromFunction";
|
||||
@pragma("vm:external-name", "Ffi_pointerFromFunction")
|
||||
external Pointer<NS> _pointerFromFunction<NS extends NativeFunction>(
|
||||
dynamic function);
|
||||
|
||||
@patch
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -88,7 +91,8 @@ class Pointer<T extends NativeType> {
|
|||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
int get address native "Ffi_address";
|
||||
@pragma("vm:external-name", "Ffi_address")
|
||||
external int get address;
|
||||
|
||||
// For statically known types, this is rewritten.
|
||||
@patch
|
||||
|
@ -139,8 +143,9 @@ class Array<T extends NativeType> {
|
|||
/// calculations. See pkg/vm/lib/transformations/ffi.dart.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma('vm:prefer-inline')
|
||||
int _abi()
|
||||
native "Recognized method: IR graph is built in the flow graph builder.";
|
||||
@pragma("vm:external-name",
|
||||
"Recognized method: IR graph is built in the flow graph builder.")
|
||||
external int _abi();
|
||||
|
||||
/// Copies data byte-wise from [source] to [target].
|
||||
///
|
||||
|
@ -191,111 +196,122 @@ void _memCopy(Object target, int targetOffsetInBytes, Object source,
|
|||
// and GCing new spaces takes a lot of the benchmark time. The next speedup is
|
||||
// getting rid of these allocations by inlining these functions.
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadInt8(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt8";
|
||||
@pragma("vm:external-name", "Ffi_loadInt8")
|
||||
external int _loadInt8(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadInt16(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt16";
|
||||
@pragma("vm:external-name", "Ffi_loadInt16")
|
||||
external int _loadInt16(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadInt32(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt32";
|
||||
@pragma("vm:external-name", "Ffi_loadInt32")
|
||||
external int _loadInt32(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadInt64(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt64";
|
||||
@pragma("vm:external-name", "Ffi_loadInt64")
|
||||
external int _loadInt64(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadUint8(Object typedDataBase, int offsetInBytes) native "Ffi_loadUint8";
|
||||
@pragma("vm:external-name", "Ffi_loadUint8")
|
||||
external int _loadUint8(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadUint16(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadUint16";
|
||||
@pragma("vm:external-name", "Ffi_loadUint16")
|
||||
external int _loadUint16(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadUint32(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadUint32";
|
||||
@pragma("vm:external-name", "Ffi_loadUint32")
|
||||
external int _loadUint32(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadUint64(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadUint64";
|
||||
@pragma("vm:external-name", "Ffi_loadUint64")
|
||||
external int _loadUint64(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _loadIntPtr(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadIntPtr";
|
||||
@pragma("vm:external-name", "Ffi_loadIntPtr")
|
||||
external int _loadIntPtr(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
double _loadFloat(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadFloat";
|
||||
@pragma("vm:external-name", "Ffi_loadFloat")
|
||||
external double _loadFloat(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
double _loadDouble(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadDouble";
|
||||
@pragma("vm:external-name", "Ffi_loadDouble")
|
||||
external double _loadDouble(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
double _loadFloatUnaligned(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadFloatUnaligned";
|
||||
@pragma("vm:external-name", "Ffi_loadFloatUnaligned")
|
||||
external double _loadFloatUnaligned(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
double _loadDoubleUnaligned(Object typedDataBase, int offsetInBytes)
|
||||
native "Ffi_loadDoubleUnaligned";
|
||||
@pragma("vm:external-name", "Ffi_loadDoubleUnaligned")
|
||||
external double _loadDoubleUnaligned(Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
Pointer<S> _loadPointer<S extends NativeType>(
|
||||
Object typedDataBase, int offsetInBytes) native "Ffi_loadPointer";
|
||||
@pragma("vm:external-name", "Ffi_loadPointer")
|
||||
external Pointer<S> _loadPointer<S extends NativeType>(
|
||||
Object typedDataBase, int offsetInBytes);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeInt8(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeInt8";
|
||||
@pragma("vm:external-name", "Ffi_storeInt8")
|
||||
external void _storeInt8(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeInt16(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeInt16";
|
||||
@pragma("vm:external-name", "Ffi_storeInt16")
|
||||
external void _storeInt16(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeInt32(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeInt32";
|
||||
@pragma("vm:external-name", "Ffi_storeInt32")
|
||||
external void _storeInt32(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeInt64(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeInt64";
|
||||
@pragma("vm:external-name", "Ffi_storeInt64")
|
||||
external void _storeInt64(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeUint8(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeUint8";
|
||||
@pragma("vm:external-name", "Ffi_storeUint8")
|
||||
external void _storeUint8(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeUint16(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeUint16";
|
||||
@pragma("vm:external-name", "Ffi_storeUint16")
|
||||
external void _storeUint16(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeUint32(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeUint32";
|
||||
@pragma("vm:external-name", "Ffi_storeUint32")
|
||||
external void _storeUint32(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeUint64(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeUint64";
|
||||
@pragma("vm:external-name", "Ffi_storeUint64")
|
||||
external void _storeUint64(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeIntPtr(Object typedDataBase, int offsetInBytes, int value)
|
||||
native "Ffi_storeIntPtr";
|
||||
@pragma("vm:external-name", "Ffi_storeIntPtr")
|
||||
external void _storeIntPtr(Object typedDataBase, int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeFloat(Object typedDataBase, int offsetInBytes, double value)
|
||||
native "Ffi_storeFloat";
|
||||
@pragma("vm:external-name", "Ffi_storeFloat")
|
||||
external void _storeFloat(
|
||||
Object typedDataBase, int offsetInBytes, double value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeDouble(Object typedDataBase, int offsetInBytes, double value)
|
||||
native "Ffi_storeDouble";
|
||||
@pragma("vm:external-name", "Ffi_storeDouble")
|
||||
external void _storeDouble(
|
||||
Object typedDataBase, int offsetInBytes, double value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeFloatUnaligned(Object typedDataBase, int offsetInBytes, double value)
|
||||
native "Ffi_storeFloatUnaligned";
|
||||
@pragma("vm:external-name", "Ffi_storeFloatUnaligned")
|
||||
external void _storeFloatUnaligned(
|
||||
Object typedDataBase, int offsetInBytes, double value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storeDoubleUnaligned(Object typedDataBase, int offsetInBytes,
|
||||
double value) native "Ffi_storeDoubleUnaligned";
|
||||
@pragma("vm:external-name", "Ffi_storeDoubleUnaligned")
|
||||
external void _storeDoubleUnaligned(
|
||||
Object typedDataBase, int offsetInBytes, double value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void _storePointer<S extends NativeType>(Object typedDataBase,
|
||||
int offsetInBytes, Pointer<S> value) native "Ffi_storePointer";
|
||||
@pragma("vm:external-name", "Ffi_storePointer")
|
||||
external void _storePointer<S extends NativeType>(
|
||||
Object typedDataBase, int offsetInBytes, Pointer<S> value);
|
||||
|
||||
Pointer<Int8> _elementAtInt8(Pointer<Int8> pointer, int index) =>
|
||||
Pointer.fromAddress(pointer.address + 1 * index);
|
||||
|
@ -762,17 +778,21 @@ extension UnionArray<T extends Union> on Array<T> {
|
|||
|
||||
extension NativePort on SendPort {
|
||||
@patch
|
||||
int get nativePort native "SendPortImpl_get_id";
|
||||
@pragma("vm:external-name", "SendPortImpl_get_id")
|
||||
external int get nativePort;
|
||||
}
|
||||
|
||||
int _nativeApiFunctionPointer(String symbol)
|
||||
native "DartNativeApiFunctionPointer";
|
||||
@pragma("vm:external-name", "DartNativeApiFunctionPointer")
|
||||
external int _nativeApiFunctionPointer(String symbol);
|
||||
|
||||
int _initializeApiDLData() native "DartApiDLInitializeData";
|
||||
@pragma("vm:external-name", "DartApiDLInitializeData")
|
||||
external int _initializeApiDLData();
|
||||
|
||||
int _dartApiMajorVersion() native "DartApiDLMajorVersion";
|
||||
@pragma("vm:external-name", "DartApiDLMajorVersion")
|
||||
external int _dartApiMajorVersion();
|
||||
|
||||
int _dartApiMinorVersion() native "DartApiDLMinorVersion";
|
||||
@pragma("vm:external-name", "DartApiDLMinorVersion")
|
||||
external int _dartApiMinorVersion();
|
||||
|
||||
@patch
|
||||
abstract class NativeApi {
|
||||
|
|
|
@ -10,7 +10,8 @@ class _Closure implements Function {
|
|||
throw "Unreachable";
|
||||
}
|
||||
|
||||
bool operator ==(Object other) native "Closure_equals";
|
||||
@pragma("vm:external-name", "Closure_equals")
|
||||
external bool operator ==(Object other);
|
||||
|
||||
int get hashCode {
|
||||
_hash ??= _computeHash();
|
||||
|
@ -19,7 +20,8 @@ class _Closure implements Function {
|
|||
|
||||
_Closure get call => this;
|
||||
|
||||
int _computeHash() native "Closure_computeHash";
|
||||
@pragma("vm:external-name", "Closure_computeHash")
|
||||
external int _computeHash();
|
||||
|
||||
// No instance fields should be declared before the following fields whose
|
||||
// offsets must be identical in Dart and C++.
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
@patch
|
||||
class Function {
|
||||
// TODO(regis): Pass type arguments to generic functions. Wait for API spec.
|
||||
static _apply(List<dynamic>? arguments, List<dynamic>? names)
|
||||
native "Function_apply";
|
||||
@pragma("vm:external-name", "Function_apply")
|
||||
external static _apply(List<dynamic>? arguments, List<dynamic>? names);
|
||||
|
||||
@patch
|
||||
static apply(Function function, List<dynamic>? positionalArguments,
|
||||
|
|
|
@ -204,17 +204,20 @@ class _GrowableList<T> extends ListBase<T> {
|
|||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type",
|
||||
<dynamic>[_GrowableList, "result-type-uses-passed-type-arguments"])
|
||||
factory _GrowableList._withData(_List data) native "GrowableList_allocate";
|
||||
@pragma("vm:external-name", "GrowableList_allocate")
|
||||
external factory _GrowableList._withData(_List data);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get _capacity native "GrowableList_getCapacity";
|
||||
@pragma("vm:external-name", "GrowableList_getCapacity")
|
||||
external int get _capacity;
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get length native "GrowableList_getLength";
|
||||
@pragma("vm:external-name", "GrowableList_getLength")
|
||||
external int get length;
|
||||
|
||||
void set length(int new_length) {
|
||||
if (new_length > length) {
|
||||
|
@ -245,13 +248,16 @@ class _GrowableList<T> extends ListBase<T> {
|
|||
}
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
void _setLength(int new_length) native "GrowableList_setLength";
|
||||
@pragma("vm:external-name", "GrowableList_setLength")
|
||||
external void _setLength(int new_length);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
void _setData(_List array) native "GrowableList_setData";
|
||||
@pragma("vm:external-name", "GrowableList_setData")
|
||||
external void _setData(_List array);
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
T operator [](int index) native "GrowableList_getIndexed";
|
||||
@pragma("vm:external-name", "GrowableList_getIndexed")
|
||||
external T operator [](int index);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
void operator []=(int index, T value) {
|
||||
|
@ -259,7 +265,8 @@ class _GrowableList<T> extends ListBase<T> {
|
|||
}
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
void _setIndexed(int index, T? value) native "GrowableList_setIndexed";
|
||||
@pragma("vm:external-name", "GrowableList_setIndexed")
|
||||
external void _setIndexed(int index, T? value);
|
||||
|
||||
@pragma("vm:entry-point", "call")
|
||||
@pragma("vm:prefer-inline")
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool identical(Object? a, Object? b) native "Identical_comparison";
|
||||
@pragma("vm:external-name", "Identical_comparison")
|
||||
external bool identical(Object? a, Object? b);
|
||||
|
||||
@patch
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
|
|
@ -78,27 +78,38 @@ abstract class _IntegerImplementation implements int {
|
|||
}
|
||||
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _bitAndFromInteger(int other) native "Integer_bitAndFromInteger";
|
||||
@pragma("vm:external-name", "Integer_bitAndFromInteger")
|
||||
external int _bitAndFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _bitOrFromInteger(int other) native "Integer_bitOrFromInteger";
|
||||
@pragma("vm:external-name", "Integer_bitOrFromInteger")
|
||||
external int _bitOrFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _bitXorFromInteger(int other) native "Integer_bitXorFromInteger";
|
||||
@pragma("vm:external-name", "Integer_bitXorFromInteger")
|
||||
external int _bitXorFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _shrFromInteger(int other) native "Integer_shrFromInteger";
|
||||
@pragma("vm:external-name", "Integer_shrFromInteger")
|
||||
external int _shrFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _ushrFromInteger(int other) native "Integer_ushrFromInteger";
|
||||
@pragma("vm:external-name", "Integer_ushrFromInteger")
|
||||
external int _ushrFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _shlFromInteger(int other) native "Integer_shlFromInteger";
|
||||
@pragma("vm:external-name", "Integer_shlFromInteger")
|
||||
external int _shlFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _addFromInteger(int other) native "Integer_addFromInteger";
|
||||
@pragma("vm:external-name", "Integer_addFromInteger")
|
||||
external int _addFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _subFromInteger(int other) native "Integer_subFromInteger";
|
||||
@pragma("vm:external-name", "Integer_subFromInteger")
|
||||
external int _subFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _mulFromInteger(int other) native "Integer_mulFromInteger";
|
||||
@pragma("vm:external-name", "Integer_mulFromInteger")
|
||||
external int _mulFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _truncDivFromInteger(int other) native "Integer_truncDivFromInteger";
|
||||
@pragma("vm:external-name", "Integer_truncDivFromInteger")
|
||||
external int _truncDivFromInteger(int other);
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int _moduloFromInteger(int other) native "Integer_moduloFromInteger";
|
||||
@pragma("vm:external-name", "Integer_moduloFromInteger")
|
||||
external int _moduloFromInteger(int other);
|
||||
int _remainderFromInteger(int other) {
|
||||
// Issue(https://dartbug.com/39639): The analyzer incorrectly reports the
|
||||
// result type as `num`.
|
||||
|
@ -150,8 +161,8 @@ abstract class _IntegerImplementation implements int {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool _greaterThanFromInteger(int other)
|
||||
native "Integer_greaterThanFromInteger";
|
||||
@pragma("vm:external-name", "Integer_greaterThanFromInteger")
|
||||
external bool _greaterThanFromInteger(int other);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
|
@ -165,7 +176,8 @@ abstract class _IntegerImplementation implements int {
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool _equalToInteger(int other) native "Integer_equalToInteger";
|
||||
@pragma("vm:external-name", "Integer_equalToInteger")
|
||||
external bool _equalToInteger(int other);
|
||||
int abs() {
|
||||
return this < 0 ? -this : this;
|
||||
}
|
||||
|
@ -550,10 +562,12 @@ class _Smi extends _IntegerImplementation {
|
|||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:disable-unboxed-parameters")
|
||||
int operator ~() native "Smi_bitNegate";
|
||||
@pragma("vm:external-name", "Smi_bitNegate")
|
||||
external int operator ~();
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get bitLength native "Smi_bitLength";
|
||||
@pragma("vm:external-name", "Smi_bitLength")
|
||||
external int get bitLength;
|
||||
|
||||
/**
|
||||
* The digits of '00', '01', ... '99' as a single array.
|
||||
|
@ -757,7 +771,9 @@ class _Mint extends _IntegerImplementation {
|
|||
int get hashCode => this;
|
||||
int get _identityHashCode => this;
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
int operator ~() native "Mint_bitNegate";
|
||||
@pragma("vm:external-name", "Mint_bitNegate")
|
||||
external int operator ~();
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get bitLength native "Mint_bitLength";
|
||||
@pragma("vm:external-name", "Mint_bitLength")
|
||||
external int get bitLength;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
@patch
|
||||
class int {
|
||||
@patch
|
||||
const factory int.fromEnvironment(String name, {int defaultValue = 0})
|
||||
native "Integer_fromEnvironment";
|
||||
@pragma("vm:external-name", "Integer_fromEnvironment")
|
||||
external const factory int.fromEnvironment(String name,
|
||||
{int defaultValue = 0});
|
||||
|
||||
int _bitAndFromSmi(_Smi other);
|
||||
int _bitAndFromInteger(int other);
|
||||
|
|
|
@ -24,26 +24,26 @@ import "dart:typed_data" show Int32List, Uint8List;
|
|||
bool typeAcceptsNull<T>() => (const <Null>[]) is List<int> || null is T;
|
||||
|
||||
@patch
|
||||
List<T> makeListFixedLength<T>(List<T> growableList)
|
||||
native "Internal_makeListFixedLength";
|
||||
@pragma("vm:external-name", "Internal_makeListFixedLength")
|
||||
external List<T> makeListFixedLength<T>(List<T> growableList);
|
||||
|
||||
@patch
|
||||
List<T> makeFixedListUnmodifiable<T>(List<T> fixedLengthList)
|
||||
native "Internal_makeFixedListUnmodifiable";
|
||||
@pragma("vm:external-name", "Internal_makeFixedListUnmodifiable")
|
||||
external List<T> makeFixedListUnmodifiable<T>(List<T> fixedLengthList);
|
||||
|
||||
@patch
|
||||
Object? extractTypeArguments<T>(T instance, Function extract)
|
||||
native "Internal_extractTypeArguments";
|
||||
@pragma("vm:external-name", "Internal_extractTypeArguments")
|
||||
external Object? extractTypeArguments<T>(T instance, Function extract);
|
||||
|
||||
/// The returned string is a [_OneByteString] with uninitialized content.
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
String allocateOneByteString(int length)
|
||||
native "Internal_allocateOneByteString";
|
||||
@pragma("vm:external-name", "Internal_allocateOneByteString")
|
||||
external String allocateOneByteString(int length);
|
||||
|
||||
/// The [string] must be a [_OneByteString]. The [index] must be valid.
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
void writeIntoOneByteString(String string, int index, int codePoint)
|
||||
native "Internal_writeIntoOneByteString";
|
||||
@pragma("vm:external-name", "Internal_writeIntoOneByteString")
|
||||
external void writeIntoOneByteString(String string, int index, int codePoint);
|
||||
|
||||
/// It is assumed that [from] is a native [Uint8List] class and [to] is a
|
||||
/// [_OneByteString]. The [fromStart] and [toStart] indices together with the
|
||||
|
@ -59,13 +59,13 @@ void copyRangeFromUint8ListToOneByteString(
|
|||
|
||||
/// The returned string is a [_TwoByteString] with uninitialized content.
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
String allocateTwoByteString(int length)
|
||||
native "Internal_allocateTwoByteString";
|
||||
@pragma("vm:external-name", "Internal_allocateTwoByteString")
|
||||
external String allocateTwoByteString(int length);
|
||||
|
||||
/// The [string] must be a [_TwoByteString]. The [index] must be valid.
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
void writeIntoTwoByteString(String string, int index, int codePoint)
|
||||
native "Internal_writeIntoTwoByteString";
|
||||
@pragma("vm:external-name", "Internal_writeIntoTwoByteString")
|
||||
external void writeIntoTwoByteString(String string, int index, int codePoint);
|
||||
|
||||
class VMLibraryHooks {
|
||||
// Example: "dart:isolate _Timer._factory"
|
||||
|
@ -104,7 +104,8 @@ class VMLibraryHooks {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma('vm:prefer-inline')
|
||||
bool get has63BitSmis native "Internal_has63BitSmis";
|
||||
@pragma("vm:external-name", "Internal_has63BitSmis")
|
||||
external bool get has63BitSmis;
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
@ -137,14 +138,15 @@ class Lists {
|
|||
// vectors are null or is a newly allocated and canonicalized vector of length
|
||||
// 'totalLen'.
|
||||
@pragma("vm:entry-point", "call")
|
||||
_prependTypeArguments(functionTypeArguments, parentTypeArguments, parentLen,
|
||||
totalLen) native "Internal_prependTypeArguments";
|
||||
@pragma("vm:external-name", "Internal_prependTypeArguments")
|
||||
external _prependTypeArguments(
|
||||
functionTypeArguments, parentTypeArguments, parentLen, totalLen);
|
||||
|
||||
// Check that a set of type arguments satisfy the type parameter bounds on a
|
||||
// closure.
|
||||
@pragma("vm:entry-point", "call")
|
||||
_boundsCheckForPartialInstantiation(closure, typeArgs)
|
||||
native "Internal_boundsCheckForPartialInstantiation";
|
||||
@pragma("vm:external-name", "Internal_boundsCheckForPartialInstantiation")
|
||||
external _boundsCheckForPartialInstantiation(closure, typeArgs);
|
||||
|
||||
// Called by IRRegExpMacroAssembler::GrowStack.
|
||||
Int32List _growRegExpStack(Int32List stack) {
|
||||
|
@ -160,29 +162,33 @@ Int32List _growRegExpStack(Int32List stack) {
|
|||
// type of a value.
|
||||
//
|
||||
// Important: this is unsafe and must be used with care.
|
||||
T unsafeCast<T>(Object? v) native "Internal_unsafeCast";
|
||||
@pragma("vm:external-name", "Internal_unsafeCast")
|
||||
external T unsafeCast<T>(Object? v);
|
||||
|
||||
// This function can be used to keep an object alive til that point.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma('vm:prefer-inline')
|
||||
void reachabilityFence(Object object) native "Internal_reachabilityFence";
|
||||
@pragma("vm:external-name", "Internal_reachabilityFence")
|
||||
external void reachabilityFence(Object object);
|
||||
|
||||
// This function can be used to encode native side effects.
|
||||
//
|
||||
// The function call and it's argument are removed in flow graph construction.
|
||||
@pragma("vm:recognized", "other")
|
||||
void _nativeEffect(Object object) native "Internal_nativeEffect";
|
||||
@pragma("vm:external-name", "Internal_nativeEffect")
|
||||
external void _nativeEffect(Object object);
|
||||
|
||||
void sendAndExit(SendPort sendPort, var message)
|
||||
native "SendPortImpl_sendAndExitInternal_";
|
||||
@pragma("vm:external-name", "SendPortImpl_sendAndExitInternal_")
|
||||
external void sendAndExit(SendPort sendPort, var message);
|
||||
|
||||
// Collection of functions which should only be used for testing purposes.
|
||||
abstract class VMInternalsForTesting {
|
||||
// This function can be used by tests to enforce garbage collection.
|
||||
static void collectAllGarbage() native "Internal_collectAllGarbage";
|
||||
@pragma("vm:external-name", "Internal_collectAllGarbage")
|
||||
external static void collectAllGarbage();
|
||||
|
||||
static void deoptimizeFunctionsOnStack()
|
||||
native "Internal_deoptimizeFunctionsOnStack";
|
||||
@pragma("vm:external-name", "Internal_deoptimizeFunctionsOnStack")
|
||||
external static void deoptimizeFunctionsOnStack();
|
||||
}
|
||||
|
||||
@patch
|
||||
|
|
|
@ -105,8 +105,9 @@ class _InvocationMirror implements Invocation {
|
|||
}
|
||||
|
||||
// Unpack the given TypeArguments object into a new list of individual types.
|
||||
static List<Type> _unpackTypeArguments(typeArguments, int numTypeArguments)
|
||||
native "InvocationMirror_unpackTypeArguments";
|
||||
@pragma("vm:external-name", "InvocationMirror_unpackTypeArguments")
|
||||
external static List<Type> _unpackTypeArguments(
|
||||
typeArguments, int numTypeArguments);
|
||||
|
||||
List get positionalArguments {
|
||||
if (_positionalArguments == null) {
|
||||
|
|
|
@ -38,9 +38,10 @@ class Capability {
|
|||
|
||||
@pragma("vm:entry-point")
|
||||
class _CapabilityImpl implements Capability {
|
||||
factory _CapabilityImpl() native "CapabilityImpl_factory";
|
||||
@pragma("vm:external-name", "CapabilityImpl_factory")
|
||||
external factory _CapabilityImpl();
|
||||
|
||||
bool operator ==(var other) {
|
||||
bool operator ==(Object other) {
|
||||
return (other is _CapabilityImpl) && _equals(other);
|
||||
}
|
||||
|
||||
|
@ -48,8 +49,10 @@ class _CapabilityImpl implements Capability {
|
|||
return _get_hashcode();
|
||||
}
|
||||
|
||||
_equals(other) native "CapabilityImpl_equals";
|
||||
_get_hashcode() native "CapabilityImpl_get_hashcode";
|
||||
@pragma("vm:external-name", "CapabilityImpl_equals")
|
||||
external bool _equals(Object other);
|
||||
@pragma("vm:external-name", "CapabilityImpl_get_hashcode")
|
||||
external int _get_hashcode();
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -137,8 +140,8 @@ class _RawReceivePortImpl implements RawReceivePort {
|
|||
return port;
|
||||
}
|
||||
|
||||
factory _RawReceivePortImpl._(String debugName)
|
||||
native "RawReceivePortImpl_factory";
|
||||
@pragma("vm:external-name", "RawReceivePortImpl_factory")
|
||||
external factory _RawReceivePortImpl._(String debugName);
|
||||
|
||||
close() {
|
||||
// Close the port and remove it from the handler map.
|
||||
|
@ -159,8 +162,10 @@ class _RawReceivePortImpl implements RawReceivePort {
|
|||
}
|
||||
|
||||
/**** Internal implementation details ****/
|
||||
int _get_id() native "RawReceivePortImpl_get_id";
|
||||
SendPort _get_sendport() native "RawReceivePortImpl_get_sendport";
|
||||
@pragma("vm:external-name", "RawReceivePortImpl_get_id")
|
||||
external int _get_id();
|
||||
@pragma("vm:external-name", "RawReceivePortImpl_get_sendport")
|
||||
external SendPort _get_sendport();
|
||||
|
||||
// Called from the VM to retrieve the handler for a message.
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
@ -190,13 +195,15 @@ class _RawReceivePortImpl implements RawReceivePort {
|
|||
}
|
||||
|
||||
// Call into the VM to close the VM maintained mappings.
|
||||
int _closeInternal() native "RawReceivePortImpl_closeInternal";
|
||||
@pragma("vm:external-name", "RawReceivePortImpl_closeInternal")
|
||||
external int _closeInternal();
|
||||
|
||||
// Set this port as active or inactive in the VM. If inactive, this port
|
||||
// will not be considered live even if it hasn't been explicitly closed.
|
||||
// TODO(bkonyi): determine if we want to expose this as an option through
|
||||
// RawReceivePort.
|
||||
_setActive(bool active) native "RawReceivePortImpl_setActive";
|
||||
@pragma("vm:external-name", "RawReceivePortImpl_setActive")
|
||||
external _setActive(bool active);
|
||||
|
||||
void set handler(Function? value) {
|
||||
final int id = this._get_id();
|
||||
|
@ -232,11 +239,14 @@ class _SendPortImpl implements SendPort {
|
|||
}
|
||||
|
||||
/*--- private implementation ---*/
|
||||
_get_id() native "SendPortImpl_get_id";
|
||||
_get_hashcode() native "SendPortImpl_get_hashcode";
|
||||
@pragma("vm:external-name", "SendPortImpl_get_id")
|
||||
external _get_id();
|
||||
@pragma("vm:external-name", "SendPortImpl_get_hashcode")
|
||||
external _get_hashcode();
|
||||
|
||||
// Forward the implementation of sending messages to the VM.
|
||||
void _sendInternal(var message) native "SendPortImpl_sendInternal_";
|
||||
@pragma("vm:external-name", "SendPortImpl_sendInternal_")
|
||||
external void _sendInternal(var message);
|
||||
}
|
||||
|
||||
typedef _NullaryFunction();
|
||||
|
@ -371,7 +381,8 @@ class Isolate {
|
|||
}
|
||||
}
|
||||
|
||||
static void _spawnFunction(
|
||||
@pragma("vm:external-name", "Isolate_spawnFunction")
|
||||
external static void _spawnFunction(
|
||||
SendPort readyPort,
|
||||
String uri,
|
||||
Function topLevelFunction,
|
||||
|
@ -381,7 +392,7 @@ class Isolate {
|
|||
SendPort? onExit,
|
||||
SendPort? onError,
|
||||
String? packageConfig,
|
||||
String? debugName) native "Isolate_spawnFunction";
|
||||
String? debugName);
|
||||
|
||||
@patch
|
||||
static Future<Isolate> spawnUri(Uri uri, List<String> args, var message,
|
||||
|
@ -502,7 +513,8 @@ class Isolate {
|
|||
|
||||
// For 'spawnFunction' see internal_patch.dart.
|
||||
|
||||
static void _spawnUri(
|
||||
@pragma("vm:external-name", "Isolate_spawnUri")
|
||||
external static void _spawnUri(
|
||||
SendPort readyPort,
|
||||
String uri,
|
||||
List<String> args,
|
||||
|
@ -514,12 +526,13 @@ class Isolate {
|
|||
bool? checked,
|
||||
List? environment,
|
||||
String? packageConfig,
|
||||
String? debugName) native "Isolate_spawnUri";
|
||||
String? debugName);
|
||||
|
||||
static void _sendOOB(port, msg) native "Isolate_sendOOB";
|
||||
@pragma("vm:external-name", "Isolate_sendOOB")
|
||||
external static void _sendOOB(port, msg);
|
||||
|
||||
static String _getDebugName(SendPort controlPort)
|
||||
native "Isolate_getDebugName";
|
||||
@pragma("vm:external-name", "Isolate_getDebugName")
|
||||
external static String _getDebugName(SendPort controlPort);
|
||||
|
||||
@patch
|
||||
void _pause(Capability resumeCapability) {
|
||||
|
@ -619,8 +632,8 @@ class Isolate {
|
|||
terminateCapability: portAndCapabilities[2]);
|
||||
}
|
||||
|
||||
static List _getPortAndCapabilitiesOfCurrentIsolate()
|
||||
native "Isolate_getPortAndCapabilitiesOfCurrentIsolate";
|
||||
@pragma("vm:external-name", "Isolate_getPortAndCapabilitiesOfCurrentIsolate")
|
||||
external static List _getPortAndCapabilitiesOfCurrentIsolate();
|
||||
|
||||
static Uri? _getCurrentRootUri() {
|
||||
try {
|
||||
|
@ -630,7 +643,8 @@ class Isolate {
|
|||
}
|
||||
}
|
||||
|
||||
static String _getCurrentRootUriStr() native "Isolate_getCurrentRootUriStr";
|
||||
@pragma("vm:external-name", "Isolate_getCurrentRootUriStr")
|
||||
external static String _getCurrentRootUriStr();
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -652,13 +666,13 @@ abstract class TransferableTypedData {
|
|||
|
||||
@pragma("vm:entry-point")
|
||||
class _TransferableTypedDataImpl implements TransferableTypedData {
|
||||
factory _TransferableTypedDataImpl(List<TypedData> list)
|
||||
native "TransferableTypedData_factory";
|
||||
@pragma("vm:external-name", "TransferableTypedData_factory")
|
||||
external factory _TransferableTypedDataImpl(List<TypedData> list);
|
||||
|
||||
ByteBuffer materialize() {
|
||||
return _materializeIntoUint8List().buffer;
|
||||
}
|
||||
|
||||
Uint8List _materializeIntoUint8List()
|
||||
native "TransferableTypedData_materialize";
|
||||
@pragma("vm:external-name", "TransferableTypedData_materialize")
|
||||
external Uint8List _materializeIntoUint8List();
|
||||
}
|
||||
|
|
|
@ -11,10 +11,14 @@ class _LibraryPrefix {
|
|||
throw "Unreachable";
|
||||
}
|
||||
|
||||
bool _isLoaded() native "LibraryPrefix_isLoaded";
|
||||
void _setLoaded() native "LibraryPrefix_setLoaded";
|
||||
Object _loadingUnit() native "LibraryPrefix_loadingUnit";
|
||||
static void _issueLoad(Object unit) native "LibraryPrefix_issueLoad";
|
||||
@pragma("vm:external-name", "LibraryPrefix_isLoaded")
|
||||
external bool _isLoaded();
|
||||
@pragma("vm:external-name", "LibraryPrefix_setLoaded")
|
||||
external void _setLoaded();
|
||||
@pragma("vm:external-name", "LibraryPrefix_loadingUnit")
|
||||
external Object _loadingUnit();
|
||||
@pragma("vm:external-name", "LibraryPrefix_issueLoad")
|
||||
external static void _issueLoad(Object unit);
|
||||
|
||||
static final _loads = new Map<Object, Completer<void>>();
|
||||
}
|
||||
|
|
|
@ -101,7 +101,8 @@ double _doublePow(double base, double exponent) {
|
|||
return _pow(base.toDouble(), exponent.toDouble());
|
||||
}
|
||||
|
||||
double _pow(double base, double exponent) native "Math_doublePow";
|
||||
@pragma("vm:external-name", "Math_doublePow")
|
||||
external double _pow(double base, double exponent);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _intPow(int base, int exponent) {
|
||||
|
@ -163,34 +164,44 @@ double log(num x) => _log(x.toDouble());
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _atan2(double a, double b) native "Math_atan2";
|
||||
@pragma("vm:external-name", "Math_atan2")
|
||||
external double _atan2(double a, double b);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _sin(double x) native "Math_sin";
|
||||
@pragma("vm:external-name", "Math_sin")
|
||||
external double _sin(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _cos(double x) native "Math_cos";
|
||||
@pragma("vm:external-name", "Math_cos")
|
||||
external double _cos(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _tan(double x) native "Math_tan";
|
||||
@pragma("vm:external-name", "Math_tan")
|
||||
external double _tan(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _acos(double x) native "Math_acos";
|
||||
@pragma("vm:external-name", "Math_acos")
|
||||
external double _acos(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _asin(double x) native "Math_asin";
|
||||
@pragma("vm:external-name", "Math_asin")
|
||||
external double _asin(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _atan(double x) native "Math_atan";
|
||||
@pragma("vm:external-name", "Math_atan")
|
||||
external double _atan(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _sqrt(double x) native "Math_sqrt";
|
||||
@pragma("vm:external-name", "Math_sqrt")
|
||||
external double _sqrt(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _exp(double x) native "Math_exp";
|
||||
@pragma("vm:external-name", "Math_exp")
|
||||
external double _exp(double x);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
double _log(double x) native "Math_log";
|
||||
@pragma("vm:external-name", "Math_log")
|
||||
external double _log(double x);
|
||||
|
||||
// TODO(iposva): Handle patch methods within a patch class correctly.
|
||||
@patch
|
||||
|
@ -235,7 +246,8 @@ class _Random implements Random {
|
|||
// fail with --throw_on_javascript_int_overflow.
|
||||
// TODO(regis): Implement in Dart and remove Random_nextState in math.cc.
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
void _nextState() native "Random_nextState";
|
||||
@pragma("vm:external-name", "Random_nextState")
|
||||
external void _nextState();
|
||||
|
||||
int nextInt(int max) {
|
||||
const limit = 0x3FFFFFFF;
|
||||
|
@ -278,9 +290,11 @@ class _Random implements Random {
|
|||
// This is a native to prevent 64-bit operations in Dart, which
|
||||
// fail with --throw_on_javascript_int_overflow.
|
||||
// TODO(regis): Implement here in Dart and remove native in math.cc.
|
||||
static Uint32List _setupSeed(int seed) native "Random_setupSeed";
|
||||
@pragma("vm:external-name", "Random_setupSeed")
|
||||
external static Uint32List _setupSeed(int seed);
|
||||
// Get a seed from the VM's random number provider.
|
||||
static Uint32List _initialSeed() native "Random_initialSeed";
|
||||
@pragma("vm:external-name", "Random_initialSeed")
|
||||
external static Uint32List _initialSeed();
|
||||
|
||||
static int _nextSeed() {
|
||||
// Trigger the PRNG once to change the internal state.
|
||||
|
@ -296,7 +310,8 @@ class _SecureRandom implements Random {
|
|||
}
|
||||
|
||||
// Return count bytes of entropy as a positive integer; count <= 8.
|
||||
static int _getBytes(int count) native "SecureRandom_getBytes";
|
||||
@pragma("vm:external-name", "SecureRandom_getBytes")
|
||||
external static int _getBytes(int count);
|
||||
|
||||
int nextInt(int max) {
|
||||
RangeError.checkValueInInterval(
|
||||
|
|
|
@ -10,5 +10,6 @@ class _MirrorReference {
|
|||
throw "Unreachable";
|
||||
}
|
||||
|
||||
bool operator ==(Object other) native "MirrorReference_equals";
|
||||
@pragma("vm:external-name", "MirrorReference_equals")
|
||||
external bool operator ==(Object other);
|
||||
}
|
||||
|
|
|
@ -65,9 +65,11 @@ String _makeSignatureString(
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
SourceLocation? _location(reflectee) native "DeclarationMirror_location";
|
||||
@pragma("vm:external-name", "DeclarationMirror_location")
|
||||
external SourceLocation? _location(reflectee);
|
||||
|
||||
List<dynamic> _metadata(reflectee) native 'DeclarationMirror_metadata';
|
||||
@pragma("vm:external-name", "DeclarationMirror_metadata")
|
||||
external List<dynamic> _metadata(reflectee);
|
||||
|
||||
List<InstanceMirror> _wrapMetadata(List reflectees) {
|
||||
var mirrors = <InstanceMirror>[];
|
||||
|
@ -77,7 +79,8 @@ List<InstanceMirror> _wrapMetadata(List reflectees) {
|
|||
return new UnmodifiableListView<InstanceMirror>(mirrors);
|
||||
}
|
||||
|
||||
bool _subtypeTest(Type a, Type b) native 'TypeMirror_subtypeTest';
|
||||
@pragma("vm:external-name", "TypeMirror_subtypeTest")
|
||||
external bool _subtypeTest(Type a, Type b);
|
||||
|
||||
class _MirrorSystem extends MirrorSystem {
|
||||
final TypeMirror dynamicType = new _SpecialTypeMirror._('dynamic');
|
||||
|
@ -97,7 +100,8 @@ class _MirrorSystem extends MirrorSystem {
|
|||
return _libraries;
|
||||
}
|
||||
|
||||
static List<dynamic> _computeLibraries() native "MirrorSystem_libraries";
|
||||
@pragma("vm:external-name", "MirrorSystem_libraries")
|
||||
external static List<dynamic> _computeLibraries();
|
||||
|
||||
IsolateMirror? _isolate;
|
||||
IsolateMirror get isolate {
|
||||
|
@ -106,7 +110,8 @@ class _MirrorSystem extends MirrorSystem {
|
|||
return _isolate = _computeIsolate();
|
||||
}
|
||||
|
||||
static IsolateMirror _computeIsolate() native "MirrorSystem_isolate";
|
||||
@pragma("vm:external-name", "MirrorSystem_isolate")
|
||||
external static IsolateMirror _computeIsolate();
|
||||
|
||||
String toString() => "MirrorSystem for isolate '${isolate.debugName}'";
|
||||
}
|
||||
|
@ -145,7 +150,8 @@ class _IsolateMirror extends Mirror implements IsolateMirror {
|
|||
return result;
|
||||
}
|
||||
|
||||
static LibraryMirror? _loadUri(String uri) native "IsolateMirror_loadUri";
|
||||
@pragma("vm:external-name", "IsolateMirror_loadUri")
|
||||
external static LibraryMirror? _loadUri(String uri);
|
||||
}
|
||||
|
||||
class _SyntheticAccessor implements MethodMirror {
|
||||
|
@ -333,15 +339,17 @@ class _InstanceMirror extends _ObjectMirror implements InstanceMirror {
|
|||
return reflect(this._invoke(_reflectee, _n(memberName), arguments, names));
|
||||
}
|
||||
|
||||
_invoke(reflectee, functionName, arguments, argumentNames)
|
||||
native 'InstanceMirror_invoke';
|
||||
@pragma("vm:external-name", "InstanceMirror_invoke")
|
||||
external _invoke(reflectee, functionName, arguments, argumentNames);
|
||||
|
||||
_invokeGetter(reflectee, getterName) native 'InstanceMirror_invokeGetter';
|
||||
@pragma("vm:external-name", "InstanceMirror_invokeGetter")
|
||||
external _invokeGetter(reflectee, getterName);
|
||||
|
||||
_invokeSetter(reflectee, setterName, value)
|
||||
native 'InstanceMirror_invokeSetter';
|
||||
@pragma("vm:external-name", "InstanceMirror_invokeSetter")
|
||||
external _invokeSetter(reflectee, setterName, value);
|
||||
|
||||
static _computeType(reflectee) native 'InstanceMirror_computeType';
|
||||
@pragma("vm:external-name", "InstanceMirror_computeType")
|
||||
external static _computeType(reflectee);
|
||||
}
|
||||
|
||||
class _ClosureMirror extends _InstanceMirror implements ClosureMirror {
|
||||
|
@ -361,7 +369,8 @@ class _ClosureMirror extends _InstanceMirror implements ClosureMirror {
|
|||
|
||||
String toString() => "ClosureMirror on '${Error.safeToString(_reflectee)}'";
|
||||
|
||||
static _computeFunction(reflectee) native 'ClosureMirror_function';
|
||||
@pragma("vm:external-name", "ClosureMirror_function")
|
||||
external static _computeFunction(reflectee);
|
||||
}
|
||||
|
||||
abstract class _TypeMirror {
|
||||
|
@ -712,45 +721,51 @@ class _ClassMirror extends _ObjectMirror implements ClassMirror, _TypeMirror {
|
|||
return false;
|
||||
}
|
||||
|
||||
static String _libraryUri(reflectee) native "ClassMirror_libraryUri";
|
||||
@pragma("vm:external-name", "ClassMirror_libraryUri")
|
||||
external static String _libraryUri(reflectee);
|
||||
|
||||
static Type? _supertype(reflectedType) native "ClassMirror_supertype";
|
||||
@pragma("vm:external-name", "ClassMirror_supertype")
|
||||
external static Type? _supertype(reflectedType);
|
||||
|
||||
static Type? _supertypeInstantiated(reflectedType)
|
||||
native "ClassMirror_supertype_instantiated";
|
||||
@pragma("vm:external-name", "ClassMirror_supertype_instantiated")
|
||||
external static Type? _supertypeInstantiated(reflectedType);
|
||||
|
||||
static List<dynamic> _nativeInterfaces(reflectedType)
|
||||
native "ClassMirror_interfaces";
|
||||
@pragma("vm:external-name", "ClassMirror_interfaces")
|
||||
external static List<dynamic> _nativeInterfaces(reflectedType);
|
||||
|
||||
static List<dynamic> _nativeInterfacesInstantiated(reflectedType)
|
||||
native "ClassMirror_interfaces_instantiated";
|
||||
@pragma("vm:external-name", "ClassMirror_interfaces_instantiated")
|
||||
external static List<dynamic> _nativeInterfacesInstantiated(reflectedType);
|
||||
|
||||
static Type? _nativeMixin(reflectedType) native "ClassMirror_mixin";
|
||||
@pragma("vm:external-name", "ClassMirror_mixin")
|
||||
external static Type? _nativeMixin(reflectedType);
|
||||
|
||||
static Type? _nativeMixinInstantiated(reflectedType, instantiator)
|
||||
native "ClassMirror_mixin_instantiated";
|
||||
@pragma("vm:external-name", "ClassMirror_mixin_instantiated")
|
||||
external static Type? _nativeMixinInstantiated(reflectedType, instantiator);
|
||||
|
||||
static List<dynamic> _computeMembers(owner, reflectee, instantiator)
|
||||
native "ClassMirror_members";
|
||||
@pragma("vm:external-name", "ClassMirror_members")
|
||||
external static List<dynamic> _computeMembers(owner, reflectee, instantiator);
|
||||
|
||||
List<dynamic> _computeConstructors(reflectee, instantiator)
|
||||
native "ClassMirror_constructors";
|
||||
@pragma("vm:external-name", "ClassMirror_constructors")
|
||||
external List<dynamic> _computeConstructors(reflectee, instantiator);
|
||||
|
||||
_invoke(reflectee, memberName, arguments, argumentNames)
|
||||
native 'ClassMirror_invoke';
|
||||
@pragma("vm:external-name", "ClassMirror_invoke")
|
||||
external _invoke(reflectee, memberName, arguments, argumentNames);
|
||||
|
||||
_invokeGetter(reflectee, getterName) native 'ClassMirror_invokeGetter';
|
||||
@pragma("vm:external-name", "ClassMirror_invokeGetter")
|
||||
external _invokeGetter(reflectee, getterName);
|
||||
|
||||
_invokeSetter(reflectee, setterName, value) native 'ClassMirror_invokeSetter';
|
||||
@pragma("vm:external-name", "ClassMirror_invokeSetter")
|
||||
external _invokeSetter(reflectee, setterName, value);
|
||||
|
||||
static _invokeConstructor(reflectee, type, constructorName, arguments,
|
||||
argumentNames) native 'ClassMirror_invokeConstructor';
|
||||
@pragma("vm:external-name", "ClassMirror_invokeConstructor")
|
||||
external static _invokeConstructor(
|
||||
reflectee, type, constructorName, arguments, argumentNames);
|
||||
|
||||
static List<dynamic> _ClassMirror_type_variables(reflectee)
|
||||
native "ClassMirror_type_variables";
|
||||
@pragma("vm:external-name", "ClassMirror_type_variables")
|
||||
external static List<dynamic> _ClassMirror_type_variables(reflectee);
|
||||
|
||||
static List<dynamic> _computeTypeArguments(reflectee)
|
||||
native "ClassMirror_type_arguments";
|
||||
@pragma("vm:external-name", "ClassMirror_type_arguments")
|
||||
external static List<dynamic> _computeTypeArguments(reflectee);
|
||||
}
|
||||
|
||||
class _FunctionTypeMirror extends _ClassMirror implements FunctionTypeMirror {
|
||||
|
@ -802,14 +817,14 @@ class _FunctionTypeMirror extends _ClassMirror implements FunctionTypeMirror {
|
|||
|
||||
String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
|
||||
|
||||
MethodMirror _FunctionTypeMirror_call_method(signatureReflectee)
|
||||
native "FunctionTypeMirror_call_method";
|
||||
@pragma("vm:external-name", "FunctionTypeMirror_call_method")
|
||||
external MethodMirror _FunctionTypeMirror_call_method(signatureReflectee);
|
||||
|
||||
static Type _FunctionTypeMirror_return_type(signatureReflectee)
|
||||
native "FunctionTypeMirror_return_type";
|
||||
@pragma("vm:external-name", "FunctionTypeMirror_return_type")
|
||||
external static Type _FunctionTypeMirror_return_type(signatureReflectee);
|
||||
|
||||
List<dynamic> _FunctionTypeMirror_parameters(signatureReflectee)
|
||||
native "FunctionTypeMirror_parameters";
|
||||
@pragma("vm:external-name", "FunctionTypeMirror_parameters")
|
||||
external List<dynamic> _FunctionTypeMirror_parameters(signatureReflectee);
|
||||
}
|
||||
|
||||
abstract class _DeclarationMirror extends Mirror implements DeclarationMirror {
|
||||
|
@ -906,11 +921,11 @@ class _TypeVariableMirror extends _DeclarationMirror
|
|||
_subtypeTest(otherReflectedType, _reflectedType);
|
||||
}
|
||||
|
||||
static DeclarationMirror _TypeVariableMirror_owner(reflectee)
|
||||
native "TypeVariableMirror_owner";
|
||||
@pragma("vm:external-name", "TypeVariableMirror_owner")
|
||||
external static DeclarationMirror _TypeVariableMirror_owner(reflectee);
|
||||
|
||||
static Type _TypeVariableMirror_upper_bound(reflectee)
|
||||
native "TypeVariableMirror_upper_bound";
|
||||
@pragma("vm:external-name", "TypeVariableMirror_upper_bound")
|
||||
external static Type _TypeVariableMirror_upper_bound(reflectee);
|
||||
}
|
||||
|
||||
Symbol _asSetter(Symbol getter, LibraryMirror library) {
|
||||
|
@ -977,18 +992,20 @@ class _LibraryMirror extends _ObjectMirror implements LibraryMirror {
|
|||
_libraryDependencies(_reflectee).cast<LibraryDependencyMirror>());
|
||||
}
|
||||
|
||||
List<dynamic> _libraryDependencies(reflectee)
|
||||
native 'LibraryMirror_libraryDependencies';
|
||||
@pragma("vm:external-name", "LibraryMirror_libraryDependencies")
|
||||
external List<dynamic> _libraryDependencies(reflectee);
|
||||
|
||||
_invoke(reflectee, memberName, arguments, argumentNames)
|
||||
native 'LibraryMirror_invoke';
|
||||
@pragma("vm:external-name", "LibraryMirror_invoke")
|
||||
external _invoke(reflectee, memberName, arguments, argumentNames);
|
||||
|
||||
_invokeGetter(reflectee, getterName) native 'LibraryMirror_invokeGetter';
|
||||
@pragma("vm:external-name", "LibraryMirror_invokeGetter")
|
||||
external _invokeGetter(reflectee, getterName);
|
||||
|
||||
_invokeSetter(reflectee, setterName, value)
|
||||
native 'LibraryMirror_invokeSetter';
|
||||
@pragma("vm:external-name", "LibraryMirror_invokeSetter")
|
||||
external _invokeSetter(reflectee, setterName, value);
|
||||
|
||||
List<dynamic> _computeMembers(reflectee) native "LibraryMirror_members";
|
||||
@pragma("vm:external-name", "LibraryMirror_members")
|
||||
external List<dynamic> _computeMembers(reflectee);
|
||||
}
|
||||
|
||||
class _LibraryDependencyMirror extends Mirror
|
||||
|
@ -1037,8 +1054,8 @@ class _LibraryDependencyMirror extends Mirror
|
|||
});
|
||||
}
|
||||
|
||||
static LibraryMirror _tryUpgradePrefix(libraryPrefix)
|
||||
native "LibraryMirror_fromPrefix";
|
||||
@pragma("vm:external-name", "LibraryMirror_fromPrefix")
|
||||
external static LibraryMirror _tryUpgradePrefix(libraryPrefix);
|
||||
|
||||
SourceLocation? get location => null;
|
||||
}
|
||||
|
@ -1169,16 +1186,17 @@ class _MethodMirror extends _DeclarationMirror implements MethodMirror {
|
|||
|
||||
String toString() => "MethodMirror on '${MirrorSystem.getName(simpleName)}'";
|
||||
|
||||
static dynamic _MethodMirror_owner(reflectee, instantiator)
|
||||
native "MethodMirror_owner";
|
||||
@pragma("vm:external-name", "MethodMirror_owner")
|
||||
external static dynamic _MethodMirror_owner(reflectee, instantiator);
|
||||
|
||||
static dynamic _MethodMirror_return_type(reflectee, instantiator)
|
||||
native "MethodMirror_return_type";
|
||||
@pragma("vm:external-name", "MethodMirror_return_type")
|
||||
external static dynamic _MethodMirror_return_type(reflectee, instantiator);
|
||||
|
||||
List<dynamic> _MethodMirror_parameters(reflectee)
|
||||
native "MethodMirror_parameters";
|
||||
@pragma("vm:external-name", "MethodMirror_parameters")
|
||||
external List<dynamic> _MethodMirror_parameters(reflectee);
|
||||
|
||||
static String? _MethodMirror_source(reflectee) native "MethodMirror_source";
|
||||
@pragma("vm:external-name", "MethodMirror_source")
|
||||
external static String? _MethodMirror_source(reflectee);
|
||||
}
|
||||
|
||||
class _VariableMirror extends _DeclarationMirror implements VariableMirror {
|
||||
|
@ -1217,8 +1235,8 @@ class _VariableMirror extends _DeclarationMirror implements VariableMirror {
|
|||
String toString() =>
|
||||
"VariableMirror on '${MirrorSystem.getName(simpleName)}'";
|
||||
|
||||
static _VariableMirror_type(reflectee, instantiator)
|
||||
native "VariableMirror_type";
|
||||
@pragma("vm:external-name", "VariableMirror_type")
|
||||
external static _VariableMirror_type(reflectee, instantiator);
|
||||
}
|
||||
|
||||
class _ParameterMirror extends _VariableMirror implements ParameterMirror {
|
||||
|
@ -1282,8 +1300,9 @@ class _ParameterMirror extends _VariableMirror implements ParameterMirror {
|
|||
|
||||
String toString() => "ParameterMirror on '${_n(simpleName)}'";
|
||||
|
||||
static Type _ParameterMirror_type(_reflectee, _position, instantiator)
|
||||
native "ParameterMirror_type";
|
||||
@pragma("vm:external-name", "ParameterMirror_type")
|
||||
external static Type _ParameterMirror_type(
|
||||
_reflectee, _position, instantiator);
|
||||
}
|
||||
|
||||
class _SpecialTypeMirror extends Mirror
|
||||
|
@ -1347,12 +1366,12 @@ class _Mirrors {
|
|||
: new _InstanceMirror._(reflectee);
|
||||
}
|
||||
|
||||
static _ClassMirror _makeLocalClassMirror(Type key)
|
||||
native "Mirrors_makeLocalClassMirror";
|
||||
static TypeMirror _makeLocalTypeMirror(Type key)
|
||||
native "Mirrors_makeLocalTypeMirror";
|
||||
static Type _instantiateGenericType(Type key, typeArguments)
|
||||
native "Mirrors_instantiateGenericType";
|
||||
@pragma("vm:external-name", "Mirrors_makeLocalClassMirror")
|
||||
external static _ClassMirror _makeLocalClassMirror(Type key);
|
||||
@pragma("vm:external-name", "Mirrors_makeLocalTypeMirror")
|
||||
external static TypeMirror _makeLocalTypeMirror(Type key);
|
||||
@pragma("vm:external-name", "Mirrors_instantiateGenericType")
|
||||
external static Type _instantiateGenericType(Type key, typeArguments);
|
||||
|
||||
static Expando<_ClassMirror> _declarationCache = new Expando("ClassMirror");
|
||||
static Expando<TypeMirror> _instantiationCache = new Expando("TypeMirror");
|
||||
|
|
|
@ -88,6 +88,6 @@ class MirrorSystem {
|
|||
return new internal.Symbol.unvalidated(name);
|
||||
}
|
||||
|
||||
static _mangleName(String name, _MirrorReference lib)
|
||||
native "Mirrors_mangleName";
|
||||
@pragma("vm:external-name", "Mirrors_mangleName")
|
||||
external static _mangleName(String name, _MirrorReference lib);
|
||||
}
|
||||
|
|
|
@ -6,14 +6,16 @@
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int _getHash(obj) native "Object_getHash";
|
||||
@pragma("vm:external-name", "Object_getHash")
|
||||
external int _getHash(obj);
|
||||
|
||||
/// Set hash code associated with the object if it is not set yet
|
||||
/// and return the current hash code. See [Object._objectHashCode]
|
||||
/// for why this function needs to check for already set hash code.
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int _setHashIfNotSetYet(obj, int hash) native "Object_setHashIfNotSetYet";
|
||||
@pragma("vm:external-name", "Object_setHashIfNotSetYet")
|
||||
external int _setHashIfNotSetYet(obj, int hash);
|
||||
|
||||
@patch
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -23,7 +25,8 @@ class Object {
|
|||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
@pragma("vm:prefer-inline")
|
||||
bool operator ==(Object other) native "Object_equals";
|
||||
@pragma("vm:external-name", "Object_equals")
|
||||
external bool operator ==(Object other);
|
||||
|
||||
// Helpers used to implement hashCode. If a hashCode is used, we remember it
|
||||
// in a weak table in the VM (32 bit) or in the header of the object (64
|
||||
|
@ -52,9 +55,11 @@ class Object {
|
|||
int get _identityHashCode => _objectHashCode(this);
|
||||
|
||||
@patch
|
||||
String toString() native "Object_toString";
|
||||
@pragma("vm:external-name", "Object_toString")
|
||||
external String toString();
|
||||
// A statically dispatched version of Object.toString.
|
||||
static String _toString(obj) native "Object_toString";
|
||||
@pragma("vm:external-name", "Object_toString")
|
||||
external static String _toString(obj);
|
||||
|
||||
@patch
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
@ -66,22 +71,26 @@ class Object {
|
|||
@patch
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
// Result type is either "dart:core#_Type" or "dart:core#_FunctionType".
|
||||
Type get runtimeType native "Object_runtimeType";
|
||||
@pragma("vm:external-name", "Object_runtimeType")
|
||||
external Type get runtimeType;
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:entry-point", "call")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
static bool _haveSameRuntimeType(a, b) native "Object_haveSameRuntimeType";
|
||||
@pragma("vm:external-name", "Object_haveSameRuntimeType")
|
||||
external static bool _haveSameRuntimeType(a, b);
|
||||
|
||||
// Call this function instead of inlining instanceof, thus collecting
|
||||
// type feedback and reducing code size of unoptimized code.
|
||||
@pragma("vm:entry-point", "call")
|
||||
bool _instanceOf(instantiatorTypeArguments, functionTypeArguments, type)
|
||||
native "Object_instanceOf";
|
||||
@pragma("vm:external-name", "Object_instanceOf")
|
||||
external bool _instanceOf(
|
||||
instantiatorTypeArguments, functionTypeArguments, type);
|
||||
|
||||
// Group of functions for implementing fast simple instance of.
|
||||
@pragma("vm:entry-point", "call")
|
||||
bool _simpleInstanceOf(type) native "Object_simpleInstanceOf";
|
||||
@pragma("vm:external-name", "Object_simpleInstanceOf")
|
||||
external bool _simpleInstanceOf(type);
|
||||
@pragma("vm:entry-point", "call")
|
||||
bool _simpleInstanceOfTrue(type) => true;
|
||||
@pragma("vm:entry-point", "call")
|
||||
|
|
|
@ -16,15 +16,20 @@ class UserTag {
|
|||
|
||||
@pragma("vm:entry-point")
|
||||
class _UserTag implements UserTag {
|
||||
factory _UserTag(String label) native "UserTag_new";
|
||||
String get label native "UserTag_label";
|
||||
UserTag makeCurrent() native "UserTag_makeCurrent";
|
||||
@pragma("vm:external-name", "UserTag_new")
|
||||
external factory _UserTag(String label);
|
||||
@pragma("vm:external-name", "UserTag_label")
|
||||
external String get label;
|
||||
@pragma("vm:external-name", "UserTag_makeCurrent")
|
||||
external UserTag makeCurrent();
|
||||
}
|
||||
|
||||
@patch
|
||||
UserTag getCurrentTag() => _getCurrentTag();
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
UserTag _getCurrentTag() native "Profiler_getCurrentTag";
|
||||
@pragma("vm:external-name", "Profiler_getCurrentTag")
|
||||
external UserTag _getCurrentTag();
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
UserTag _getDefaultTag() native "UserTag_defaultTag";
|
||||
@pragma("vm:external-name", "UserTag_defaultTag")
|
||||
external UserTag _getDefaultTag();
|
||||
|
|
|
@ -210,11 +210,12 @@ class _RegExpMatch implements RegExpMatch {
|
|||
|
||||
@pragma("vm:entry-point")
|
||||
class _RegExp implements RegExp {
|
||||
factory _RegExp(String pattern,
|
||||
@pragma("vm:external-name", "RegExp_factory")
|
||||
external factory _RegExp(String pattern,
|
||||
{bool multiLine: false,
|
||||
bool caseSensitive: true,
|
||||
bool unicode: false,
|
||||
bool dotAll: false}) native "RegExp_factory";
|
||||
bool dotAll: false});
|
||||
|
||||
RegExpMatch? firstMatch(String input) {
|
||||
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
|
||||
|
@ -265,17 +266,23 @@ class _RegExp implements RegExp {
|
|||
return input._substringUnchecked(match[0], match[1]);
|
||||
}
|
||||
|
||||
String get pattern native "RegExp_getPattern";
|
||||
@pragma("vm:external-name", "RegExp_getPattern")
|
||||
external String get pattern;
|
||||
|
||||
bool get isMultiLine native "RegExp_getIsMultiLine";
|
||||
@pragma("vm:external-name", "RegExp_getIsMultiLine")
|
||||
external bool get isMultiLine;
|
||||
|
||||
bool get isCaseSensitive native "RegExp_getIsCaseSensitive";
|
||||
@pragma("vm:external-name", "RegExp_getIsCaseSensitive")
|
||||
external bool get isCaseSensitive;
|
||||
|
||||
bool get isUnicode native "RegExp_getIsUnicode";
|
||||
@pragma("vm:external-name", "RegExp_getIsUnicode")
|
||||
external bool get isUnicode;
|
||||
|
||||
bool get isDotAll native "RegExp_getIsDotAll";
|
||||
@pragma("vm:external-name", "RegExp_getIsDotAll")
|
||||
external bool get isDotAll;
|
||||
|
||||
int get _groupCount native "RegExp_getGroupCount";
|
||||
@pragma("vm:external-name", "RegExp_getGroupCount")
|
||||
external int get _groupCount;
|
||||
|
||||
/// The names and indices of named capture group.
|
||||
///
|
||||
|
@ -284,7 +291,8 @@ class _RegExp implements RegExp {
|
|||
/// [String] is the name of a capture group and the following
|
||||
/// [int] is that capture group's index.
|
||||
/// Returns `null` if there are no group names.
|
||||
List? get _groupNameList native "RegExp_getGroupNameMap";
|
||||
@pragma("vm:external-name", "RegExp_getGroupNameMap")
|
||||
external List? get _groupNameList;
|
||||
|
||||
Iterable<String> get _groupNames sync* {
|
||||
final nameList = _groupNameList;
|
||||
|
@ -351,12 +359,12 @@ class _RegExp implements RegExp {
|
|||
];
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
List<int>? _ExecuteMatch(String str, int start_index)
|
||||
native "RegExp_ExecuteMatch";
|
||||
@pragma("vm:external-name", "RegExp_ExecuteMatch")
|
||||
external List<int>? _ExecuteMatch(String str, int start_index);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
List<int>? _ExecuteMatchSticky(String str, int start_index)
|
||||
native "RegExp_ExecuteMatchSticky";
|
||||
@pragma("vm:external-name", "RegExp_ExecuteMatchSticky")
|
||||
external List<int>? _ExecuteMatchSticky(String str, int start_index);
|
||||
}
|
||||
|
||||
class _AllMatchesIterable extends IterableBase<RegExpMatch> {
|
||||
|
|
|
@ -13,10 +13,12 @@ class Stopwatch {
|
|||
|
||||
// Returns the current clock tick.
|
||||
@patch
|
||||
static int _now() native "Stopwatch_now";
|
||||
@pragma("vm:external-name", "Stopwatch_now")
|
||||
external static int _now();
|
||||
|
||||
// Returns the frequency of clock ticks in Hz.
|
||||
static int _computeFrequency() native "Stopwatch_frequency";
|
||||
@pragma("vm:external-name", "Stopwatch_frequency")
|
||||
external static int _computeFrequency();
|
||||
|
||||
@patch
|
||||
int get elapsedMicroseconds {
|
||||
|
|
|
@ -197,6 +197,6 @@ class StringBuffer {
|
|||
/**
|
||||
* Create a [String] from the UFT-16 code units in buffer.
|
||||
*/
|
||||
static String _create(Uint16List buffer, int length, bool isLatin1)
|
||||
native "StringBuffer_createStringFromUint16Array";
|
||||
@pragma("vm:external-name", "StringBuffer_createStringFromUint16Array")
|
||||
external static String _create(Uint16List buffer, int length, bool isLatin1);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,9 @@ class String {
|
|||
}
|
||||
|
||||
@patch
|
||||
const factory String.fromEnvironment(String name, {String defaultValue = ""})
|
||||
native "String_fromEnvironment";
|
||||
@pragma("vm:external-name", "String_fromEnvironment")
|
||||
external const factory String.fromEnvironment(String name,
|
||||
{String defaultValue = ""});
|
||||
|
||||
bool get _isOneByte;
|
||||
String _substringUnchecked(int startIndex, int endIndex);
|
||||
|
@ -96,11 +97,13 @@ abstract class _StringBase implements String {
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get hashCode native "String_getHashCode";
|
||||
@pragma("vm:external-name", "String_getHashCode")
|
||||
external int get hashCode;
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get _identityHashCode native "String_getHashCode";
|
||||
@pragma("vm:external-name", "String_getHashCode")
|
||||
external int get _identityHashCode;
|
||||
|
||||
bool get _isOneByte {
|
||||
// Alternatively return false and override it on one-byte string classes.
|
||||
|
@ -248,18 +251,21 @@ abstract class _StringBase implements String {
|
|||
return s;
|
||||
}
|
||||
|
||||
static String _createFromCodePoints(List<int> codePoints, int start, int end)
|
||||
native "StringBase_createFromCodePoints";
|
||||
@pragma("vm:external-name", "StringBase_createFromCodePoints")
|
||||
external static String _createFromCodePoints(
|
||||
List<int> codePoints, int start, int end);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
String operator [](int index) native "String_charAt";
|
||||
@pragma("vm:external-name", "String_charAt")
|
||||
external String operator [](int index);
|
||||
|
||||
int codeUnitAt(int index); // Implemented in the subclasses.
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get length native "String_getLength";
|
||||
@pragma("vm:external-name", "String_getLength")
|
||||
external int get length;
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
|
@ -269,7 +275,8 @@ abstract class _StringBase implements String {
|
|||
|
||||
bool get isNotEmpty => !isEmpty;
|
||||
|
||||
String operator +(String other) native "String_concat";
|
||||
@pragma("vm:external-name", "String_concat")
|
||||
external String operator +(String other);
|
||||
|
||||
String toString() {
|
||||
return this;
|
||||
|
@ -412,8 +419,8 @@ abstract class _StringBase implements String {
|
|||
return _substringUncheckedNative(startIndex, endIndex);
|
||||
}
|
||||
|
||||
String _substringUncheckedNative(int startIndex, int endIndex)
|
||||
native "StringBase_substringUnchecked";
|
||||
@pragma("vm:external-name", "StringBase_substringUnchecked")
|
||||
external String _substringUncheckedNative(int startIndex, int endIndex);
|
||||
|
||||
// Checks for one-byte whitespaces only.
|
||||
static bool _isOneByteWhitespace(int codeUnit) {
|
||||
|
@ -716,10 +723,9 @@ abstract class _StringBase implements String {
|
|||
* If they are, then we have to check the base string slices to know
|
||||
* whether the result must be a one-byte string.
|
||||
*/
|
||||
static String
|
||||
_joinReplaceAllResult(String base, List matches, int length,
|
||||
bool replacementStringsAreOneByte)
|
||||
native "StringBase_joinReplaceAllResult";
|
||||
@pragma("vm:external-name", "StringBase_joinReplaceAllResult")
|
||||
external static String _joinReplaceAllResult(
|
||||
String base, List matches, int length, bool replacementStringsAreOneByte);
|
||||
|
||||
String replaceAllMapped(Pattern pattern, String replace(Match match)) {
|
||||
if (pattern == null) throw new ArgumentError.notNull("pattern");
|
||||
|
@ -929,9 +935,11 @@ abstract class _StringBase implements String {
|
|||
|
||||
Runes get runes => new Runes(this);
|
||||
|
||||
String toUpperCase() native "String_toUpperCase";
|
||||
@pragma("vm:external-name", "String_toUpperCase")
|
||||
external String toUpperCase();
|
||||
|
||||
String toLowerCase() native "String_toLowerCase";
|
||||
@pragma("vm:external-name", "String_toLowerCase")
|
||||
external String toLowerCase();
|
||||
|
||||
// Concatenate ['start', 'end'[ elements of 'strings'.
|
||||
static String _concatRange(List<String> strings, int start, int end) {
|
||||
|
@ -943,8 +951,8 @@ abstract class _StringBase implements String {
|
|||
|
||||
// Call this method if all elements of [strings] are known to be strings
|
||||
// but not all are known to be OneByteString(s).
|
||||
static String _concatRangeNative(List strings, int start, int end)
|
||||
native "String_concatRange";
|
||||
@pragma("vm:external-name", "String_concatRange")
|
||||
external static String _concatRangeNative(List strings, int start, int end);
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -955,11 +963,13 @@ class _OneByteString extends _StringBase {
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get hashCode native "String_getHashCode";
|
||||
@pragma("vm:external-name", "String_getHashCode")
|
||||
external int get hashCode;
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int codeUnitAt(int index) native "String_codeUnitAt";
|
||||
@pragma("vm:external-name", "String_codeUnitAt")
|
||||
external int codeUnitAt(int index);
|
||||
|
||||
bool _isWhitespace(int codeUnit) {
|
||||
return _StringBase._isOneByteWhitespace(codeUnit);
|
||||
|
@ -973,8 +983,8 @@ class _OneByteString extends _StringBase {
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", _OneByteString)
|
||||
String _substringUncheckedNative(int startIndex, int endIndex)
|
||||
native "OneByteString_substringUnchecked";
|
||||
@pragma("vm:external-name", "OneByteString_substringUnchecked")
|
||||
external String _substringUncheckedNative(int startIndex, int endIndex);
|
||||
|
||||
List<String> _splitWithCharCode(int charCode) {
|
||||
final parts = <String>[];
|
||||
|
@ -1248,8 +1258,9 @@ class _OneByteString extends _StringBase {
|
|||
return unsafeCast<_OneByteString>(allocateOneByteString(length));
|
||||
}
|
||||
|
||||
static _OneByteString _allocateFromOneByteList(List<int> list, int start,
|
||||
int end) native "OneByteString_allocateFromOneByteList";
|
||||
@pragma("vm:external-name", "OneByteString_allocateFromOneByteList")
|
||||
external static _OneByteString _allocateFromOneByteList(
|
||||
List<int> list, int start, int end);
|
||||
|
||||
// This is internal helper method. Code point value must be a valid
|
||||
// Latin1 value (0..0xFF), index must be valid.
|
||||
|
@ -1290,8 +1301,9 @@ class _TwoByteString extends _StringBase {
|
|||
return unsafeCast<_TwoByteString>(allocateTwoByteString(length));
|
||||
}
|
||||
|
||||
static String _allocateFromTwoByteList(List<int> list, int start, int end)
|
||||
native "TwoByteString_allocateFromTwoByteList";
|
||||
@pragma("vm:external-name", "TwoByteString_allocateFromTwoByteList")
|
||||
external static String _allocateFromTwoByteList(
|
||||
List<int> list, int start, int end);
|
||||
|
||||
// This is internal helper method. Code point value must be a valid
|
||||
// UTF-16 value (0..0xFFFF), index must be valid.
|
||||
|
@ -1306,7 +1318,8 @@ class _TwoByteString extends _StringBase {
|
|||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int codeUnitAt(int index) native "String_codeUnitAt";
|
||||
@pragma("vm:external-name", "String_codeUnitAt")
|
||||
external int codeUnitAt(int index);
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
|
@ -1327,7 +1340,8 @@ class _ExternalOneByteString extends _StringBase {
|
|||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int codeUnitAt(int index) native "String_codeUnitAt";
|
||||
@pragma("vm:external-name", "String_codeUnitAt")
|
||||
external int codeUnitAt(int index);
|
||||
|
||||
bool operator ==(Object other) {
|
||||
return super == other;
|
||||
|
@ -1346,7 +1360,8 @@ class _ExternalTwoByteString extends _StringBase {
|
|||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int codeUnitAt(int index) native "String_codeUnitAt";
|
||||
@pragma("vm:external-name", "String_codeUnitAt")
|
||||
external int codeUnitAt(int index);
|
||||
|
||||
bool operator ==(Object other) {
|
||||
return super == other;
|
||||
|
|
|
@ -5,22 +5,28 @@
|
|||
// part of "developer.dart";
|
||||
|
||||
@patch
|
||||
bool _isDartStreamEnabled() native "Timeline_isDartStreamEnabled";
|
||||
@pragma("vm:external-name", "Timeline_isDartStreamEnabled")
|
||||
external bool _isDartStreamEnabled();
|
||||
|
||||
@patch
|
||||
int _getTraceClock() native "Timeline_getTraceClock";
|
||||
@pragma("vm:external-name", "Timeline_getTraceClock")
|
||||
external int _getTraceClock();
|
||||
|
||||
@patch
|
||||
int _getNextAsyncId() native "Timeline_getNextAsyncId";
|
||||
@pragma("vm:external-name", "Timeline_getNextAsyncId")
|
||||
external int _getNextAsyncId();
|
||||
|
||||
@patch
|
||||
void _reportTaskEvent(int taskId, String phase, String category, String name,
|
||||
String argumentsAsJson) native "Timeline_reportTaskEvent";
|
||||
@pragma("vm:external-name", "Timeline_reportTaskEvent")
|
||||
external void _reportTaskEvent(int taskId, String phase, String category,
|
||||
String name, String argumentsAsJson);
|
||||
|
||||
@patch
|
||||
void _reportFlowEvent(String category, String name, int type, int id,
|
||||
String argumentsAsJson) native "Timeline_reportFlowEvent";
|
||||
@pragma("vm:external-name", "Timeline_reportFlowEvent")
|
||||
external void _reportFlowEvent(
|
||||
String category, String name, int type, int id, String argumentsAsJson);
|
||||
|
||||
@patch
|
||||
void _reportInstantEvent(String category, String name, String argumentsAsJson)
|
||||
native "Timeline_reportInstantEvent";
|
||||
@pragma("vm:external-name", "Timeline_reportInstantEvent")
|
||||
external void _reportInstantEvent(
|
||||
String category, String name, String argumentsAsJson);
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
// Equivalent of AbstractTypeLayout.
|
||||
abstract class _AbstractType implements Type {
|
||||
String toString() native "AbstractType_toString";
|
||||
@pragma("vm:external-name", "AbstractType_toString")
|
||||
external String toString();
|
||||
}
|
||||
|
||||
// Equivalent of TypeLayout.
|
||||
|
@ -20,11 +21,13 @@ class _Type extends _AbstractType {
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get hashCode native "Type_getHashCode";
|
||||
@pragma("vm:external-name", "Type_getHashCode")
|
||||
external int get hashCode;
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool operator ==(other) native "Type_equality";
|
||||
@pragma("vm:external-name", "Type_equality")
|
||||
external bool operator ==(other);
|
||||
}
|
||||
|
||||
// Equivalent of FunctionTypeLayout.
|
||||
|
@ -36,11 +39,13 @@ class _FunctionType extends _AbstractType {
|
|||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int get hashCode native "FunctionType_getHashCode";
|
||||
@pragma("vm:external-name", "FunctionType_getHashCode")
|
||||
external int get hashCode;
|
||||
|
||||
@pragma("vm:recognized", "asm-intrinsic")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool operator ==(other) native "FunctionType_equality";
|
||||
@pragma("vm:external-name", "FunctionType_equality")
|
||||
external bool operator ==(other);
|
||||
}
|
||||
|
||||
// Equivalent of TypeRefLayout.
|
||||
|
|
|
@ -61,7 +61,8 @@ abstract class _TypedListBase {
|
|||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get length native "TypedDataBase_length";
|
||||
@pragma("vm:external-name", "TypedDataBase_length")
|
||||
external int get length;
|
||||
|
||||
int get elementSizeInBytes;
|
||||
int get offsetInBytes;
|
||||
|
@ -112,13 +113,9 @@ abstract class _TypedListBase {
|
|||
// match the cids of 'this' and 'from'.
|
||||
// Uses toCid and fromCid to decide if clamping is necessary.
|
||||
// Element size of toCid and fromCid must match (test at caller).
|
||||
bool _setRange(
|
||||
int startInBytes,
|
||||
int lengthInBytes,
|
||||
_TypedListBase from,
|
||||
int startFromInBytes,
|
||||
int toCid,
|
||||
int fromCid) native "TypedDataBase_setRange";
|
||||
@pragma("vm:external-name", "TypedDataBase_setRange")
|
||||
external bool _setRange(int startInBytes, int lengthInBytes,
|
||||
_TypedListBase from, int startFromInBytes, int toCid, int fromCid);
|
||||
}
|
||||
|
||||
mixin _IntListMixin implements List<int> {
|
||||
|
@ -2048,79 +2045,100 @@ abstract class _TypedList extends _TypedListBase {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int _getInt8(int offsetInBytes) native "TypedData_GetInt8";
|
||||
@pragma("vm:external-name", "TypedData_GetInt8")
|
||||
external int _getInt8(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8";
|
||||
@pragma("vm:external-name", "TypedData_SetInt8")
|
||||
external void _setInt8(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int _getUint8(int offsetInBytes) native "TypedData_GetUint8";
|
||||
@pragma("vm:external-name", "TypedData_GetUint8")
|
||||
external int _getUint8(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setUint8(int offsetInBytes, int value) native "TypedData_SetUint8";
|
||||
@pragma("vm:external-name", "TypedData_SetUint8")
|
||||
external void _setUint8(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int _getInt16(int offsetInBytes) native "TypedData_GetInt16";
|
||||
@pragma("vm:external-name", "TypedData_GetInt16")
|
||||
external int _getInt16(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setInt16(int offsetInBytes, int value) native "TypedData_SetInt16";
|
||||
@pragma("vm:external-name", "TypedData_SetInt16")
|
||||
external void _setInt16(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
int _getUint16(int offsetInBytes) native "TypedData_GetUint16";
|
||||
@pragma("vm:external-name", "TypedData_GetUint16")
|
||||
external int _getUint16(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setUint16(int offsetInBytes, int value) native "TypedData_SetUint16";
|
||||
@pragma("vm:external-name", "TypedData_SetUint16")
|
||||
external void _setUint16(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _getInt32(int offsetInBytes) native "TypedData_GetInt32";
|
||||
@pragma("vm:external-name", "TypedData_GetInt32")
|
||||
external int _getInt32(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setInt32(int offsetInBytes, int value) native "TypedData_SetInt32";
|
||||
@pragma("vm:external-name", "TypedData_SetInt32")
|
||||
external void _setInt32(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _getUint32(int offsetInBytes) native "TypedData_GetUint32";
|
||||
@pragma("vm:external-name", "TypedData_GetUint32")
|
||||
external int _getUint32(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setUint32(int offsetInBytes, int value) native "TypedData_SetUint32";
|
||||
@pragma("vm:external-name", "TypedData_SetUint32")
|
||||
external void _setUint32(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _getInt64(int offsetInBytes) native "TypedData_GetInt64";
|
||||
@pragma("vm:external-name", "TypedData_GetInt64")
|
||||
external int _getInt64(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setInt64(int offsetInBytes, int value) native "TypedData_SetInt64";
|
||||
@pragma("vm:external-name", "TypedData_SetInt64")
|
||||
external void _setInt64(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
int _getUint64(int offsetInBytes) native "TypedData_GetUint64";
|
||||
@pragma("vm:external-name", "TypedData_GetUint64")
|
||||
external int _getUint64(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64";
|
||||
@pragma("vm:external-name", "TypedData_SetUint64")
|
||||
external void _setUint64(int offsetInBytes, int value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32";
|
||||
@pragma("vm:external-name", "TypedData_GetFloat32")
|
||||
external double _getFloat32(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setFloat32(int offsetInBytes, double value)
|
||||
native "TypedData_SetFloat32";
|
||||
@pragma("vm:external-name", "TypedData_SetFloat32")
|
||||
external void _setFloat32(int offsetInBytes, double value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64";
|
||||
@pragma("vm:external-name", "TypedData_GetFloat64")
|
||||
external double _getFloat64(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setFloat64(int offsetInBytes, double value)
|
||||
native "TypedData_SetFloat64";
|
||||
@pragma("vm:external-name", "TypedData_SetFloat64")
|
||||
external void _setFloat64(int offsetInBytes, double value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 _getFloat32x4(int offsetInBytes) native "TypedData_GetFloat32x4";
|
||||
@pragma("vm:external-name", "TypedData_GetFloat32x4")
|
||||
external Float32x4 _getFloat32x4(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setFloat32x4(int offsetInBytes, Float32x4 value)
|
||||
native "TypedData_SetFloat32x4";
|
||||
@pragma("vm:external-name", "TypedData_SetFloat32x4")
|
||||
external void _setFloat32x4(int offsetInBytes, Float32x4 value);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _getInt32x4(int offsetInBytes) native "TypedData_GetInt32x4";
|
||||
@pragma("vm:external-name", "TypedData_GetInt32x4")
|
||||
external Int32x4 _getInt32x4(int offsetInBytes);
|
||||
@pragma("vm:recognized", "other")
|
||||
void _setInt32x4(int offsetInBytes, Int32x4 value)
|
||||
native "TypedData_SetInt32x4";
|
||||
@pragma("vm:external-name", "TypedData_SetInt32x4")
|
||||
external void _setInt32x4(int offsetInBytes, Int32x4 value);
|
||||
|
||||
Float64x2 _getFloat64x2(int offsetInBytes) native "TypedData_GetFloat64x2";
|
||||
void _setFloat64x2(int offsetInBytes, Float64x2 value)
|
||||
native "TypedData_SetFloat64x2";
|
||||
@pragma("vm:external-name", "TypedData_GetFloat64x2")
|
||||
external Float64x2 _getFloat64x2(int offsetInBytes);
|
||||
@pragma("vm:external-name", "TypedData_SetFloat64x2")
|
||||
external void _setFloat64x2(int offsetInBytes, Float64x2 value);
|
||||
|
||||
/**
|
||||
* Stores the [CodeUnits] as UTF-16 units into this TypedData at
|
||||
|
@ -2146,7 +2164,8 @@ class Int8List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int8List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Int8List(int length) native "TypedData_Int8Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Int8Array_new")
|
||||
external factory Int8List(int length);
|
||||
|
||||
@patch
|
||||
factory Int8List.fromList(List<int> elements) {
|
||||
|
@ -2198,7 +2217,8 @@ class Uint8List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint8List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Uint8List(int length) native "TypedData_Uint8Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Uint8Array_new")
|
||||
external factory Uint8List(int length);
|
||||
|
||||
@patch
|
||||
factory Uint8List.fromList(List<int> elements) {
|
||||
|
@ -2250,7 +2270,8 @@ class Uint8ClampedList {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint8ClampedList)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new";
|
||||
@pragma("vm:external-name", "TypedData_Uint8ClampedArray_new")
|
||||
external factory Uint8ClampedList(int length);
|
||||
|
||||
@patch
|
||||
factory Uint8ClampedList.fromList(List<int> elements) {
|
||||
|
@ -2302,7 +2323,8 @@ class Int16List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int16List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Int16List(int length) native "TypedData_Int16Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Int16Array_new")
|
||||
external factory Int16List(int length);
|
||||
|
||||
@patch
|
||||
factory Int16List.fromList(List<int> elements) {
|
||||
|
@ -2374,7 +2396,8 @@ class Uint16List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint16List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Uint16List(int length) native "TypedData_Uint16Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Uint16Array_new")
|
||||
external factory Uint16List(int length);
|
||||
|
||||
@patch
|
||||
factory Uint16List.fromList(List<int> elements) {
|
||||
|
@ -2446,7 +2469,8 @@ class Int32List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Int32List(int length) native "TypedData_Int32Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Int32Array_new")
|
||||
external factory Int32List(int length);
|
||||
|
||||
@patch
|
||||
factory Int32List.fromList(List<int> elements) {
|
||||
|
@ -2505,7 +2529,8 @@ class Uint32List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint32List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Uint32List(int length) native "TypedData_Uint32Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Uint32Array_new")
|
||||
external factory Uint32List(int length);
|
||||
|
||||
@patch
|
||||
factory Uint32List.fromList(List<int> elements) {
|
||||
|
@ -2564,7 +2589,8 @@ class Int64List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int64List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Int64List(int length) native "TypedData_Int64Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Int64Array_new")
|
||||
external factory Int64List(int length);
|
||||
|
||||
@patch
|
||||
factory Int64List.fromList(List<int> elements) {
|
||||
|
@ -2623,7 +2649,8 @@ class Uint64List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint64List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Uint64List(int length) native "TypedData_Uint64Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Uint64Array_new")
|
||||
external factory Uint64List(int length);
|
||||
|
||||
@patch
|
||||
factory Uint64List.fromList(List<int> elements) {
|
||||
|
@ -2682,7 +2709,8 @@ class Float32List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Float32List(int length) native "TypedData_Float32Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Float32Array_new")
|
||||
external factory Float32List(int length);
|
||||
|
||||
@patch
|
||||
factory Float32List.fromList(List<double> elements) {
|
||||
|
@ -2742,7 +2770,8 @@ class Float64List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Float64List(int length) native "TypedData_Float64Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Float64Array_new")
|
||||
external factory Float64List(int length);
|
||||
|
||||
@patch
|
||||
factory Float64List.fromList(List<double> elements) {
|
||||
|
@ -2802,7 +2831,8 @@ class Float32x4List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Float32x4List(int length) native "TypedData_Float32x4Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Float32x4Array_new")
|
||||
external factory Float32x4List(int length);
|
||||
|
||||
@patch
|
||||
factory Float32x4List.fromList(List<Float32x4> elements) {
|
||||
|
@ -2861,7 +2891,8 @@ class Int32x4List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Int32x4List(int length) native "TypedData_Int32x4Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Int32x4Array_new")
|
||||
external factory Int32x4List(int length);
|
||||
|
||||
@patch
|
||||
factory Int32x4List.fromList(List<Int32x4> elements) {
|
||||
|
@ -2920,7 +2951,8 @@ class Float64x2List {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2List)
|
||||
@pragma("vm:prefer-inline")
|
||||
factory Float64x2List(int length) native "TypedData_Float64x2Array_new";
|
||||
@pragma("vm:external-name", "TypedData_Float64x2Array_new")
|
||||
external factory Float64x2List(int length);
|
||||
|
||||
@patch
|
||||
factory Float64x2List.fromList(List<Float64x2> elements) {
|
||||
|
@ -3557,8 +3589,9 @@ class Float32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
static _Float32x4 _Float32x4FromDoubles(
|
||||
double x, double y, double z, double w) native "Float32x4_fromDoubles";
|
||||
@pragma("vm:external-name", "Float32x4_fromDoubles")
|
||||
external static _Float32x4 _Float32x4FromDoubles(
|
||||
double x, double y, double z, double w);
|
||||
|
||||
@patch
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -3569,90 +3602,113 @@ class Float32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
static _Float32x4 _Float32x4Splat(double v) native "Float32x4_splat";
|
||||
@pragma("vm:external-name", "Float32x4_splat")
|
||||
external static _Float32x4 _Float32x4Splat(double v);
|
||||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
factory Float32x4.zero() native "Float32x4_zero";
|
||||
@pragma("vm:external-name", "Float32x4_zero")
|
||||
external factory Float32x4.zero();
|
||||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
factory Float32x4.fromInt32x4Bits(Int32x4 x)
|
||||
native "Float32x4_fromInt32x4Bits";
|
||||
@pragma("vm:external-name", "Float32x4_fromInt32x4Bits")
|
||||
external factory Float32x4.fromInt32x4Bits(Int32x4 x);
|
||||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
factory Float32x4.fromFloat64x2(Float64x2 v) native "Float32x4_fromFloat64x2";
|
||||
@pragma("vm:external-name", "Float32x4_fromFloat64x2")
|
||||
external factory Float32x4.fromFloat64x2(Float64x2 v);
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
class _Float32x4 implements Float32x4 {
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 operator +(Float32x4 other) native "Float32x4_add";
|
||||
@pragma("vm:external-name", "Float32x4_add")
|
||||
external Float32x4 operator +(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 operator -() native "Float32x4_negate";
|
||||
@pragma("vm:external-name", "Float32x4_negate")
|
||||
external Float32x4 operator -();
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 operator -(Float32x4 other) native "Float32x4_sub";
|
||||
@pragma("vm:external-name", "Float32x4_sub")
|
||||
external Float32x4 operator -(Float32x4 other);
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 operator *(Float32x4 other) native "Float32x4_mul";
|
||||
@pragma("vm:external-name", "Float32x4_mul")
|
||||
external Float32x4 operator *(Float32x4 other);
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
Float32x4 operator /(Float32x4 other) native "Float32x4_div";
|
||||
@pragma("vm:external-name", "Float32x4_div")
|
||||
external Float32x4 operator /(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 lessThan(Float32x4 other) native "Float32x4_cmplt";
|
||||
@pragma("vm:external-name", "Float32x4_cmplt")
|
||||
external Int32x4 lessThan(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 lessThanOrEqual(Float32x4 other) native "Float32x4_cmplte";
|
||||
@pragma("vm:external-name", "Float32x4_cmplte")
|
||||
external Int32x4 lessThanOrEqual(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 greaterThan(Float32x4 other) native "Float32x4_cmpgt";
|
||||
@pragma("vm:external-name", "Float32x4_cmpgt")
|
||||
external Int32x4 greaterThan(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 greaterThanOrEqual(Float32x4 other) native "Float32x4_cmpgte";
|
||||
@pragma("vm:external-name", "Float32x4_cmpgte")
|
||||
external Int32x4 greaterThanOrEqual(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 equal(Float32x4 other) native "Float32x4_cmpequal";
|
||||
@pragma("vm:external-name", "Float32x4_cmpequal")
|
||||
external Int32x4 equal(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 notEqual(Float32x4 other) native "Float32x4_cmpnequal";
|
||||
@pragma("vm:external-name", "Float32x4_cmpnequal")
|
||||
external Int32x4 notEqual(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 scale(double s) native "Float32x4_scale";
|
||||
@pragma("vm:external-name", "Float32x4_scale")
|
||||
external Float32x4 scale(double s);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 abs() native "Float32x4_abs";
|
||||
@pragma("vm:external-name", "Float32x4_abs")
|
||||
external Float32x4 abs();
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
|
||||
native "Float32x4_clamp";
|
||||
@pragma("vm:external-name", "Float32x4_clamp")
|
||||
external Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit);
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double get x native "Float32x4_getX";
|
||||
@pragma("vm:external-name", "Float32x4_getX")
|
||||
external double get x;
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double get y native "Float32x4_getY";
|
||||
@pragma("vm:external-name", "Float32x4_getY")
|
||||
external double get y;
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double get z native "Float32x4_getZ";
|
||||
@pragma("vm:external-name", "Float32x4_getZ")
|
||||
external double get z;
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double get w native "Float32x4_getW";
|
||||
@pragma("vm:external-name", "Float32x4_getW")
|
||||
external double get w;
|
||||
@pragma("vm:recognized", "other")
|
||||
int get signMask native "Float32x4_getSignMask";
|
||||
@pragma("vm:external-name", "Float32x4_getSignMask")
|
||||
external int get signMask;
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 shuffle(int mask) native "Float32x4_shuffle";
|
||||
@pragma("vm:external-name", "Float32x4_shuffle")
|
||||
external Float32x4 shuffle(int mask);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 shuffleMix(Float32x4 zw, int mask) native "Float32x4_shuffleMix";
|
||||
@pragma("vm:external-name", "Float32x4_shuffleMix")
|
||||
external Float32x4 shuffleMix(Float32x4 zw, int mask);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Float32x4 withX(double x) {
|
||||
|
@ -3662,7 +3718,8 @@ class _Float32x4 implements Float32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 _withX(double x) native "Float32x4_setX";
|
||||
@pragma("vm:external-name", "Float32x4_setX")
|
||||
external Float32x4 _withX(double x);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Float32x4 withY(double y) {
|
||||
|
@ -3672,7 +3729,8 @@ class _Float32x4 implements Float32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 _withY(double y) native "Float32x4_setY";
|
||||
@pragma("vm:external-name", "Float32x4_setY")
|
||||
external Float32x4 _withY(double y);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Float32x4 withZ(double z) {
|
||||
|
@ -3682,7 +3740,8 @@ class _Float32x4 implements Float32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 _withZ(double z) native "Float32x4_setZ";
|
||||
@pragma("vm:external-name", "Float32x4_setZ")
|
||||
external Float32x4 _withZ(double z);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Float32x4 withW(double w) {
|
||||
|
@ -3692,23 +3751,29 @@ class _Float32x4 implements Float32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 _withW(double w) native "Float32x4_setW";
|
||||
@pragma("vm:external-name", "Float32x4_setW")
|
||||
external Float32x4 _withW(double w);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 min(Float32x4 other) native "Float32x4_min";
|
||||
@pragma("vm:external-name", "Float32x4_min")
|
||||
external Float32x4 min(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 max(Float32x4 other) native "Float32x4_max";
|
||||
@pragma("vm:external-name", "Float32x4_max")
|
||||
external Float32x4 max(Float32x4 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 sqrt() native "Float32x4_sqrt";
|
||||
@pragma("vm:external-name", "Float32x4_sqrt")
|
||||
external Float32x4 sqrt();
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 reciprocal() native "Float32x4_reciprocal";
|
||||
@pragma("vm:external-name", "Float32x4_reciprocal")
|
||||
external Float32x4 reciprocal();
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 reciprocalSqrt() native "Float32x4_reciprocalSqrt";
|
||||
@pragma("vm:external-name", "Float32x4_reciprocalSqrt")
|
||||
external Float32x4 reciprocalSqrt();
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -3725,8 +3790,8 @@ class Int32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
static _Int32x4 _Int32x4FromInts(int x, int y, int z, int w)
|
||||
native "Int32x4_fromInts";
|
||||
@pragma("vm:external-name", "Int32x4_fromInts")
|
||||
external static _Int32x4 _Int32x4FromInts(int x, int y, int z, int w);
|
||||
|
||||
@patch
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -3740,35 +3805,47 @@ class Int32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
static _Int32x4 _Int32x4FromBools(bool x, bool y, bool z, bool w)
|
||||
native "Int32x4_fromBools";
|
||||
@pragma("vm:external-name", "Int32x4_fromBools")
|
||||
external static _Int32x4 _Int32x4FromBools(bool x, bool y, bool z, bool w);
|
||||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
factory Int32x4.fromFloat32x4Bits(Float32x4 x)
|
||||
native "Int32x4_fromFloat32x4Bits";
|
||||
@pragma("vm:external-name", "Int32x4_fromFloat32x4Bits")
|
||||
external factory Int32x4.fromFloat32x4Bits(Float32x4 x);
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
class _Int32x4 implements Int32x4 {
|
||||
Int32x4 operator |(Int32x4 other) native "Int32x4_or";
|
||||
Int32x4 operator &(Int32x4 other) native "Int32x4_and";
|
||||
Int32x4 operator ^(Int32x4 other) native "Int32x4_xor";
|
||||
Int32x4 operator +(Int32x4 other) native "Int32x4_add";
|
||||
Int32x4 operator -(Int32x4 other) native "Int32x4_sub";
|
||||
int get x native "Int32x4_getX";
|
||||
int get y native "Int32x4_getY";
|
||||
int get z native "Int32x4_getZ";
|
||||
int get w native "Int32x4_getW";
|
||||
@pragma("vm:external-name", "Int32x4_or")
|
||||
external Int32x4 operator |(Int32x4 other);
|
||||
@pragma("vm:external-name", "Int32x4_and")
|
||||
external Int32x4 operator &(Int32x4 other);
|
||||
@pragma("vm:external-name", "Int32x4_xor")
|
||||
external Int32x4 operator ^(Int32x4 other);
|
||||
@pragma("vm:external-name", "Int32x4_add")
|
||||
external Int32x4 operator +(Int32x4 other);
|
||||
@pragma("vm:external-name", "Int32x4_sub")
|
||||
external Int32x4 operator -(Int32x4 other);
|
||||
@pragma("vm:external-name", "Int32x4_getX")
|
||||
external int get x;
|
||||
@pragma("vm:external-name", "Int32x4_getY")
|
||||
external int get y;
|
||||
@pragma("vm:external-name", "Int32x4_getZ")
|
||||
external int get z;
|
||||
@pragma("vm:external-name", "Int32x4_getW")
|
||||
external int get w;
|
||||
@pragma("vm:recognized", "other")
|
||||
int get signMask native "Int32x4_getSignMask";
|
||||
@pragma("vm:external-name", "Int32x4_getSignMask")
|
||||
external int get signMask;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 shuffle(int mask) native "Int32x4_shuffle";
|
||||
@pragma("vm:external-name", "Int32x4_shuffle")
|
||||
external Int32x4 shuffle(int mask);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 shuffleMix(Int32x4 zw, int mask) native "Int32x4_shuffleMix";
|
||||
@pragma("vm:external-name", "Int32x4_shuffleMix")
|
||||
external Int32x4 shuffleMix(Int32x4 zw, int mask);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Int32x4 withX(int x) {
|
||||
|
@ -3777,7 +3854,8 @@ class _Int32x4 implements Int32x4 {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withX(int x) native "Int32x4_setX";
|
||||
@pragma("vm:external-name", "Int32x4_setX")
|
||||
external Int32x4 _withX(int x);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Int32x4 withY(int y) {
|
||||
|
@ -3786,7 +3864,8 @@ class _Int32x4 implements Int32x4 {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withY(int y) native "Int32x4_setY";
|
||||
@pragma("vm:external-name", "Int32x4_setY")
|
||||
external Int32x4 _withY(int y);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Int32x4 withZ(int z) {
|
||||
|
@ -3795,7 +3874,8 @@ class _Int32x4 implements Int32x4 {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withZ(int z) native "Int32x4_setZ";
|
||||
@pragma("vm:external-name", "Int32x4_setZ")
|
||||
external Int32x4 _withZ(int z);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Int32x4 withW(int w) {
|
||||
|
@ -3804,20 +3884,25 @@ class _Int32x4 implements Int32x4 {
|
|||
}
|
||||
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withW(int w) native "Int32x4_setW";
|
||||
@pragma("vm:external-name", "Int32x4_setW")
|
||||
external Int32x4 _withW(int w);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get flagX native "Int32x4_getFlagX";
|
||||
@pragma("vm:external-name", "Int32x4_getFlagX")
|
||||
external bool get flagX;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get flagY native "Int32x4_getFlagY";
|
||||
@pragma("vm:external-name", "Int32x4_getFlagY")
|
||||
external bool get flagY;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get flagZ native "Int32x4_getFlagZ";
|
||||
@pragma("vm:external-name", "Int32x4_getFlagZ")
|
||||
external bool get flagZ;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", bool)
|
||||
bool get flagW native "Int32x4_getFlagW";
|
||||
@pragma("vm:external-name", "Int32x4_getFlagW")
|
||||
external bool get flagW;
|
||||
|
||||
@pragma("vm:prefer-inline", _Int32x4)
|
||||
Int32x4 withFlagX(bool x) {
|
||||
|
@ -3827,7 +3912,8 @@ class _Int32x4 implements Int32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withFlagX(bool x) native "Int32x4_setFlagX";
|
||||
@pragma("vm:external-name", "Int32x4_setFlagX")
|
||||
external Int32x4 _withFlagX(bool x);
|
||||
|
||||
@pragma("vm:prefer-inline", _Int32x4)
|
||||
Int32x4 withFlagY(bool y) {
|
||||
|
@ -3837,7 +3923,8 @@ class _Int32x4 implements Int32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withFlagY(bool y) native "Int32x4_setFlagY";
|
||||
@pragma("vm:external-name", "Int32x4_setFlagY")
|
||||
external Int32x4 _withFlagY(bool y);
|
||||
|
||||
@pragma("vm:prefer-inline", _Int32x4)
|
||||
Int32x4 withFlagZ(bool z) {
|
||||
|
@ -3847,7 +3934,8 @@ class _Int32x4 implements Int32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withFlagZ(bool z) native "Int32x4_setFlagZ";
|
||||
@pragma("vm:external-name", "Int32x4_setFlagZ")
|
||||
external Int32x4 _withFlagZ(bool z);
|
||||
|
||||
@pragma("vm:prefer-inline", _Int32x4)
|
||||
Int32x4 withFlagW(bool w) {
|
||||
|
@ -3857,12 +3945,13 @@ class _Int32x4 implements Int32x4 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4)
|
||||
Int32x4 _withFlagW(bool w) native "Int32x4_setFlagW";
|
||||
@pragma("vm:external-name", "Int32x4_setFlagW")
|
||||
external Int32x4 _withFlagW(bool w);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4)
|
||||
Float32x4 select(Float32x4 trueValue, Float32x4 falseValue)
|
||||
native "Int32x4_select";
|
||||
@pragma("vm:external-name", "Int32x4_select")
|
||||
external Float32x4 select(Float32x4 trueValue, Float32x4 falseValue);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -3877,8 +3966,8 @@ class Float64x2 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
static _Float64x2 _Float64x2FromDoubles(double x, double y)
|
||||
native "Float64x2_fromDoubles";
|
||||
@pragma("vm:external-name", "Float64x2_fromDoubles")
|
||||
external static _Float64x2 _Float64x2FromDoubles(double x, double y);
|
||||
|
||||
@patch
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -3889,48 +3978,61 @@ class Float64x2 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
static _Float64x2 _Float64x2Splat(double v) native "Float64x2_splat";
|
||||
@pragma("vm:external-name", "Float64x2_splat")
|
||||
external static _Float64x2 _Float64x2Splat(double v);
|
||||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
factory Float64x2.zero() native "Float64x2_zero";
|
||||
@pragma("vm:external-name", "Float64x2_zero")
|
||||
external factory Float64x2.zero();
|
||||
|
||||
@patch
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4";
|
||||
@pragma("vm:external-name", "Float64x2_fromFloat32x4")
|
||||
external factory Float64x2.fromFloat32x4(Float32x4 v);
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
class _Float64x2 implements Float64x2 {
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
Float64x2 operator +(Float64x2 other) native "Float64x2_add";
|
||||
@pragma("vm:external-name", "Float64x2_add")
|
||||
external Float64x2 operator +(Float64x2 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 operator -() native "Float64x2_negate";
|
||||
@pragma("vm:external-name", "Float64x2_negate")
|
||||
external Float64x2 operator -();
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
Float64x2 operator -(Float64x2 other) native "Float64x2_sub";
|
||||
@pragma("vm:external-name", "Float64x2_sub")
|
||||
external Float64x2 operator -(Float64x2 other);
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
Float64x2 operator *(Float64x2 other) native "Float64x2_mul";
|
||||
@pragma("vm:external-name", "Float64x2_mul")
|
||||
external Float64x2 operator *(Float64x2 other);
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
Float64x2 operator /(Float64x2 other) native "Float64x2_div";
|
||||
@pragma("vm:external-name", "Float64x2_div")
|
||||
external Float64x2 operator /(Float64x2 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 scale(double s) native "Float64x2_scale";
|
||||
@pragma("vm:external-name", "Float64x2_scale")
|
||||
external Float64x2 scale(double s);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 abs() native "Float64x2_abs";
|
||||
Float64x2 clamp(Float64x2 lowerLimit, Float64x2 upperLimit)
|
||||
native "Float64x2_clamp";
|
||||
@pragma("vm:external-name", "Float64x2_abs")
|
||||
external Float64x2 abs();
|
||||
@pragma("vm:external-name", "Float64x2_clamp")
|
||||
external Float64x2 clamp(Float64x2 lowerLimit, Float64x2 upperLimit);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double get x native "Float64x2_getX";
|
||||
@pragma("vm:external-name", "Float64x2_getX")
|
||||
external double get x;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Double")
|
||||
double get y native "Float64x2_getY";
|
||||
@pragma("vm:external-name", "Float64x2_getY")
|
||||
external double get y;
|
||||
@pragma("vm:recognized", "other")
|
||||
int get signMask native "Float64x2_getSignMask";
|
||||
@pragma("vm:external-name", "Float64x2_getSignMask")
|
||||
external int get signMask;
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Float64x2 withX(double x) {
|
||||
|
@ -3940,7 +4042,8 @@ class _Float64x2 implements Float64x2 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 _withX(double x) native "Float64x2_setX";
|
||||
@pragma("vm:external-name", "Float64x2_setX")
|
||||
external Float64x2 _withX(double x);
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
Float64x2 withY(double y) {
|
||||
|
@ -3950,17 +4053,21 @@ class _Float64x2 implements Float64x2 {
|
|||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 _withY(double y) native "Float64x2_setY";
|
||||
@pragma("vm:external-name", "Float64x2_setY")
|
||||
external Float64x2 _withY(double y);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 min(Float64x2 other) native "Float64x2_min";
|
||||
@pragma("vm:external-name", "Float64x2_min")
|
||||
external Float64x2 min(Float64x2 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 max(Float64x2 other) native "Float64x2_max";
|
||||
@pragma("vm:external-name", "Float64x2_max")
|
||||
external Float64x2 max(Float64x2 other);
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2)
|
||||
Float64x2 sqrt() native "Float64x2_sqrt";
|
||||
@pragma("vm:external-name", "Float64x2_sqrt")
|
||||
external Float64x2 sqrt();
|
||||
}
|
||||
|
||||
class _TypedListIterator<E> implements Iterator<E> {
|
||||
|
@ -4005,12 +4112,14 @@ abstract class _TypedListView extends _TypedListBase implements TypedData {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
@pragma("vm:prefer-inline")
|
||||
_TypedList get _typedData native "TypedDataView_typedData";
|
||||
@pragma("vm:external-name", "TypedDataView_typedData")
|
||||
external _TypedList get _typedData;
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get offsetInBytes native "TypedDataView_offsetInBytes";
|
||||
@pragma("vm:external-name", "TypedDataView_offsetInBytes")
|
||||
external int get offsetInBytes;
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -4020,8 +4129,9 @@ class _Int8ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int8ArrayView)
|
||||
factory _Int8ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Int8ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Int8ArrayView_new")
|
||||
external factory _Int8ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4060,8 +4170,9 @@ class _Uint8ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint8ArrayView)
|
||||
factory _Uint8ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Uint8ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Uint8ArrayView_new")
|
||||
external factory _Uint8ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4100,8 +4211,9 @@ class _Uint8ClampedArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint8ClampedArrayView)
|
||||
factory _Uint8ClampedArrayView._(_TypedList buffer, int offsetInBytes,
|
||||
int length) native "TypedDataView_Uint8ClampedArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Uint8ClampedArrayView_new")
|
||||
external factory _Uint8ClampedArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4140,8 +4252,9 @@ class _Int16ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int16ArrayView)
|
||||
factory _Int16ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Int16ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Int16ArrayView_new")
|
||||
external factory _Int16ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4193,8 +4306,9 @@ class _Uint16ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint16ArrayView)
|
||||
factory _Uint16ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Uint16ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Uint16ArrayView_new")
|
||||
external factory _Uint16ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4247,8 +4361,9 @@ class _Int32ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32ArrayView)
|
||||
factory _Int32ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Int32ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Int32ArrayView_new")
|
||||
external factory _Int32ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4287,8 +4402,9 @@ class _Uint32ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint32ArrayView)
|
||||
factory _Uint32ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Uint32ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Uint32ArrayView_new")
|
||||
external factory _Uint32ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4327,8 +4443,9 @@ class _Int64ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int64ArrayView)
|
||||
factory _Int64ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Int64ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Int64ArrayView_new")
|
||||
external factory _Int64ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4367,8 +4484,9 @@ class _Uint64ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Uint64ArrayView)
|
||||
factory _Uint64ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Uint64ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Uint64ArrayView_new")
|
||||
external factory _Uint64ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4407,8 +4525,9 @@ class _Float32ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32ArrayView)
|
||||
factory _Float32ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Float32ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Float32ArrayView_new")
|
||||
external factory _Float32ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4447,8 +4566,9 @@ class _Float64ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64ArrayView)
|
||||
factory _Float64ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Float64ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Float64ArrayView_new")
|
||||
external factory _Float64ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
@pragma("vm:prefer-inline")
|
||||
|
@ -4487,8 +4607,9 @@ class _Float32x4ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float32x4ArrayView)
|
||||
factory _Float32x4ArrayView._(_TypedList buffer, int offsetInBytes,
|
||||
int length) native "TypedDataView_Float32x4ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Float32x4ArrayView_new")
|
||||
external factory _Float32x4ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
Float32x4 operator [](int index) {
|
||||
|
@ -4525,8 +4646,9 @@ class _Int32x4ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Int32x4ArrayView)
|
||||
factory _Int32x4ArrayView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_Int32x4ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Int32x4ArrayView_new")
|
||||
external factory _Int32x4ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
Int32x4 operator [](int index) {
|
||||
|
@ -4563,8 +4685,9 @@ class _Float64x2ArrayView extends _TypedListView
|
|||
// Constructor.
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _Float64x2ArrayView)
|
||||
factory _Float64x2ArrayView._(_TypedList buffer, int offsetInBytes,
|
||||
int length) native "TypedDataView_Float64x2ArrayView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_Float64x2ArrayView_new")
|
||||
external factory _Float64x2ArrayView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing List interface.
|
||||
Float64x2 operator [](int index) {
|
||||
|
@ -4598,8 +4721,9 @@ class _Float64x2ArrayView extends _TypedListView
|
|||
class _ByteDataView implements ByteData {
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", _ByteDataView)
|
||||
factory _ByteDataView._(_TypedList buffer, int offsetInBytes, int length)
|
||||
native "TypedDataView_ByteDataView_new";
|
||||
@pragma("vm:external-name", "TypedDataView_ByteDataView_new")
|
||||
external factory _ByteDataView._(
|
||||
_TypedList buffer, int offsetInBytes, int length);
|
||||
|
||||
// Method(s) implementing TypedData interface.
|
||||
_ByteBuffer get buffer {
|
||||
|
@ -4846,17 +4970,20 @@ class _ByteDataView implements ByteData {
|
|||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:non-nullable-result-type")
|
||||
@pragma("vm:prefer-inline")
|
||||
_TypedList get _typedData native "TypedDataView_typedData";
|
||||
@pragma("vm:external-name", "TypedDataView_typedData")
|
||||
external _TypedList get _typedData;
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get offsetInBytes native "TypedDataView_offsetInBytes";
|
||||
@pragma("vm:external-name", "TypedDataView_offsetInBytes")
|
||||
external int get offsetInBytes;
|
||||
|
||||
@pragma("vm:recognized", "graph-intrinsic")
|
||||
@pragma("vm:exact-result-type", "dart:core#_Smi")
|
||||
@pragma("vm:prefer-inline")
|
||||
int get length native "TypedDataBase_length";
|
||||
@pragma("vm:external-name", "TypedDataBase_length")
|
||||
external int get length;
|
||||
}
|
||||
|
||||
@pragma("vm:prefer-inline")
|
||||
|
|
|
@ -26,7 +26,8 @@ class Uri {
|
|||
class _Uri {
|
||||
static final bool _isWindowsCached = _isWindowsPlatform;
|
||||
|
||||
static bool get _isWindowsPlatform native "Uri_isWindowsPlatform";
|
||||
@pragma("vm:external-name", "Uri_isWindowsPlatform")
|
||||
external static bool get _isWindowsPlatform;
|
||||
|
||||
@patch
|
||||
static bool get _isWindows => _isWindowsCached;
|
||||
|
|
|
@ -8,15 +8,19 @@
|
|||
class _WeakProperty {
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
get key native "WeakProperty_getKey";
|
||||
@pragma("vm:external-name", "WeakProperty_getKey")
|
||||
external get key;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
set key(k) native "WeakProperty_setKey";
|
||||
@pragma("vm:external-name", "WeakProperty_setKey")
|
||||
external set key(k);
|
||||
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
get value native "WeakProperty_getValue";
|
||||
@pragma("vm:external-name", "WeakProperty_getValue")
|
||||
external get value;
|
||||
@pragma("vm:recognized", "other")
|
||||
@pragma("vm:prefer-inline")
|
||||
set value(v) native "WeakProperty_setValue";
|
||||
@pragma("vm:external-name", "WeakProperty_setValue")
|
||||
external set value(v);
|
||||
}
|
||||
|
|
|
@ -823,9 +823,9 @@ class FfiNative<T> {
|
|||
|
||||
// Bootstrapping native for getting the FFI native C function pointer to look
|
||||
// up the FFI resolver.
|
||||
Pointer<NativeFunction<IntPtr Function(Handle, Handle)>>
|
||||
_get_ffi_native_resolver<
|
||||
T extends NativeFunction>() native "Ffi_GetFfiNativeResolver";
|
||||
@pragma("vm:external-name", "Ffi_GetFfiNativeResolver")
|
||||
external Pointer<NativeFunction<IntPtr Function(Handle, Handle)>>
|
||||
_get_ffi_native_resolver<T extends NativeFunction>();
|
||||
|
||||
// Resolver for FFI Native C function pointers.
|
||||
@pragma('vm:entry-point')
|
||||
|
|
|
@ -19,5 +19,5 @@ class NativeFieldWrapperClass4 extends NativeFieldWrapperClass3 {}
|
|||
/// NOTE: This is function is temporary and will be deprecated in the near
|
||||
/// future.
|
||||
@pragma("vm:recognized", "other")
|
||||
int getNativeField(NativeFieldWrapperClass1 object)
|
||||
native "FullyRecognizedMethod_NoNative";
|
||||
@pragma("vm:external-name", "FullyRecognizedMethod_NoNative")
|
||||
external int getNativeField(NativeFieldWrapperClass1 object);
|
||||
|
|
|
@ -54,7 +54,8 @@ class Asset {
|
|||
String toString() => '$name ($mimeType)';
|
||||
}
|
||||
|
||||
List _decodeAssets(Uint8List data) native 'VMService_DecodeAssets';
|
||||
@pragma("vm:external-name", "VMService_DecodeAssets")
|
||||
external List _decodeAssets(Uint8List data);
|
||||
|
||||
Map<String, Asset>? _assets;
|
||||
Map<String, Asset> get assets {
|
||||
|
|
|
@ -251,10 +251,11 @@ class Message {
|
|||
setResponse(encodeRpcError(this, code, details: '$method: $details'));
|
||||
}
|
||||
|
||||
bool sendIsolateServiceMessage(SendPort sp, List m)
|
||||
native 'VMService_SendIsolateServiceMessage';
|
||||
@pragma("vm:external-name", "VMService_SendIsolateServiceMessage")
|
||||
external bool sendIsolateServiceMessage(SendPort sp, List m);
|
||||
|
||||
void sendRootServiceMessage(List m) native 'VMService_SendRootServiceMessage';
|
||||
@pragma("vm:external-name", "VMService_SendRootServiceMessage")
|
||||
external void sendRootServiceMessage(List m);
|
||||
|
||||
void sendObjectRootServiceMessage(List m)
|
||||
native 'VMService_SendObjectRootServiceMessage';
|
||||
@pragma("vm:external-name", "VMService_SendObjectRootServiceMessage")
|
||||
external void sendObjectRootServiceMessage(List m);
|
||||
|
|
|
@ -733,24 +733,29 @@ void _registerIsolate(int port_id, SendPort sp, String name) =>
|
|||
VMService().runningIsolates.isolateStartup(port_id, sp, name);
|
||||
|
||||
/// Notify the VM that the service is running.
|
||||
void _onStart() native 'VMService_OnStart';
|
||||
@pragma("vm:external-name", "VMService_OnStart")
|
||||
external void _onStart();
|
||||
|
||||
/// Notify the VM that the service is no longer running.
|
||||
void _onExit() native 'VMService_OnExit';
|
||||
@pragma("vm:external-name", "VMService_OnExit")
|
||||
external void _onExit();
|
||||
|
||||
/// Notify the VM that the server's address has changed.
|
||||
void onServerAddressChange(String? address) {
|
||||
_onServerAddressChange(address);
|
||||
}
|
||||
|
||||
void _onServerAddressChange(String? address)
|
||||
native 'VMService_OnServerAddressChange';
|
||||
@pragma("vm:external-name", "VMService_OnServerAddressChange")
|
||||
external void _onServerAddressChange(String? address);
|
||||
|
||||
/// Subscribe to a service stream.
|
||||
bool _vmListenStream(String streamId) native 'VMService_ListenStream';
|
||||
@pragma("vm:external-name", "VMService_ListenStream")
|
||||
external bool _vmListenStream(String streamId);
|
||||
|
||||
/// Cancel a subscription to a service stream.
|
||||
void _vmCancelStream(String streamId) native 'VMService_CancelStream';
|
||||
@pragma("vm:external-name", "VMService_CancelStream")
|
||||
external void _vmCancelStream(String streamId);
|
||||
|
||||
/// Get the bytes to the tar archive.
|
||||
Uint8List _requestAssets() native 'VMService_RequestAssets';
|
||||
@pragma("vm:external-name", "VMService_RequestAssets")
|
||||
external Uint8List _requestAssets();
|
||||
|
|
Loading…
Reference in a new issue