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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle function types in checked mode. Created 7 years, 6 months 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
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index cbf357967722e8e41378613afdb0387d586d5d79..1bd903e589e1d552a4c6fc579dabed317ff298da 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -2246,7 +2246,6 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
assert(invariant(input, !type.isMalformed,
message: 'Attempt to check malformed type $type'));
Element element = type.element;
-
if (element == backend.jsArrayClass) {
checkArray(input, negative ? '!==': '===');
return;
@@ -2549,15 +2548,18 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
world.registerIsCheck(type, work.resolutionTree);
+ CheckedModeHelper helper;
FunctionElement helperElement;
if (node.isBooleanConversionCheck) {
- helperElement =
- compiler.findHelper(const SourceString('boolConversionCheck'));
+ helper =
+ const CheckedModeHelper(const SourceString('boolConversionCheck'));
} else {
- helperElement = backend.getCheckedModeHelper(type,
- typeCast: node.isCastTypeCheck);
+ helper =
+ backend.getCheckedModeHelper(type, typeCast: node.isCastTypeCheck);
}
- world.registerStaticUse(helperElement);
+
+ push(helper.generateCall(this, node));
+ /*world.registerStaticUse(helper.getElement(compiler));
List<js.Expression> arguments = <js.Expression>[];
use(node.checkedInput);
arguments.add(pop());
@@ -2573,7 +2575,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// 2 arguments implies that the method is either [propertyTypeCheck],
// [propertyTypeCast] or [assertObjectIsSubtype].
assert(!type.isMalformed);
- String additionalArgument = backend.namer.operatorIs(type.element);
+ String additionalArgument = backend.namer.operatorIsType(type);
arguments.add(js.string(additionalArgument));
} else if (parameterCount == 3) {
// 3 arguments implies that the method is [malformedTypeCheck].
@@ -2595,7 +2597,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// No additional arguments needed.
}
String helperName = backend.namer.isolateAccess(helperElement);
- push(new js.Call(new js.VariableUse(helperName), arguments));
+ push(new js.Call(new js.VariableUse(helperName), arguments));*/
}
}

Powered by Google App Engine
This is Rietveld 408576698