Chromium Code Reviews| 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 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3348 } | 3348 } |
| 3349 | 3349 |
| 3350 HConstant addConstantString(Node node, String string) { | 3350 HConstant addConstantString(Node node, String string) { |
| 3351 DartString dartString = new DartString.literal(string); | 3351 DartString dartString = new DartString.literal(string); |
| 3352 Constant constant = constantSystem.createString(dartString, node); | 3352 Constant constant = constantSystem.createString(dartString, node); |
| 3353 return graph.addConstant(constant); | 3353 return graph.addConstant(constant); |
| 3354 } | 3354 } |
| 3355 | 3355 |
| 3356 visitTypeReferenceSend(Send node) { | 3356 visitTypeReferenceSend(Send node) { |
| 3357 Element element = elements[node]; | 3357 Element element = elements[node]; |
| 3358 HInstruction name; | 3358 if (element.isClass() || element.isTypedef()) { |
|
ngeoffray
2012/11/19 16:54:09
element.impliesType
karlklose
2012/11/20 14:04:38
Type variables imply types. The case for these is
| |
| 3359 Element helper = | 3359 // TODO(karlklose): add type representation |
| 3360 compiler.findHelper(const SourceString('createRuntimeType')); | 3360 ConstantHandler handler = compiler.constantHandler; |
| 3361 if (element.isClass()) { | 3361 Node constantNode = node.isCall ? node : node; |
|
ngeoffray
2012/11/19 16:54:09
What is this line above?
karlklose
2012/11/20 14:04:38
Debug code, removed.
| |
| 3362 String string = rti.generateRuntimeTypeString(element, 0); | 3362 Constant constant = handler.compileNodeWithDefinitions(constantNode, |
| 3363 name = addConstantString(node.selector, string); | 3363 elements); |
| 3364 } else if (element.isTypedef()) { | 3364 stack.add(graph.addConstant(constant)); |
| 3365 // TODO(karlklose): implement support for type variables in typedefs. | |
| 3366 name = addConstantString(node.selector, rti.getName(element)); | |
| 3367 } else if (element.isTypeVariable()) { | 3365 } else if (element.isTypeVariable()) { |
| 3368 // TODO(6248): implement support for type variables. | 3366 // TODO(6248): implement support for type variables. |
| 3369 compiler.unimplemented('first class type for type variable', node: node); | 3367 compiler.unimplemented('first class type for type variable', node: node); |
| 3370 } else { | 3368 } else { |
| 3371 internalError('unexpected element $element', node: node); | 3369 internalError('unexpected element kind $element', node: node); |
| 3372 } | 3370 } |
| 3373 pushInvokeHelper1(helper, name); | |
| 3374 if (node.isCall) { | 3371 if (node.isCall) { |
| 3375 // This send is of the form 'e(...)', where e is resolved to a type | 3372 // This send is of the form 'e(...)', where e is resolved to a type |
| 3376 // reference. We create a regular closure call on the result of the type | 3373 // reference. We create a regular closure call on the result of the type |
| 3377 // reference instead of creating a NoSuchMethodError to avoid pulling it | 3374 // reference instead of creating a NoSuchMethodError to avoid pulling it |
| 3378 // in if it is not used (e.g., in a try/catch). | 3375 // in if it is not used (e.g., in a try/catch). |
| 3379 HInstruction target = pop(); | 3376 HInstruction target = pop(); |
| 3380 Selector selector = elements.getSelector(node); | 3377 Selector selector = elements.getSelector(node); |
| 3381 List<HInstruction> inputs = <HInstruction>[target]; | 3378 List<HInstruction> inputs = <HInstruction>[target]; |
| 3382 addDynamicSendArgumentsToList(node, inputs); | 3379 addDynamicSendArgumentsToList(node, inputs); |
| 3383 push(new HInvokeClosure(selector, inputs)); | 3380 push(new HInvokeClosure(selector, inputs)); |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4936 new HSubGraphBlockInformation(elseBranch.graph)); | 4933 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4937 | 4934 |
| 4938 HBasicBlock conditionStartBlock = conditionBranch.block; | 4935 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4939 conditionStartBlock.setBlockFlow(info, joinBlock); | 4936 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4940 SubGraph conditionGraph = conditionBranch.graph; | 4937 SubGraph conditionGraph = conditionBranch.graph; |
| 4941 HIf branch = conditionGraph.end.last; | 4938 HIf branch = conditionGraph.end.last; |
| 4942 assert(branch is HIf); | 4939 assert(branch is HIf); |
| 4943 branch.blockInformation = conditionStartBlock.blockFlow; | 4940 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4944 } | 4941 } |
| 4945 } | 4942 } |
| OLD | NEW |