Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 compiler.registerInstantiatedClass(globalizedClosureElement); | 544 compiler.registerInstantiatedClass(globalizedClosureElement); |
| 545 push(new HForeignNew(globalizedClosureElement, <HInstruction>[])); | 545 push(new HForeignNew(globalizedClosureElement, <HInstruction>[])); |
| 546 } | 546 } |
| 547 | 547 |
| 548 visitIdentifier(Identifier node) { | 548 visitIdentifier(Identifier node) { |
| 549 if (node.isThis()) { | 549 if (node.isThis()) { |
| 550 if (thisDefinition === null) { | 550 if (thisDefinition === null) { |
| 551 compiler.unimplemented("Ssa.visitIdentifier.", node: node); | 551 compiler.unimplemented("Ssa.visitIdentifier.", node: node); |
| 552 } | 552 } |
| 553 stack.add(thisDefinition); | 553 stack.add(thisDefinition); |
| 554 } else if (node.isSuper()) { | |
|
ngeoffray
2012/01/10 16:52:50
maybe add at the entry of this function assert(!no
karlklose
2012/01/11 12:45:17
I generate an internal error.
| |
| 554 } else { | 555 } else { |
| 555 Element element = elements[node]; | 556 Element element = elements[node]; |
| 556 compiler.ensure(element !== null); | 557 compiler.ensure(element !== null); |
| 557 HInstruction def = definitions[element]; | 558 HInstruction def = definitions[element]; |
| 558 if (def === null) { | 559 if (def === null) { |
| 559 compiler.unimplemented("Ssa.visitIdentifier.", node: node); | 560 compiler.unimplemented("Ssa.visitIdentifier.", node: node); |
| 560 } | 561 } |
| 561 stack.add(def); | 562 stack.add(def); |
| 562 } | 563 } |
| 563 } | 564 } |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 Expression expression = link.head; | 982 Expression expression = link.head; |
| 982 disableMethodInterception(); | 983 disableMethodInterception(); |
| 983 visit(expression); | 984 visit(expression); |
| 984 enableMethodInterception(); | 985 enableMethodInterception(); |
| 985 break; | 986 break; |
| 986 default: | 987 default: |
| 987 throw "Unknown foreign: ${node.selector}"; | 988 throw "Unknown foreign: ${node.selector}"; |
| 988 } | 989 } |
| 989 } | 990 } |
| 990 | 991 |
| 992 visitSuperSend(Send node) { | |
| 993 Element element = elements[node]; | |
| 994 HStatic target = new HStatic(element); | |
| 995 HThis context = thisDefinition; | |
| 996 if (context === null) { | |
| 997 compiler.unimplemented("Ssa.visitSuperSend without thisDefinition.", | |
| 998 node: node); | |
| 999 } | |
| 1000 add(target); | |
| 1001 var inputs = <HInstruction>[]; | |
| 1002 inputs.add(target); | |
| 1003 inputs.add(context); | |
|
ngeoffray
2012/01/10 16:52:50
put target and context in the list literal.
karlklose
2012/01/11 12:45:17
Done.
| |
| 1004 addVisitedSendArgumentsToList(node.arguments, inputs); | |
| 1005 push(new HInvokeSuper(inputs)); | |
| 1006 } | |
| 1007 | |
| 991 visitStaticSend(Send node) { | 1008 visitStaticSend(Send node) { |
| 992 Element element = elements[node]; | 1009 Element element = elements[node]; |
| 993 HStatic target = new HStatic(element); | 1010 HStatic target = new HStatic(element); |
| 994 add(target); | 1011 add(target); |
| 995 var inputs = <HInstruction>[]; | 1012 var inputs = <HInstruction>[]; |
| 996 inputs.add(target); | 1013 inputs.add(target); |
| 997 addVisitedSendArgumentsToList(node.arguments, inputs); | 1014 addVisitedSendArgumentsToList(node.arguments, inputs); |
| 998 push(new HInvokeStatic(inputs)); | 1015 push(new HInvokeStatic(inputs)); |
| 999 } | 1016 } |
| 1000 | 1017 |
| 1001 visitSend(Send node) { | 1018 visitSend(Send node) { |
| 1002 if (node.selector is Operator) { | 1019 if (node.selector is Operator) { |
| 1003 visitOperatorSend(node); | 1020 visitOperatorSend(node); |
| 1004 } else if (node.isPropertyAccess) { | 1021 } else if (node.isPropertyAccess) { |
| 1005 generateGetter(node, elements[node]); | 1022 generateGetter(node, elements[node]); |
| 1006 } else if (Elements.isClosureSend(node, elements)) { | 1023 } else if (Elements.isClosureSend(node, elements)) { |
| 1007 visitClosureSend(node); | 1024 visitClosureSend(node); |
| 1025 } else if (node.receiver !== null && | |
| 1026 node.receiver.asIdentifier() !== null && | |
| 1027 node.receiver.asIdentifier().isSuper()) { | |
| 1028 visitSuperSend(node); | |
| 1008 } else { | 1029 } else { |
| 1009 Element element = elements[node]; | 1030 Element element = elements[node]; |
| 1010 if (element === null) { | 1031 if (element === null) { |
| 1011 // Example: f() with 'f' unbound. | 1032 // Example: f() with 'f' unbound. |
| 1012 // This can only happen inside an instance method. | 1033 // This can only happen inside an instance method. |
| 1013 visitDynamicSend(node); | 1034 visitDynamicSend(node); |
| 1014 } else if (element.isInstanceMember()) { | 1035 } else if (element.isInstanceMember()) { |
| 1015 // Example: f() with 'f' bound to instance method. | 1036 // Example: f() with 'f' bound to instance method. |
| 1016 visitDynamicSend(node); | 1037 visitDynamicSend(node); |
| 1017 } else if (element.kind === ElementKind.FOREIGN) { | 1038 } else if (element.kind === ElementKind.FOREIGN) { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 } | 1343 } |
| 1323 | 1344 |
| 1324 visitCatchBlock(CatchBlock node) { | 1345 visitCatchBlock(CatchBlock node) { |
| 1325 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); | 1346 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); |
| 1326 } | 1347 } |
| 1327 | 1348 |
| 1328 visitTypedef(Typedef node) { | 1349 visitTypedef(Typedef node) { |
| 1329 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1350 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1330 } | 1351 } |
| 1331 } | 1352 } |
| OLD | NEW |