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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 2239193002: Rerun formatter (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../closure.dart' as closure; 7 import '../closure.dart' as closure;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show Selectors; 9 import '../common/names.dart' show Selectors;
10 import '../compile_time_constants.dart' show BackendConstantEnvironment; 10 import '../compile_time_constants.dart' show BackendConstantEnvironment;
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 // scope of the handler. The mutable bindings are dereferenced at the end 1735 // scope of the handler. The mutable bindings are dereferenced at the end
1736 // of the try block and at the beginning of the catch block, so the 1736 // of the try block and at the beginning of the catch block, so the
1737 // variables are unboxed in the catch block and at the join point. 1737 // variables are unboxed in the catch block and at the join point.
1738 1738
1739 void enterTry(IrBuilder builder) { 1739 void enterTry(IrBuilder builder) {
1740 // On entry to try of try/catch, update the builder's state to reflect the 1740 // On entry to try of try/catch, update the builder's state to reflect the
1741 // variables that have been boxed. 1741 // variables that have been boxed.
1742 void interceptJump(JumpCollector collector) { 1742 void interceptJump(JumpCollector collector) {
1743 collector.enterTry(variables.boxedOnEntry); 1743 collector.enterTry(variables.boxedOnEntry);
1744 } 1744 }
1745
1745 builder.state.breakCollectors.forEach(interceptJump); 1746 builder.state.breakCollectors.forEach(interceptJump);
1746 builder.state.continueCollectors.forEach(interceptJump); 1747 builder.state.continueCollectors.forEach(interceptJump);
1747 interceptJump(builder.state.returnCollector); 1748 interceptJump(builder.state.returnCollector);
1748 } 1749 }
1749 1750
1750 void leaveTry(IrBuilder builder) { 1751 void leaveTry(IrBuilder builder) {
1751 // On exit from try of try/catch, update the builder's state to reflect 1752 // On exit from try of try/catch, update the builder's state to reflect
1752 // the variables that are no longer boxed. 1753 // the variables that are no longer boxed.
1753 void restoreJump(JumpCollector collector) { 1754 void restoreJump(JumpCollector collector) {
1754 collector.leaveTry(); 1755 collector.leaveTry();
1755 } 1756 }
1757
1756 builder.state.breakCollectors.forEach(restoreJump); 1758 builder.state.breakCollectors.forEach(restoreJump);
1757 builder.state.continueCollectors.forEach(restoreJump); 1759 builder.state.continueCollectors.forEach(restoreJump);
1758 restoreJump(builder.state.returnCollector); 1760 restoreJump(builder.state.returnCollector);
1759 } 1761 }
1760 1762
1761 List<ir.Parameter> buildCatch(IrBuilder builder, JumpCollector join) { 1763 List<ir.Parameter> buildCatch(IrBuilder builder, JumpCollector join) {
1762 // Translate the catch clauses. Multiple clauses are translated as if 1764 // Translate the catch clauses. Multiple clauses are translated as if
1763 // they were explicitly cascaded if/else type tests. 1765 // they were explicitly cascaded if/else type tests.
1764 1766
1765 // Handlers are always translated as having both exception and stack trace 1767 // Handlers are always translated as having both exception and stack trace
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 // On entry to the try of try/finally, update the builder's state to 1868 // On entry to the try of try/finally, update the builder's state to
1867 // relfect the variables that have been boxed. Then intercept all break, 1869 // relfect the variables that have been boxed. Then intercept all break,
1868 // continue, and return jumps out of the try so that they can go to 1870 // continue, and return jumps out of the try so that they can go to
1869 // continuations that include the finally code. 1871 // continuations that include the finally code.
1870 JumpCollector interceptJump(JumpCollector collector) { 1872 JumpCollector interceptJump(JumpCollector collector) {
1871 JumpCollector result = 1873 JumpCollector result =
1872 new ForwardJumpCollector(environment, target: collector.target); 1874 new ForwardJumpCollector(environment, target: collector.target);
1873 result.enterTry(variables.boxedOnEntry); 1875 result.enterTry(variables.boxedOnEntry);
1874 return result; 1876 return result;
1875 } 1877 }
1878
1876 savedBreaks = builder.state.breakCollectors; 1879 savedBreaks = builder.state.breakCollectors;
1877 savedContinues = builder.state.continueCollectors; 1880 savedContinues = builder.state.continueCollectors;
1878 savedReturn = builder.state.returnCollector; 1881 savedReturn = builder.state.returnCollector;
1879 1882
1880 builder.state.breakCollectors = 1883 builder.state.breakCollectors =
1881 newBreaks = savedBreaks.map(interceptJump).toList(); 1884 newBreaks = savedBreaks.map(interceptJump).toList();
1882 builder.state.continueCollectors = 1885 builder.state.continueCollectors =
1883 newContinues = savedContinues.map(interceptJump).toList(); 1886 newContinues = savedContinues.map(interceptJump).toList();
1884 builder.state.returnCollector = newReturn = 1887 builder.state.returnCollector = newReturn =
1885 new ForwardJumpCollector(environment, hasExtraArgument: true) 1888 new ForwardJumpCollector(environment, hasExtraArgument: true)
1886 ..enterTry(variables.boxedOnEntry); 1889 ..enterTry(variables.boxedOnEntry);
1887 } 1890 }
1888 1891
1889 void leaveTry(IrBuilder builder) { 1892 void leaveTry(IrBuilder builder) {
1890 // On exit from the try of try/finally, update the builder's state to 1893 // On exit from the try of try/finally, update the builder's state to
1891 // reflect the variables that are no longer boxed and restore the 1894 // reflect the variables that are no longer boxed and restore the
1892 // original, unintercepted break, continue, and return targets. 1895 // original, unintercepted break, continue, and return targets.
1893 void restoreJump(JumpCollector collector) { 1896 void restoreJump(JumpCollector collector) {
1894 collector.leaveTry(); 1897 collector.leaveTry();
1895 } 1898 }
1899
1896 newBreaks.forEach(restoreJump); 1900 newBreaks.forEach(restoreJump);
1897 newContinues.forEach(restoreJump); 1901 newContinues.forEach(restoreJump);
1898 newReturn.leaveTry(); 1902 newReturn.leaveTry();
1899 builder.state.breakCollectors = savedBreaks; 1903 builder.state.breakCollectors = savedBreaks;
1900 builder.state.continueCollectors = savedContinues; 1904 builder.state.continueCollectors = savedContinues;
1901 builder.state.returnCollector = savedReturn; 1905 builder.state.returnCollector = savedReturn;
1902 } 1906 }
1903 1907
1904 List<ir.Parameter> buildCatch(IrBuilder builder, JumpCollector join) { 1908 List<ir.Parameter> buildCatch(IrBuilder builder, JumpCollector join) {
1905 // The catch block of the try/catch used for try/finally is the finally 1909 // The catch block of the try/catch used for try/finally is the finally
(...skipping 13 matching lines...) Expand all
1919 List<ir.Continuation> exits = <ir.Continuation>[join.continuation]; 1923 List<ir.Continuation> exits = <ir.Continuation>[join.continuation];
1920 void addJump( 1924 void addJump(
1921 JumpCollector newCollector, JumpCollector originalCollector) { 1925 JumpCollector newCollector, JumpCollector originalCollector) {
1922 if (newCollector.isEmpty) return; 1926 if (newCollector.isEmpty) return;
1923 IrBuilder builder = makeDelimitedBuilder(newCollector.environment); 1927 IrBuilder builder = makeDelimitedBuilder(newCollector.environment);
1924 buildFinallyBlock(builder); 1928 buildFinallyBlock(builder);
1925 if (builder.isOpen) builder.jumpTo(originalCollector); 1929 if (builder.isOpen) builder.jumpTo(originalCollector);
1926 newCollector.continuation.body = builder.root; 1930 newCollector.continuation.body = builder.root;
1927 exits.add(newCollector.continuation); 1931 exits.add(newCollector.continuation);
1928 } 1932 }
1933
1929 for (int i = 0; i < newBreaks.length; ++i) { 1934 for (int i = 0; i < newBreaks.length; ++i) {
1930 addJump(newBreaks[i], savedBreaks[i]); 1935 addJump(newBreaks[i], savedBreaks[i]);
1931 } 1936 }
1932 for (int i = 0; i < newContinues.length; ++i) { 1937 for (int i = 0; i < newContinues.length; ++i) {
1933 addJump(newContinues[i], savedContinues[i]); 1938 addJump(newContinues[i], savedContinues[i]);
1934 } 1939 }
1935 if (!newReturn.isEmpty) { 1940 if (!newReturn.isEmpty) {
1936 IrBuilder builder = makeDelimitedBuilder(newReturn.environment); 1941 IrBuilder builder = makeDelimitedBuilder(newReturn.environment);
1937 ir.Primitive value = builder.environment.discard(1); 1942 ir.Primitive value = builder.environment.discard(1);
1938 buildFinallyBlock(builder); 1943 buildFinallyBlock(builder);
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 this.sourceInformation}); 2923 this.sourceInformation});
2919 } 2924 }
2920 2925
2921 class SwitchCaseInfo { 2926 class SwitchCaseInfo {
2922 final SubbuildFunction buildCondition; 2927 final SubbuildFunction buildCondition;
2923 final SubbuildFunction buildBody; 2928 final SubbuildFunction buildBody;
2924 final SourceInformation sourceInformation; 2929 final SourceInformation sourceInformation;
2925 2930
2926 SwitchCaseInfo(this.buildCondition, this.buildBody, this.sourceInformation); 2931 SwitchCaseInfo(this.buildCondition, this.buildBody, this.sourceInformation);
2927 } 2932 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/bounds_checker.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698