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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart

Issue 759193005: Add support for fields to the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart2js-cps 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.ir_tracer; 5 library dart2js.ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 8
9 import 'cps_ir_nodes.dart' as cps_ir hide Function; 9 import 'cps_ir_nodes.dart' as cps_ir hide Function;
10 import '../tracer.dart'; 10 import '../tracer.dart';
11 11
12 /** 12 /**
13 * If true, show LetCont expressions in output. 13 * If true, show LetCont expressions in output.
14 */ 14 */
15 const bool IR_TRACE_LET_CONT = false; 15 const bool IR_TRACE_LET_CONT = false;
16 16
17 class IRTracer extends TracerUtil implements cps_ir.Visitor { 17 class IRTracer extends TracerUtil implements cps_ir.Visitor {
18 EventSink<String> output; 18 EventSink<String> output;
19 19
20 IRTracer(this.output); 20 IRTracer(this.output);
21 21
22 visit(cps_ir.Node node) => node.accept(this); 22 visit(cps_ir.Node node) => node.accept(this);
23 23
24 void traceGraph(String name, cps_ir.FunctionDefinition graph) { 24 void traceGraph(String name, cps_ir.ExecutableDefinition graph) {
25 tag("cfg", () { 25 tag("cfg", () {
26 printProperty("name", name); 26 printProperty("name", name);
27 visitFunctionDefinition(graph); 27 visit(graph);
28 }); 28 });
29 } 29 }
30 30
31 // Temporary field used during tree walk 31 // Temporary field used during tree walk
32 Names names; 32 Names names;
33 33
34 visitFieldDefinition(cps_ir.FieldDefinition f) {
35 names = new Names();
Kevin Millikin (Google) 2014/11/26 13:31:30 Isn't this the same as the implementation of visit
sigurdm 2014/11/26 14:38:44 Done.
36 BlockCollector builder = new BlockCollector(names);
37 builder.visit(f);
38
39 printNode(builder.entry);
40 for (Block block in builder.cont2block.values) {
41 printNode(block);
42 }
43 names = null;
44 }
45
34 visitFunctionDefinition(cps_ir.FunctionDefinition f) { 46 visitFunctionDefinition(cps_ir.FunctionDefinition f) {
35 names = new Names(); 47 names = new Names();
36 BlockCollector builder = new BlockCollector(names); 48 BlockCollector builder = new BlockCollector(names);
37 builder.visit(f); 49 builder.visit(f);
38 50
39 printNode(builder.entry); 51 printNode(builder.entry);
40 for (Block block in builder.cont2block.values) { 52 for (Block block in builder.cont2block.values) {
41 printNode(block); 53 printNode(block);
42 } 54 }
43 names = null; 55 names = null;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 328
317 Block getBlock(cps_ir.Continuation c) { 329 Block getBlock(cps_ir.Continuation c) {
318 Block block = cont2block[c]; 330 Block block = cont2block[c];
319 if (block == null) { 331 if (block == null) {
320 block = new Block(names.name(c), c.parameters, c.body); 332 block = new Block(names.name(c), c.parameters, c.body);
321 cont2block[c] = block; 333 cont2block[c] = block;
322 } 334 }
323 return block; 335 return block;
324 } 336 }
325 337
338 visitFieldDefinition(cps_ir.FieldDefinition f) {
Kevin Millikin (Google) 2014/11/26 13:31:30 Same here: you could share the code but I don't ca
sigurdm 2014/11/26 14:38:44 Done.
339 entry = current_block = new Block(names.name(f), [], f.body);
340 visit(f.body);
341 }
342
326 visitFunctionDefinition(cps_ir.FunctionDefinition f) { 343 visitFunctionDefinition(cps_ir.FunctionDefinition f) {
327 entry = current_block = new Block(names.name(f), [], f.body); 344 entry = current_block = new Block(names.name(f), [], f.body);
328 visit(f.body); 345 visit(f.body);
329 } 346 }
330 347
331 visitLetPrim(cps_ir.LetPrim exp) { 348 visitLetPrim(cps_ir.LetPrim exp) {
332 visit(exp.body); 349 visit(exp.body);
333 } 350 }
334 351
335 visitLetCont(cps_ir.LetCont exp) { 352 visitLetCont(cps_ir.LetCont exp) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 400 }
384 } 401 }
385 402
386 visitContinuation(cps_ir.Continuation c) { 403 visitContinuation(cps_ir.Continuation c) {
387 var old_node = current_block; 404 var old_node = current_block;
388 current_block = getBlock(c); 405 current_block = getBlock(c);
389 visit(c.body); 406 visit(c.body);
390 current_block = old_node; 407 current_block = old_node;
391 } 408 }
392 } 409 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698