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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.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/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index 7042defa0147a93247b1c3aa7e22891a46c4a5e2..d7453dbf44427ebe325ca5bd2e62d4ffeb7dfa05 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -593,6 +593,16 @@ class CodeGenerator extends tree_ir.StatementVisitor
}
@override
+ js.Expression visitInterceptor(tree_ir.Interceptor node) {
+ glue.registerUseInterceptorInCodegen();
+ registry.registerSpecializedGetInterceptor(node.interceptedClasses);
+ String helperName = glue.getInterceptorName(node.interceptedClasses);
+ js.Expression globalHolder = glue.getInterceptorLibrary();
+ return js.js('#.#(#)',
+ [globalHolder, helperName, visitExpression(node.input)]);
+ }
+
+ @override
js.Expression visitGetField(tree_ir.GetField node) {
return new js.PropertyAccess.field(
visitExpression(node.object),
@@ -717,6 +727,9 @@ class CodeGenerator extends tree_ir.StatementVisitor
case BuiltinOperator.StringConcatenate:
if (args.isEmpty) return js.string('');
return args.reduce((e1,e2) => new js.Binary('+', e1, e2));
+ case BuiltinOperator.Identical:
+ registry.registerStaticInvocation(glue.identicalFunction);
+ return buildStaticHelperInvocation(glue.identicalFunction, args);
case BuiltinOperator.StrictEq:
return new js.Binary('===', args[0], args[1]);
case BuiltinOperator.StrictNeq:

Powered by Google App Engine
This is Rietveld 408576698