| 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 class SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); | 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); |
| 7 String get name() => 'SSA code generator'; | 7 String get name() => 'SSA code generator'; |
| 8 | 8 |
| 9 | 9 |
| 10 String buildJavaScriptFunction(FunctionElement element, | 10 String buildJavaScriptFunction(FunctionElement element, |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 compiler.namer.getterName(currentLibrary, superMethod.name); | 1471 compiler.namer.getterName(currentLibrary, superMethod.name); |
| 1472 buffer.add('$className.prototype.$methodName.call()'); | 1472 buffer.add('$className.prototype.$methodName.call()'); |
| 1473 } | 1473 } |
| 1474 endExpression(JSPrecedence.CALL_PRECEDENCE); | 1474 endExpression(JSPrecedence.CALL_PRECEDENCE); |
| 1475 compiler.registerStaticUse(superMethod); | 1475 compiler.registerStaticUse(superMethod); |
| 1476 } | 1476 } |
| 1477 | 1477 |
| 1478 visitFieldGet(HFieldGet node) { | 1478 visitFieldGet(HFieldGet node) { |
| 1479 if (node.receiver !== null) { | 1479 if (node.receiver !== null) { |
| 1480 String name = | 1480 String name = |
| 1481 compiler.namer.instanceFieldName(currentLibrary, node.element.name); | 1481 compiler.namer.instanceFieldName(currentLibrary, node.name); |
| 1482 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); | 1482 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); |
| 1483 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); | 1483 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); |
| 1484 buffer.add('.'); | 1484 buffer.add('.'); |
| 1485 buffer.add(name); | 1485 buffer.add(name); |
| 1486 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); | 1486 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); |
| 1487 } else { | 1487 } else { |
| 1488 buffer.add(JsNames.getValid(node.element.name.slowToString())); | 1488 buffer.add(JsNames.getValid(node.name.slowToString())); |
| 1489 } | 1489 } |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 visitFieldSet(HFieldSet node) { | 1492 visitFieldSet(HFieldSet node) { |
| 1493 String name; | 1493 String name; |
| 1494 if (node.receiver !== null) { | 1494 if (node.receiver !== null) { |
| 1495 name = | 1495 name = |
| 1496 compiler.namer.instanceFieldName(currentLibrary, node.element.name); | 1496 compiler.namer.instanceFieldName(currentLibrary, node.name); |
| 1497 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1497 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1498 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); | 1498 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); |
| 1499 buffer.add('.'); | 1499 buffer.add('.'); |
| 1500 buffer.add(name); | 1500 buffer.add(name); |
| 1501 } else { | 1501 } else { |
| 1502 // TODO(ngeoffray): Remove the 'var' once we don't globally box | 1502 // TODO(ngeoffray): Remove the 'var' once we don't globally box |
| 1503 // variables used in a try/catch. | 1503 // variables used in a try/catch. |
| 1504 name = JsNames.getValid(node.element.name.slowToString()); | 1504 name = JsNames.getValid(node.name.slowToString()); |
| 1505 declareVariable(name); | 1505 declareVariable(name); |
| 1506 } | 1506 } |
| 1507 buffer.add(' = '); | 1507 buffer.add(' = '); |
| 1508 use(node.value, JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1508 use(node.value, JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1509 if (node.receiver !== null) { | 1509 if (node.receiver !== null) { |
| 1510 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1510 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1511 } | 1511 } |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 visitForeign(HForeign node) { | 1514 visitForeign(HForeign node) { |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 startBailoutSwitch(); | 2521 startBailoutSwitch(); |
| 2522 } | 2522 } |
| 2523 } | 2523 } |
| 2524 | 2524 |
| 2525 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2525 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2526 if (labeledBlockInfo.body.start.hasGuards()) { | 2526 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2527 endBailoutSwitch(); | 2527 endBailoutSwitch(); |
| 2528 } | 2528 } |
| 2529 } | 2529 } |
| 2530 } | 2530 } |
| OLD | NEW |