Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart

Issue 1424923004: Add StaticUse for more precise registration of statically known element use. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
diff --git a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
index 88844b63e801ba4950bca4583c420a15d5982a1a..a40caad790d64a0eaf8abea71e5a8e16bcbfaca8 100644
--- a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
@@ -9,21 +9,24 @@ class CheckedModeHelper {
const CheckedModeHelper(String this.name);
- Element getElement(Compiler compiler) {
+ StaticUse getStaticUse(Compiler compiler) {
JavaScriptBackend backend = compiler.backend;
- return backend.helpers.findHelper(name);
+ return new StaticUse.staticInvoke(
+ backend.helpers.findHelper(name), callStructure);
}
+ CallStructure get callStructure => CallStructure.ONE_ARG;
+
jsAst.Expression generateCall(SsaCodeGenerator codegen,
HTypeConversion node) {
- Element helperElement = getElement(codegen.compiler);
- codegen.registry.registerStaticUse(helperElement);
+ StaticUse staticUse = getStaticUse(codegen.compiler);
+ codegen.registry.registerStaticUse(staticUse);
List<jsAst.Expression> arguments = <jsAst.Expression>[];
codegen.use(node.checkedInput);
arguments.add(codegen.pop());
generateAdditionalArguments(codegen, node, arguments);
jsAst.Expression helper =
- codegen.backend.emitter.staticFunctionAccess(helperElement);
+ codegen.backend.emitter.staticFunctionAccess(staticUse.element);
return new jsAst.Call(helper, arguments);
}
@@ -73,6 +76,8 @@ class CheckedModeHelper {
class MalformedCheckedModeHelper extends CheckedModeHelper {
const MalformedCheckedModeHelper(String name) : super(name);
+ CallStructure get callStructure => CallStructure.TWO_ARGS;
+
void generateAdditionalArguments(SsaCodeGenerator codegen,
HTypeConversion node,
List<jsAst.Expression> arguments) {
@@ -84,6 +89,8 @@ class MalformedCheckedModeHelper extends CheckedModeHelper {
class PropertyCheckedModeHelper extends CheckedModeHelper {
const PropertyCheckedModeHelper(String name) : super(name);
+ CallStructure get callStructure => CallStructure.TWO_ARGS;
+
void generateAdditionalArguments(SsaCodeGenerator codegen,
HTypeConversion node,
List<jsAst.Expression> arguments) {
@@ -96,6 +103,8 @@ class PropertyCheckedModeHelper extends CheckedModeHelper {
class TypeVariableCheckedModeHelper extends CheckedModeHelper {
const TypeVariableCheckedModeHelper(String name) : super(name);
+ CallStructure get callStructure => CallStructure.TWO_ARGS;
+
void generateAdditionalArguments(SsaCodeGenerator codegen,
HTypeConversion node,
List<jsAst.Expression> arguments) {
@@ -108,6 +117,8 @@ class TypeVariableCheckedModeHelper extends CheckedModeHelper {
class SubtypeCheckedModeHelper extends CheckedModeHelper {
const SubtypeCheckedModeHelper(String name) : super(name);
+ CallStructure get callStructure => const CallStructure.unnamed(4);
+
void generateAdditionalArguments(SsaCodeGenerator codegen,
HTypeConversion node,
List<jsAst.Expression> arguments) {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698