[dart2wasm] Remove duplicate code to call references
Change-Id: I304729f6ed19a75de16ddced15b3f47f894e9c49 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430740 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
committed by
Commit Queue
parent
3deffabce1
commit
26da655ddf
@@ -689,17 +689,7 @@ abstract class AstCodeGenerator
|
||||
}
|
||||
|
||||
List<w.ValueType> call(Reference target) {
|
||||
final targetModule = translator.moduleForReference(target);
|
||||
final isLocalModuleCall = targetModule == b.module;
|
||||
final name = translator.functions.getFunctionName(target);
|
||||
|
||||
if (isLocalModuleCall) {
|
||||
b.comment('Direct call to $name');
|
||||
return b.invoke(translator.directCallTarget(target));
|
||||
} else {
|
||||
b.comment('Direct call to $name (across modules)');
|
||||
return translator.callReference(target, b);
|
||||
}
|
||||
return translator.callReference(target, b);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -553,16 +553,19 @@ class Translator with KernelNodes {
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the function associated with [reference] and calls its using
|
||||
/// [callFunction].
|
||||
/// Calls the function referred to in [reference] either directly or via a
|
||||
/// cross-module call.
|
||||
///
|
||||
/// When performing a direct call it may inline the target if allowed and
|
||||
/// beneficial.
|
||||
List<w.ValueType> callReference(
|
||||
Reference reference, w.InstructionsBuilder b) {
|
||||
final function = functions.getFunction(reference);
|
||||
final targetModule = function.enclosingModule;
|
||||
if (targetModule == b.module) {
|
||||
final targetModule = moduleForReference(reference);
|
||||
final isLocalModuleCall = targetModule == b.module;
|
||||
if (isLocalModuleCall) {
|
||||
return b.invoke(directCallTarget(reference));
|
||||
}
|
||||
return callFunction(function, b);
|
||||
return callFunction(functions.getFunction(reference), b);
|
||||
}
|
||||
|
||||
late final WasmFunctionImporter _importedFunctions =
|
||||
|
||||
Reference in New Issue
Block a user