| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 tracer; | 5 library tracer; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'ssa.dart'; | 8 import 'ssa.dart'; |
| 9 import '../js_backend/js_backend.dart'; | 9 import '../js_backend/js_backend.dart'; |
| 10 import '../dart2jslib.dart'; | 10 import '../dart2jslib.dart'; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 String visitContinue(HContinue node) { | 263 String visitContinue(HContinue node) { |
| 264 HBasicBlock target = currentBlock.successors[0]; | 264 HBasicBlock target = currentBlock.successors[0]; |
| 265 if (node.label != null) { | 265 if (node.label != null) { |
| 266 return "Continue ${node.label.labelName}: (B${target.id})"; | 266 return "Continue ${node.label.labelName}: (B${target.id})"; |
| 267 } | 267 } |
| 268 return "Continue: (B${target.id})"; | 268 return "Continue: (B${target.id})"; |
| 269 } | 269 } |
| 270 | 270 |
| 271 String visitDivide(HDivide node) => handleBinaryArithmetic(node, '/'); | 271 String visitDivide(HDivide node) => handleBinaryArithmetic(node, '/'); |
| 272 | 272 |
| 273 String visitEquals(HEquals node) => visitInvokeStatic(node); | |
| 274 | |
| 275 String visitExit(HExit node) => "exit"; | 273 String visitExit(HExit node) => "exit"; |
| 276 | 274 |
| 277 String visitFieldGet(HFieldGet node) { | 275 String visitFieldGet(HFieldGet node) { |
| 278 String fieldName = node.element.name.slowToString(); | 276 String fieldName = node.element.name.slowToString(); |
| 279 return 'get ${temporaryId(node.receiver)}.$fieldName'; | 277 return 'get ${temporaryId(node.receiver)}.$fieldName'; |
| 280 } | 278 } |
| 281 | 279 |
| 282 String visitFieldSet(HFieldSet node) { | 280 String visitFieldSet(HFieldSet node) { |
| 283 String valueId = temporaryId(node.value); | 281 String valueId = temporaryId(node.value); |
| 284 String fieldName = node.element.name.slowToString(); | 282 String fieldName = node.element.name.slowToString(); |
| 285 return 'set ${temporaryId(node.receiver)}.$fieldName to $valueId'; | 283 return 'set ${temporaryId(node.receiver)}.$fieldName to $valueId'; |
| 286 } | 284 } |
| 287 | 285 |
| 288 String visitLocalGet(HLocalGet node) => visitFieldGet(node); | 286 String visitLocalGet(HLocalGet node) => visitFieldGet(node); |
| 289 String visitLocalSet(HLocalSet node) => visitFieldSet(node); | 287 String visitLocalSet(HLocalSet node) => visitFieldSet(node); |
| 290 | 288 |
| 291 String visitGoto(HGoto node) { | 289 String visitGoto(HGoto node) { |
| 292 HBasicBlock target = currentBlock.successors[0]; | 290 HBasicBlock target = currentBlock.successors[0]; |
| 293 return "Goto: (B${target.id})"; | 291 return "Goto: (B${target.id})"; |
| 294 } | 292 } |
| 295 | 293 |
| 296 String visitGreater(HGreater node) => visitInvokeStatic(node); | 294 String visitGreater(HGreater node) => handleBinaryArithmetic(node, '>'); |
| 297 String visitGreaterEqual(HGreaterEqual node) => visitInvokeStatic(node); | 295 String visitGreaterEqual(HGreaterEqual node) { |
| 298 | 296 handleBinaryArithmetic(node, '>='); |
| 299 String visitIdentity(HIdentity node) => visitInvokeStatic(node); | 297 } |
| 298 String visitIdentity(HIdentity node) => handleBinaryArithmetic(node, '==='); |
| 300 | 299 |
| 301 String visitIf(HIf node) { | 300 String visitIf(HIf node) { |
| 302 HBasicBlock thenBlock = currentBlock.successors[0]; | 301 HBasicBlock thenBlock = currentBlock.successors[0]; |
| 303 HBasicBlock elseBlock = currentBlock.successors[1]; | 302 HBasicBlock elseBlock = currentBlock.successors[1]; |
| 304 String conditionId = temporaryId(node.inputs[0]); | 303 String conditionId = temporaryId(node.inputs[0]); |
| 305 return "If ($conditionId): (B${thenBlock.id}) else (B${elseBlock.id})"; | 304 return "If ($conditionId): (B${thenBlock.id}) else (B${elseBlock.id})"; |
| 306 } | 305 } |
| 307 | 306 |
| 308 String visitGenericInvoke(String invokeType, String functionName, | 307 String visitGenericInvoke(String invokeType, String functionName, |
| 309 List<HInstruction> arguments) { | 308 List<HInstruction> arguments) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 String visitForeign(HForeign foreign) { | 376 String visitForeign(HForeign foreign) { |
| 378 return visitGenericInvoke("Foreign", "${foreign.code}", foreign.inputs); | 377 return visitGenericInvoke("Foreign", "${foreign.code}", foreign.inputs); |
| 379 } | 378 } |
| 380 | 379 |
| 381 String visitForeignNew(HForeignNew node) { | 380 String visitForeignNew(HForeignNew node) { |
| 382 return visitGenericInvoke("New", | 381 return visitGenericInvoke("New", |
| 383 "${node.element.name.slowToString()}", | 382 "${node.element.name.slowToString()}", |
| 384 node.inputs); | 383 node.inputs); |
| 385 } | 384 } |
| 386 | 385 |
| 387 String visitLess(HLess node) => visitInvokeStatic(node); | 386 String visitLess(HLess node) => handleBinaryArithmetic(node, '<'); |
| 388 String visitLessEqual(HLessEqual node) => visitInvokeStatic(node); | 387 String visitLessEqual(HLessEqual node) => handleBinaryArithmetic(node, '<='); |
| 389 | 388 |
| 390 String visitLiteralList(HLiteralList node) { | 389 String visitLiteralList(HLiteralList node) { |
| 391 StringBuffer elementsString = new StringBuffer(); | 390 StringBuffer elementsString = new StringBuffer(); |
| 392 for (int i = 0; i < node.inputs.length; i++) { | 391 for (int i = 0; i < node.inputs.length; i++) { |
| 393 if (i != 0) elementsString.add(", "); | 392 if (i != 0) elementsString.add(", "); |
| 394 elementsString.add(temporaryId(node.inputs[i])); | 393 elementsString.add(temporaryId(node.inputs[i])); |
| 395 } | 394 } |
| 396 return "Literal list: [$elementsString]"; | 395 return "Literal list: [$elementsString]"; |
| 397 } | 396 } |
| 398 | 397 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } | 543 } |
| 545 | 544 |
| 546 String visitTypeConversion(HTypeConversion node) { | 545 String visitTypeConversion(HTypeConversion node) { |
| 547 return "TypeConversion: ${temporaryId(node.checkedInput)} to ${node.type}"; | 546 return "TypeConversion: ${temporaryId(node.checkedInput)} to ${node.type}"; |
| 548 } | 547 } |
| 549 | 548 |
| 550 String visitRangeConversion(HRangeConversion node) { | 549 String visitRangeConversion(HRangeConversion node) { |
| 551 return "RangeConversion: ${node.checkedInput}"; | 550 return "RangeConversion: ${node.checkedInput}"; |
| 552 } | 551 } |
| 553 } | 552 } |
| OLD | NEW |