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

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

Issue 1128903012: dart2js cps: Fix for try/catch. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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) 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 '../constants/constant_system.dart'; 7 import '../constants/constant_system.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../constants/values.dart' show PrimitiveConstantValue; 9 import '../constants/values.dart' show PrimitiveConstantValue;
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 elseContinuation)); 1859 elseContinuation));
1860 catchBody = 1860 catchBody =
1861 new ir.LetCont(checkType, 1861 new ir.LetCont(checkType,
1862 new ir.TypeOperator(exceptionParameter, clause.type, checkType, 1862 new ir.TypeOperator(exceptionParameter, clause.type, checkType,
1863 isTypeTest: true)); 1863 isTypeTest: true));
1864 } 1864 }
1865 1865
1866 List<ir.Parameter> catchParameters = 1866 List<ir.Parameter> catchParameters =
1867 <ir.Parameter>[exceptionParameter, traceParameter]; 1867 <ir.Parameter>[exceptionParameter, traceParameter];
1868 ir.Continuation catchContinuation = new ir.Continuation(catchParameters); 1868 ir.Continuation catchContinuation = new ir.Continuation(catchParameters);
1869 catchContinuation.body = catchBody; 1869 catchBuilder.add(catchBody);
1870 catchContinuation.body = catchBuilder._root;
asgerf 2015/05/19 09:54:55 The fragment in catchBuilder was previously lost i
1870 1871
1871 tryCatchBuilder.add( 1872 tryCatchBuilder.add(
1872 new ir.LetHandler(catchContinuation, tryBuilder._root)); 1873 new ir.LetHandler(catchContinuation, tryBuilder._root));
1873 add(new ir.LetCont(join.continuation, tryCatchBuilder._root)); 1874 add(new ir.LetCont(join.continuation, tryCatchBuilder._root));
1874 environment = join.environment; 1875 environment = join.environment;
1875 } 1876 }
1876 1877
1877 /// Create a return statement `return value;` or `return;` if [value] is 1878 /// Create a return statement `return value;` or `return;` if [value] is
1878 /// null. 1879 /// null.
1879 void buildReturn([ir.Primitive value]) { 1880 void buildReturn([ir.Primitive value]) {
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 /// Create a read access of [local] variable or parameter. 2476 /// Create a read access of [local] variable or parameter.
2476 @override 2477 @override
2477 ir.Primitive _buildLocalGet(LocalElement local) { 2478 ir.Primitive _buildLocalGet(LocalElement local) {
2478 assert(isOpen); 2479 assert(isOpen);
2479 ClosureLocation location = jsState.boxedVariables[local]; 2480 ClosureLocation location = jsState.boxedVariables[local];
2480 if (location != null) { 2481 if (location != null) {
2481 ir.Primitive result = new ir.GetField(environment.lookup(location.box), 2482 ir.Primitive result = new ir.GetField(environment.lookup(location.box),
2482 location.field); 2483 location.field);
2483 result.useElementAsHint(local); 2484 result.useElementAsHint(local);
2484 return addPrimitive(result); 2485 return addPrimitive(result);
2486 } else if (isInMutableVariable(local)) {
2487 return addPrimitive(new ir.GetMutableVariable(getMutableVariable(local)));
asgerf 2015/05/19 09:54:55 This is independent of the other change.
2485 } else { 2488 } else {
2486 return environment.lookup(local); 2489 return environment.lookup(local);
2487 } 2490 }
2488 } 2491 }
2489 2492
2490 /// Create a write access to [local] variable or parameter with the provided 2493 /// Create a write access to [local] variable or parameter with the provided
2491 /// [value]. 2494 /// [value].
2492 @override 2495 @override
2493 ir.Primitive buildLocalVariableSet(LocalElement local, ir.Primitive value) { 2496 ir.Primitive buildLocalVariableSet(LocalElement local, ir.Primitive value) {
2494 assert(isOpen); 2497 assert(isOpen);
2495 ClosureLocation location = jsState.boxedVariables[local]; 2498 ClosureLocation location = jsState.boxedVariables[local];
2496 if (location != null) { 2499 if (location != null) {
2497 add(new ir.SetField(environment.lookup(location.box), 2500 add(new ir.SetField(environment.lookup(location.box),
2498 location.field, 2501 location.field,
2499 value)); 2502 value));
2503 } else if (isInMutableVariable(local)) {
2504 add(new ir.SetMutableVariable(getMutableVariable(local), value));
2500 } else { 2505 } else {
2501 value.useElementAsHint(local); 2506 value.useElementAsHint(local);
2502 environment.update(local, value); 2507 environment.update(local, value);
2503 } 2508 }
2504 return value; 2509 return value;
2505 } 2510 }
2506 2511
2507 void _enterForLoopInitializer(ClosureScope scope, 2512 void _enterForLoopInitializer(ClosureScope scope,
2508 List<LocalElement> loopVariables) { 2513 List<LocalElement> loopVariables) {
2509 if (scope == null) return; 2514 if (scope == null) return;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 } 2740 }
2736 2741
2737 /// Synthetic parameter to a JavaScript factory method that takes the type 2742 /// Synthetic parameter to a JavaScript factory method that takes the type
2738 /// argument given for the type variable [variable]. 2743 /// argument given for the type variable [variable].
2739 class TypeInformationParameter implements Local { 2744 class TypeInformationParameter implements Local {
2740 final TypeVariableElement variable; 2745 final TypeVariableElement variable;
2741 final ExecutableElement executableContext; 2746 final ExecutableElement executableContext;
2742 TypeInformationParameter(this.variable, this.executableContext); 2747 TypeInformationParameter(this.variable, this.executableContext);
2743 String get name => variable.name; 2748 String get name => variable.name;
2744 } 2749 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698