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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart

Issue 795933005: Create a Tree IR builder for JavaScript specific nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move identicalFunction. Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library js_tree_ir_builder;
6
7 import '../../tree_ir/tree_ir_builder.dart' show Builder;
8 import 'glue.dart' show Glue;
9 import '../../dart2jslib.dart' show Selector, InternalErrorFunction;
10 import '../../elements/elements.dart';
11 import '../../cps_ir/cps_ir_nodes.dart' as cps_ir;
12 import '../../tree_ir/tree_ir_nodes.dart';
13
14 /// Subclass of [Builder] that can translate nodes which are specific to the
15 /// JavaScript backend.
16 class JsTreeBuilder extends Builder {
17 final Glue _glue;
18 final Element identicalFunction;
19
20 JsTreeBuilder(
21 InternalErrorFunction internalError,
22 this.identicalFunction,
23 this._glue,
24 [Builder parent])
25 : super(internalError, parent);
26
27 JsTreeBuilder createInnerBuilder() {
28 return new JsTreeBuilder(internalError, identicalFunction, _glue, this);
29 }
30
31 Selector get identicalSelector {
32 return new Selector.call('identical', null, 2);
33 }
34
35 Expression visitIdentical(cps_ir.Identical node) {
36 return new InvokeStatic(
37 identicalFunction,
38 identicalSelector,
39 <Expression>[getVariableReference(node.left),
40 getVariableReference(node.right)]);
41 }
42
43 Expression visitInterceptor(cps_ir.Interceptor node) {
44 Element getInterceptor = _glue.getInterceptorMethod;
45 _glue.registerUseInterceptorInCodegen();
46 return new InvokeStatic(
47 getInterceptor,
48 new Selector.fromElement(getInterceptor),
49 <Expression>[getVariableReference(node.input)]);
50 }
51 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698