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

Side by Side Diff: dart/frog/leg/ssa/builder.dart

Issue 9689045: Library privacy. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
« no previous file with comments | « dart/frog/leg/scanner/token.dart ('k') | dart/frog/leg/ssa/codegen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 HBasicBlock current; 699 HBasicBlock current;
700 // The most recently opened block. Has the same value as [current] while 700 // The most recently opened block. Has the same value as [current] while
701 // the block is open, but unlike [current], it isn't cleared when the current 701 // the block is open, but unlike [current], it isn't cleared when the current
702 // block is closed. 702 // block is closed.
703 HBasicBlock lastOpenedBlock; 703 HBasicBlock lastOpenedBlock;
704 704
705 // Linked list of active break-handlers. Will be removed in the order 705 // Linked list of active break-handlers. Will be removed in the order
706 // they are added. 706 // they are added.
707 BreakHandler currentBreakHandler = const NullBreakHandler(); 707 BreakHandler currentBreakHandler = const NullBreakHandler();
708 708
709 LibraryElement get currentLibrary() => work.element.getLibrary();
710
709 SsaBuilder(Compiler compiler, WorkItem work) 711 SsaBuilder(Compiler compiler, WorkItem work)
710 : this.compiler = compiler, 712 : this.compiler = compiler,
711 this.work = work, 713 this.work = work,
712 interceptors = compiler.builder.interceptors, 714 interceptors = compiler.builder.interceptors,
713 methodInterceptionEnabled = true, 715 methodInterceptionEnabled = true,
714 elements = work.resolutionTree, 716 elements = work.resolutionTree,
715 graph = new HGraph(), 717 graph = new HGraph(),
716 stack = new List<HInstruction>(), 718 stack = new List<HInstruction>(),
717 breakTargets = new Map<TargetElement, BreakHandler>() { 719 breakTargets = new Map<TargetElement, BreakHandler>() {
718 localsHandler = new LocalsHandler(this); 720 localsHandler = new LocalsHandler(this);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 // TODO(floitsch): find better way to detect that constructor body is 908 // TODO(floitsch): find better way to detect that constructor body is
907 // empty. 909 // empty.
908 if (constructor is SynthesizedConstructorElement) continue; 910 if (constructor is SynthesizedConstructorElement) continue;
909 ConstructorBodyElement body = getConstructorBody(classElement, 911 ConstructorBodyElement body = getConstructorBody(classElement,
910 constructor); 912 constructor);
911 List bodyCallInputs = <HInstruction>[]; 913 List bodyCallInputs = <HInstruction>[];
912 bodyCallInputs.add(newObject); 914 bodyCallInputs.add(newObject);
913 body.functionParameters.forEachParameter((parameter) { 915 body.functionParameters.forEachParameter((parameter) {
914 bodyCallInputs.add(localsHandler.readLocal(parameter)); 916 bodyCallInputs.add(localsHandler.readLocal(parameter));
915 }); 917 });
916 SourceString methodName = body.name; 918 // TODO(ahe): The constructor name is statically resolved. See
919 // SsaCodeGenerator.visitInvokeDynamicMethod. Is there a cleaner
920 // way to do this?
921 SourceString methodName = new SourceString(compiler.namer.getName(body));
917 add(new HInvokeDynamicMethod(null, methodName, bodyCallInputs)); 922 add(new HInvokeDynamicMethod(null, methodName, bodyCallInputs));
918 } 923 }
919 close(new HReturn(newObject)).addSuccessor(graph.exit); 924 close(new HReturn(newObject)).addSuccessor(graph.exit);
920 return closeFunction(); 925 return closeFunction();
921 } 926 }
922 927
923 void openFunction(FunctionElement functionElement, 928 void openFunction(FunctionElement functionElement,
924 FunctionExpression node) { 929 FunctionExpression node) {
925 HBasicBlock block = graph.addNewBlock(); 930 HBasicBlock block = graph.addNewBlock();
926 open(graph.entry); 931 open(graph.entry);
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 visit(expression); 1741 visit(expression);
1737 enableMethodInterception(); 1742 enableMethodInterception();
1738 break; 1743 break;
1739 case "JS_HAS_EQUALS": 1744 case "JS_HAS_EQUALS":
1740 List<HInstruction> inputs = <HInstruction>[]; 1745 List<HInstruction> inputs = <HInstruction>[];
1741 if (!node.arguments.tail.isEmpty()) { 1746 if (!node.arguments.tail.isEmpty()) {
1742 compiler.cancel('More than one expression in JS_HAS_EQUALS()'); 1747 compiler.cancel('More than one expression in JS_HAS_EQUALS()');
1743 } 1748 }
1744 addGenericSendArgumentsToList(node.arguments, inputs); 1749 addGenericSendArgumentsToList(node.arguments, inputs);
1745 String name = compiler.namer.instanceMethodName( 1750 String name = compiler.namer.instanceMethodName(
1746 Namer.OPERATOR_EQUALS, 1); 1751 currentLibrary, Namer.OPERATOR_EQUALS, 1);
1747 push(new HForeign(new DartString.literal('!!#.$name'), 1752 push(new HForeign(new DartString.literal('!!#.$name'),
1748 const LiteralDartString('bool'), 1753 const LiteralDartString('bool'),
1749 inputs)); 1754 inputs));
1750 break; 1755 break;
1751 case "native": 1756 case "native":
1752 native.handleSsaNative(this, node); 1757 native.handleSsaNative(this, node);
1753 break; 1758 break;
1754 default: 1759 default:
1755 throw "Unknown foreign: ${node.selector}"; 1760 throw "Unknown foreign: ${node.selector}";
1756 } 1761 }
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 buildBody() { 2551 buildBody() {
2547 // TODO(lrn): Make sure to take continue into account. 2552 // TODO(lrn): Make sure to take continue into account.
2548 visit(body); 2553 visit(body);
2549 if (isAborted()) { 2554 if (isAborted()) {
2550 compiler.reportWarning(body, "aborting loop body"); 2555 compiler.reportWarning(body, "aborting loop body");
2551 } 2556 }
2552 } 2557 }
2553 handleIf(buildBody, null); 2558 handleIf(buildBody, null);
2554 } 2559 }
2555 } 2560 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/token.dart ('k') | dart/frog/leg/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698