Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: dart/lib/compiler/implementation/ssa/builder.dart

Issue 10408059: Move registering to the enqueuer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 if (nestedClosureData === null) { 1480 if (nestedClosureData === null) {
1481 // TODO(floitsch): we can only assume that the reason for not having a 1481 // TODO(floitsch): we can only assume that the reason for not having a
1482 // closure data here is, because the function is inside an initializer. 1482 // closure data here is, because the function is inside an initializer.
1483 compiler.unimplemented("Closures inside initializers", node: node); 1483 compiler.unimplemented("Closures inside initializers", node: node);
1484 } 1484 }
1485 assert(nestedClosureData !== null); 1485 assert(nestedClosureData !== null);
1486 assert(nestedClosureData.closureClassElement !== null); 1486 assert(nestedClosureData.closureClassElement !== null);
1487 ClassElement closureClassElement = 1487 ClassElement closureClassElement =
1488 nestedClosureData.closureClassElement; 1488 nestedClosureData.closureClassElement;
1489 FunctionElement callElement = nestedClosureData.callElement; 1489 FunctionElement callElement = nestedClosureData.callElement;
1490 // TODO(ahe): This should be registered in codegen, not here.
1490 compiler.enqueuer.codegen.addToWorkList(callElement, elements); 1491 compiler.enqueuer.codegen.addToWorkList(callElement, elements);
1491 compiler.registerInstantiatedClass(closureClassElement); 1492 // TODO(ahe): This should be registered in codegen, not here.
1493 compiler.enqueuer.codegen.registerInstantiatedClass(closureClassElement);
1492 assert(closureClassElement.members.isEmpty()); 1494 assert(closureClassElement.members.isEmpty());
1493 1495
1494 List<HInstruction> capturedVariables = <HInstruction>[]; 1496 List<HInstruction> capturedVariables = <HInstruction>[];
1495 for (Element member in closureClassElement.backendMembers) { 1497 for (Element member in closureClassElement.backendMembers) {
1496 // The backendMembers also contains the call method(s). We are only 1498 // The backendMembers also contains the call method(s). We are only
1497 // interested in the fields. 1499 // interested in the fields.
1498 if (member.kind == ElementKind.FIELD) { 1500 if (member.kind == ElementKind.FIELD) {
1499 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; 1501 Element capturedLocal = nestedClosureData.capturedFieldMapping[member];
1500 assert(capturedLocal != null); 1502 assert(capturedLocal != null);
1501 capturedVariables.add(localsHandler.readLocal(capturedLocal)); 1503 capturedVariables.add(localsHandler.readLocal(capturedLocal));
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 push(new HStatic(element)); 1823 push(new HStatic(element));
1822 if (element.kind == ElementKind.GETTER) { 1824 if (element.kind == ElementKind.GETTER) {
1823 push(new HInvokeStatic(selector, <HInstruction>[pop()])); 1825 push(new HInvokeStatic(selector, <HInstruction>[pop()]));
1824 } 1826 }
1825 } 1827 }
1826 } else if (Elements.isInstanceSend(send, elements)) { 1828 } else if (Elements.isInstanceSend(send, elements)) {
1827 HInstruction receiver = generateInstanceSendReceiver(send); 1829 HInstruction receiver = generateInstanceSendReceiver(send);
1828 generateInstanceGetterWithCompiledReceiver(send, receiver); 1830 generateInstanceGetterWithCompiledReceiver(send, receiver);
1829 } else if (Elements.isStaticOrTopLevelFunction(element)) { 1831 } else if (Elements.isStaticOrTopLevelFunction(element)) {
1830 push(new HStatic(element)); 1832 push(new HStatic(element));
1831 compiler.registerGetOfStaticFunction(element); 1833 // TODO(ahe): This should be registered in codegen.
1834 compiler.enqueuer.codegen.registerGetOfStaticFunction(element);
1832 } else { 1835 } else {
1833 stack.add(localsHandler.readLocal(element)); 1836 stack.add(localsHandler.readLocal(element));
1834 } 1837 }
1835 } 1838 }
1836 1839
1837 void generateInstanceSetterWithCompiledReceiver(Send send, 1840 void generateInstanceSetterWithCompiledReceiver(Send send,
1838 HInstruction receiver, 1841 HInstruction receiver,
1839 HInstruction value) { 1842 HInstruction value) {
1840 assert(Elements.isInstanceSend(send, elements)); 1843 assert(Elements.isInstanceSend(send, elements));
1841 SourceString dartSetterName = send.selector.asIdentifier().source; 1844 SourceString dartSetterName = send.selector.asIdentifier().source;
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 <HInstruction>[target, input], 3379 <HInstruction>[target, input],
3377 HType.STRING)); 3380 HType.STRING));
3378 return builder.pop(); 3381 return builder.pop();
3379 } 3382 }
3380 3383
3381 HInstruction result(Node node) { 3384 HInstruction result(Node node) {
3382 flushLiterals(node); 3385 flushLiterals(node);
3383 return prefix; 3386 return prefix;
3384 } 3387 }
3385 } 3388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698