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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/js_tree_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/js_backend/codegen/js_tree_builder.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart b/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart
deleted file mode 100644
index b5482ce8f005103df3fa437f79ba5d47594fd8fb..0000000000000000000000000000000000000000
--- a/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library js_tree_ir_builder;
-
-import '../../tree_ir/tree_ir_builder.dart' show Builder;
-import 'glue.dart' show Glue;
-import '../../dart2jslib.dart' show Selector, InternalErrorFunction;
-import '../../elements/elements.dart';
-import '../../cps_ir/cps_ir_nodes.dart' as cps_ir;
-import '../../tree_ir/tree_ir_nodes.dart';
-
-/// Subclass of [Builder] that can translate nodes which are specific to the
-/// JavaScript backend.
-class JsTreeBuilder extends Builder {
- final Glue _glue;
- final Element identicalFunction;
-
- JsTreeBuilder(
- InternalErrorFunction internalError,
- this.identicalFunction,
- this._glue,
- [Builder parent])
- : super(internalError, parent);
-
- JsTreeBuilder createInnerBuilder() {
- return new JsTreeBuilder(internalError, identicalFunction, _glue, this);
- }
-
- Selector get identicalSelector {
- return new Selector.call('identical', null, 2);
- }
-
- Expression visitIdentical(cps_ir.Identical node) {
- return new InvokeStatic(
- identicalFunction,
- identicalSelector,
- <Expression>[getVariableUse(node.left),
- getVariableUse(node.right)])..isEffectivelyConstant = true;
- }
-
- Expression visitInterceptor(cps_ir.Interceptor node) {
- Element getInterceptor = _glue.getInterceptorMethod;
- String name = _glue.getInterceptorName(node.interceptedClasses);
- Selector selector = new Selector.call(name, null, 1);
- _glue.registerUseInterceptorInCodegen();
- return new InvokeStatic(
- getInterceptor,
- selector,
- <Expression>[getVariableUse(node.input)])..isEffectivelyConstant = true;
- }
-
- Expression visitGetField(cps_ir.GetField node) {
- return new GetField(getVariableUse(node.object), node.field);
- }
-
- Statement visitSetField(cps_ir.SetField node) {
- SetField setField =
- new SetField(getVariableUse(node.object),
- node.field,
- getVariableUse(node.value));
- return new ExpressionStatement(setField, visit(node.body));
- }
-
- Expression visitCreateBox(cps_ir.CreateBox node) {
- return new CreateBox();
- }
-
- Expression visitCreateInstance(cps_ir.CreateInstance node) {
- return new CreateInstance(
- node.classElement,
- node.arguments.map(getVariableUse).toList(growable: false),
- node.typeInformation.map(getVariableUse).toList(growable: false));
- }
-
- Expression visitCreateInvocationMirror(cps_ir.CreateInvocationMirror node) {
- return new CreateInvocationMirror(node.selector,
- node.arguments.map(getVariableUse).toList(growable: false));
- }
-
- Statement visitForeignCode(cps_ir.ForeignCode node) {
- if (node.codeTemplate.isExpression) {
- Expression foreignCode = new ForeignExpression(
- node.codeTemplate,
- node.type,
- node.arguments.map(getVariableUse).toList(growable: false),
- node.nativeBehavior,
- node.dependency);
- return continueWithExpression(node.continuation, foreignCode);
- } else {
- assert(node.continuation == null);
- return new ForeignStatement(
- node.codeTemplate,
- node.type,
- node.arguments.map(getVariableUse).toList(growable: false),
- node.nativeBehavior,
- node.dependency);
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698