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

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: Stray status file update from another CL 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 | tests/language/language_dart2js.status » ('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) 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 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 elseContinuation)); 1852 elseContinuation));
1853 catchBody = 1853 catchBody =
1854 new ir.LetCont(checkType, 1854 new ir.LetCont(checkType,
1855 new ir.TypeOperator(exceptionParameter, clause.type, checkType, 1855 new ir.TypeOperator(exceptionParameter, clause.type, checkType,
1856 isTypeTest: true)); 1856 isTypeTest: true));
1857 } 1857 }
1858 1858
1859 List<ir.Parameter> catchParameters = 1859 List<ir.Parameter> catchParameters =
1860 <ir.Parameter>[exceptionParameter, traceParameter]; 1860 <ir.Parameter>[exceptionParameter, traceParameter];
1861 ir.Continuation catchContinuation = new ir.Continuation(catchParameters); 1861 ir.Continuation catchContinuation = new ir.Continuation(catchParameters);
1862 catchContinuation.body = catchBody; 1862 catchBuilder.add(catchBody);
1863 catchContinuation.body = catchBuilder._root;
1863 1864
1864 tryCatchBuilder.add( 1865 tryCatchBuilder.add(
1865 new ir.LetHandler(catchContinuation, tryBuilder._root)); 1866 new ir.LetHandler(catchContinuation, tryBuilder._root));
1866 add(new ir.LetCont(join.continuation, tryCatchBuilder._root)); 1867 add(new ir.LetCont(join.continuation, tryCatchBuilder._root));
1867 environment = join.environment; 1868 environment = join.environment;
1868 } 1869 }
1869 1870
1870 /// Create a return statement `return value;` or `return;` if [value] is 1871 /// Create a return statement `return value;` or `return;` if [value] is
1871 /// null. 1872 /// null.
1872 void buildReturn([ir.Primitive value]) { 1873 void buildReturn([ir.Primitive value]) {
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 /// Create a read access of [local] variable or parameter. 2469 /// Create a read access of [local] variable or parameter.
2469 @override 2470 @override
2470 ir.Primitive _buildLocalGet(LocalElement local) { 2471 ir.Primitive _buildLocalGet(LocalElement local) {
2471 assert(isOpen); 2472 assert(isOpen);
2472 ClosureLocation location = jsState.boxedVariables[local]; 2473 ClosureLocation location = jsState.boxedVariables[local];
2473 if (location != null) { 2474 if (location != null) {
2474 ir.Primitive result = new ir.GetField(environment.lookup(location.box), 2475 ir.Primitive result = new ir.GetField(environment.lookup(location.box),
2475 location.field); 2476 location.field);
2476 result.useElementAsHint(local); 2477 result.useElementAsHint(local);
2477 return addPrimitive(result); 2478 return addPrimitive(result);
2479 } else if (isInMutableVariable(local)) {
2480 return addPrimitive(new ir.GetMutableVariable(getMutableVariable(local)));
2478 } else { 2481 } else {
2479 return environment.lookup(local); 2482 return environment.lookup(local);
2480 } 2483 }
2481 } 2484 }
2482 2485
2483 /// Create a write access to [local] variable or parameter with the provided 2486 /// Create a write access to [local] variable or parameter with the provided
2484 /// [value]. 2487 /// [value].
2485 @override 2488 @override
2486 ir.Primitive buildLocalVariableSet(LocalElement local, ir.Primitive value) { 2489 ir.Primitive buildLocalVariableSet(LocalElement local, ir.Primitive value) {
2487 assert(isOpen); 2490 assert(isOpen);
2488 ClosureLocation location = jsState.boxedVariables[local]; 2491 ClosureLocation location = jsState.boxedVariables[local];
2489 if (location != null) { 2492 if (location != null) {
2490 add(new ir.SetField(environment.lookup(location.box), 2493 add(new ir.SetField(environment.lookup(location.box),
2491 location.field, 2494 location.field,
2492 value)); 2495 value));
2496 } else if (isInMutableVariable(local)) {
2497 add(new ir.SetMutableVariable(getMutableVariable(local), value));
2493 } else { 2498 } else {
2494 value.useElementAsHint(local); 2499 value.useElementAsHint(local);
2495 environment.update(local, value); 2500 environment.update(local, value);
2496 } 2501 }
2497 return value; 2502 return value;
2498 } 2503 }
2499 2504
2500 void _enterForLoopInitializer(ClosureScope scope, 2505 void _enterForLoopInitializer(ClosureScope scope,
2501 List<LocalElement> loopVariables) { 2506 List<LocalElement> loopVariables) {
2502 if (scope == null) return; 2507 if (scope == null) return;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 } 2733 }
2729 2734
2730 /// Synthetic parameter to a JavaScript factory method that takes the type 2735 /// Synthetic parameter to a JavaScript factory method that takes the type
2731 /// argument given for the type variable [variable]. 2736 /// argument given for the type variable [variable].
2732 class TypeInformationParameter implements Local { 2737 class TypeInformationParameter implements Local {
2733 final TypeVariableElement variable; 2738 final TypeVariableElement variable;
2734 final ExecutableElement executableContext; 2739 final ExecutableElement executableContext;
2735 TypeInformationParameter(this.variable, this.executableContext); 2740 TypeInformationParameter(this.variable, this.executableContext);
2736 String get name => variable.name; 2741 String get name => variable.name;
2737 } 2742 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698