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

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

Issue 1011403003: cps-ir: Set runtime type information for new objects that require it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add parameter for each type variable to the JS-factory. Created 5 years, 9 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 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';
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 String receiver = formatReference(node.receiver); 175 String receiver = formatReference(node.receiver);
176 String callName = node.selector.name; 176 String callName = node.selector.name;
177 String args = node.arguments.map(formatReference).join(', '); 177 String args = node.arguments.map(formatReference).join(', ');
178 String kont = formatReference(node.continuation); 178 String kont = formatReference(node.continuation);
179 printStmt(dummy, 179 printStmt(dummy,
180 "InvokeMethodDirectly $receiver $callName ($args) $kont"); 180 "InvokeMethodDirectly $receiver $callName ($args) $kont");
181 } 181 }
182 182
183 visitInvokeConstructor(cps_ir.InvokeConstructor node) { 183 visitInvokeConstructor(cps_ir.InvokeConstructor node) {
184 String dummy = names.name(node); 184 String dummy = names.name(node);
185 String className = node.target.enclosingClass.name;
185 String callName; 186 String callName;
186 if (node.target.name.isEmpty) { 187 if (node.target.name.isEmpty) {
187 callName = '${node.type}'; 188 callName = '${className}';
188 } else { 189 } else {
189 callName = '${node.type}.${node.target.name}'; 190 callName = '${className}.${node.target.name}';
190 } 191 }
191 String args = node.arguments.map(formatReference).join(', '); 192 String args = node.arguments.map(formatReference).join(', ');
192 String kont = formatReference(node.continuation); 193 String kont = formatReference(node.continuation);
193 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); 194 printStmt(dummy, "InvokeConstructor $callName ($args) $kont");
194 } 195 }
195 196
196 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { 197 visitConcatenateStrings(cps_ir.ConcatenateStrings node) {
197 String dummy = names.name(node); 198 String dummy = names.name(node);
198 String args = node.arguments.map(formatReference).join(', '); 199 String args = node.arguments.map(formatReference).join(', ');
199 String kont = formatReference(node.continuation); 200 String kont = formatReference(node.continuation);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return 'GetField($object.$field)'; 302 return 'GetField($object.$field)';
302 } 303 }
303 304
304 visitCreateBox(cps_ir.CreateBox node) { 305 visitCreateBox(cps_ir.CreateBox node) {
305 return 'CreateBox'; 306 return 'CreateBox';
306 } 307 }
307 308
308 visitCreateInstance(cps_ir.CreateInstance node) { 309 visitCreateInstance(cps_ir.CreateInstance node) {
309 String className = node.classElement.name; 310 String className = node.classElement.name;
310 String arguments = node.arguments.map(formatReference).join(', '); 311 String arguments = node.arguments.map(formatReference).join(', ');
311 return 'CreateInstance $className ($arguments)'; 312 String typeInformation = node.hasTypeInformation
313 ? ' ${node.typeInformation.map(formatReference).join(', ')}' : '';
314 return 'CreateInstance $className ($arguments)$typeInformation';
312 } 315 }
313 316
314 visitIdentical(cps_ir.Identical node) { 317 visitIdentical(cps_ir.Identical node) {
315 String left = formatReference(node.left); 318 String left = formatReference(node.left);
316 String right = formatReference(node.right); 319 String right = formatReference(node.right);
317 return "Identical($left, $right)"; 320 return "Identical($left, $right)";
318 } 321 }
319 322
320 visitInterceptor(cps_ir.Interceptor node) { 323 visitInterceptor(cps_ir.Interceptor node) {
321 return "Interceptor(${formatReference(node.input)})"; 324 return "Interceptor(${formatReference(node.input)})";
(...skipping 19 matching lines...) Expand all
341 @override 344 @override
342 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { 345 visitReadTypeVariable(cps_ir.ReadTypeVariable node) {
343 return "ReadTypeVariable ${node.variable.element} " 346 return "ReadTypeVariable ${node.variable.element} "
344 "${formatReference(node.target)}"; 347 "${formatReference(node.target)}";
345 } 348 }
346 349
347 @override 350 @override
348 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { 351 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) {
349 return "ReifyRuntimeType ${formatReference(node.value)}"; 352 return "ReifyRuntimeType ${formatReference(node.value)}";
350 } 353 }
354
355 @override
356 visitTypeExpression(cps_ir.TypeExpression node) {
357 return "TypeExpression ${node.dartType} "
358 "${node.arguments.map(formatReference).join(', ')}";
359 }
351 } 360 }
352 361
353 /** 362 /**
354 * Invents (and remembers) names for Continuations, Parameters, etc. 363 * Invents (and remembers) names for Continuations, Parameters, etc.
355 * The names must match the conventions used by IR Hydra, e.g. 364 * The names must match the conventions used by IR Hydra, e.g.
356 * Continuations and Functions must have names of form B### since they 365 * Continuations and Functions must have names of form B### since they
357 * are visualized as basic blocks. 366 * are visualized as basic blocks.
358 */ 367 */
359 class Names { 368 class Names {
360 final Map<Object, String> names = {}; 369 final Map<Object, String> names = {};
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 597
589 @override 598 @override
590 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { 599 visitReadTypeVariable(cps_ir.ReadTypeVariable node) {
591 unexpectedNode(node); 600 unexpectedNode(node);
592 } 601 }
593 602
594 @override 603 @override
595 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { 604 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) {
596 unexpectedNode(node); 605 unexpectedNode(node);
597 } 606 }
607
608 @override
609 visitTypeExpression(cps_ir.TypeExpression node) {
610 unexpectedNode(node);
611 }
598 } 612 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698