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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 class Interceptors { | 7 class Interceptors { |
8 Compiler compiler; | 8 Compiler compiler; |
9 Interceptors(Compiler this.compiler); | 9 Interceptors(Compiler this.compiler); |
10 | 10 |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1294 */ | 1294 */ |
1295 void buildFieldInitializers(ClassElement classElement, | 1295 void buildFieldInitializers(ClassElement classElement, |
1296 Map<Element, HInstruction> fieldValues) { | 1296 Map<Element, HInstruction> fieldValues) { |
1297 assert(invariant(classElement, classElement.isImplementation)); | 1297 assert(invariant(classElement, classElement.isImplementation)); |
1298 classElement.forEachInstanceField( | 1298 classElement.forEachInstanceField( |
1299 (ClassElement enclosingClass, Element member) { | 1299 (ClassElement enclosingClass, Element member) { |
1300 TreeElements definitions = compiler.analyzeElement(member); | 1300 TreeElements definitions = compiler.analyzeElement(member); |
1301 Node node = member.parseNode(compiler); | 1301 Node node = member.parseNode(compiler); |
1302 SendSet assignment = node.asSendSet(); | 1302 SendSet assignment = node.asSendSet(); |
1303 HInstruction value; | 1303 HInstruction value; |
1304 if (assignment === null) { | 1304 if (assignment == null) { |
1305 value = graph.addConstantNull(constantSystem); | 1305 value = graph.addConstantNull(constantSystem); |
1306 } else { | 1306 } else { |
1307 Node right = assignment.arguments.head; | 1307 Node right = assignment.arguments.head; |
1308 TreeElements savedElements = elements; | 1308 TreeElements savedElements = elements; |
1309 elements = definitions; | 1309 elements = definitions; |
1310 right.accept(this); | 1310 right.accept(this); |
1311 elements = savedElements; | 1311 elements = savedElements; |
1312 value = pop(); | 1312 value = pop(); |
1313 } | 1313 } |
1314 fieldValues[member] = value; | 1314 fieldValues[member] = value; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1453 Element checkResultElement = | 1453 Element checkResultElement = |
1454 localsHandler.closureData.parametersWithSentinel[element]; | 1454 localsHandler.closureData.parametersWithSentinel[element]; |
1455 if (currentElement.isGenerativeConstructorBody()) { | 1455 if (currentElement.isGenerativeConstructorBody()) { |
1456 // A generative constructor body receives extra parameters that | 1456 // A generative constructor body receives extra parameters that |
1457 // indicate if a parameter was passed to the factory. | 1457 // indicate if a parameter was passed to the factory. |
1458 check = addParameter(checkResultElement); | 1458 check = addParameter(checkResultElement); |
1459 } else { | 1459 } else { |
1460 // This is the code we emit for a parameter that is being checked | 1460 // This is the code we emit for a parameter that is being checked |
1461 // on whether it was given at value at the call site: | 1461 // on whether it was given at value at the call site: |
1462 // | 1462 // |
1463 // foo([a = 42) { | 1463 // foo([a = 42) { |
Lasse Reichstein Nielsen
2012/11/12 13:10:41
missing ']'.
floitsch
2012/11/12 22:18:43
Done.
| |
1464 // if (?a) print('parameter passed $a'); | 1464 // if (?a) print('parameter passed $a'); |
1465 // } | 1465 // } |
1466 // | 1466 // |
1467 // foo([a = 42]) { | 1467 // foo([a = 42]) { |
1468 // var t1 = a === sentinel; | 1468 // var t1 = identical(a, sentinel); |
1469 // if (t1) a = 42; | 1469 // if (t1) a = 42; |
1470 // if (!t1) print('parameter passed ' + a); | 1470 // if (!t1) print('parameter passed ' + a); |
1471 // } | 1471 // } |
1472 | 1472 |
1473 // Fetch the original default value of [element]; | 1473 // Fetch the original default value of [element]; |
1474 ConstantHandler handler = compiler.constantHandler; | 1474 ConstantHandler handler = compiler.constantHandler; |
1475 Constant constant = handler.compileVariable(element); | 1475 Constant constant = handler.compileVariable(element); |
1476 HConstant defaultValue = constant == null | 1476 HConstant defaultValue = constant == null |
1477 ? graph.addConstantNull(constantSystem) | 1477 ? graph.addConstantNull(constantSystem) |
1478 : graph.addConstant(constant); | 1478 : graph.addConstant(constant); |
(...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4760 new HSubGraphBlockInformation(elseBranch.graph)); | 4760 new HSubGraphBlockInformation(elseBranch.graph)); |
4761 | 4761 |
4762 HBasicBlock conditionStartBlock = conditionBranch.block; | 4762 HBasicBlock conditionStartBlock = conditionBranch.block; |
4763 conditionStartBlock.setBlockFlow(info, joinBlock); | 4763 conditionStartBlock.setBlockFlow(info, joinBlock); |
4764 SubGraph conditionGraph = conditionBranch.graph; | 4764 SubGraph conditionGraph = conditionBranch.graph; |
4765 HIf branch = conditionGraph.end.last; | 4765 HIf branch = conditionGraph.end.last; |
4766 assert(branch is HIf); | 4766 assert(branch is HIf); |
4767 branch.blockInformation = conditionStartBlock.blockFlow; | 4767 branch.blockInformation = conditionStartBlock.blockFlow; |
4768 } | 4768 } |
4769 } | 4769 } |
OLD | NEW |