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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1204733002: dart2js cps: Make Identical a built-in and add Interceptor to Tree IR. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index 647f48fcafcb6dc8a64a1220a79d81984927ffab..c491237d77c5ef5996ee166a103224f0b060894f 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -1645,8 +1645,8 @@ abstract class IrBuilder {
casesBuilder.state.breakCollectors.add(join);
for (SwitchCaseInfo caseInfo in cases) {
buildConditionsFrom(int index) => (IrBuilder builder) {
- ir.Primitive comparison = builder.addPrimitive(
- new ir.Identical(value, caseInfo.constants[index]));
+ ir.Primitive comparison = builder.buildIdentical(
+ value, caseInfo.constants[index]);
return (index == caseInfo.constants.length - 1)
? comparison
: builder.buildLogicalOperator(
@@ -2091,6 +2091,11 @@ abstract class IrBuilder {
// is different on at least two paths.
return join.continuation.parameters.last;
}
+
+ ir.Primitive buildIdentical(ir.Primitive x, ir.Primitive y) {
+ return addPrimitive(new ir.ApplyBuiltinOperator(
+ ir.BuiltinOperator.Identical, <ir.Primitive>[x, y]));
+ }
}
/// State shared between JsIrBuilders within the same function.
@@ -2509,7 +2514,7 @@ class JsIrBuilder extends IrBuilder {
}
if (type is InterfaceType && type.element == program.nullClass) {
// `x is Null` is true if and only if x is null.
- return addPrimitive(new ir.Identical(value, buildNullConstant()));
+ return _buildCheckNull(value);
}
return addPrimitive(new ir.TypeTest(value, type, typeArguments));
} else {
@@ -2535,8 +2540,7 @@ class JsIrBuilder extends IrBuilder {
/// Creates a type test checking whether [value] is null.
ir.Primitive _buildCheckNull(ir.Primitive value) {
assert(isOpen);
- ir.Primitive right = buildNullConstant();
- return addPrimitive(new ir.Identical(value, right));
+ return buildIdentical(value, buildNullConstant());
}
/// Convert the given value to a string.

Powered by Google App Engine
This is Rietveld 408576698