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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2616263002: dart2js-kernel: implement rethrow (Closed)
Patch Set: fix type of residual Created 3 years, 11 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 | pkg/compiler/lib/src/ssa/nodes.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
10 import '../common/names.dart'; 10 import '../common/names.dart';
11 import '../common/tasks.dart' show CompilerTask; 11 import '../common/tasks.dart' show CompilerTask;
12 import '../compiler.dart'; 12 import '../compiler.dart';
13 import '../constants/values.dart' 13 import '../constants/values.dart'
14 show 14 show
15 ConstantValue, 15 ConstantValue,
16 InterceptorConstantValue, 16 InterceptorConstantValue,
17 StringConstantValue, 17 StringConstantValue,
18 SyntheticConstantValue,
19 //SyntheticConstantKind,
sra1 2017/01/09 19:20:17 I'm fixing this now and reformatting
18 TypeConstantValue; 20 TypeConstantValue;
19 import '../elements/resolution_types.dart'; 21 import '../elements/resolution_types.dart';
20 import '../elements/elements.dart'; 22 import '../elements/elements.dart';
21 import '../io/source_information.dart'; 23 import '../io/source_information.dart';
22 import '../js/js.dart' as js; 24 import '../js/js.dart' as js;
23 import '../js_backend/backend.dart' show JavaScriptBackend; 25 import '../js_backend/backend.dart' show JavaScriptBackend, SyntheticConstantKin d;
24 import '../kernel/kernel.dart'; 26 import '../kernel/kernel.dart';
25 import '../native/native.dart' as native; 27 import '../native/native.dart' as native;
26 import '../resolution/tree_elements.dart'; 28 import '../resolution/tree_elements.dart';
27 import '../tree/dartstring.dart'; 29 import '../tree/dartstring.dart';
28 import '../tree/nodes.dart' show Node, BreakStatement; 30 import '../tree/nodes.dart' show Node, BreakStatement;
29 import '../types/masks.dart'; 31 import '../types/masks.dart';
30 import '../universe/call_structure.dart' show CallStructure; 32 import '../universe/call_structure.dart' show CallStructure;
31 import '../universe/selector.dart'; 33 import '../universe/selector.dart';
32 import '../universe/side_effects.dart' show SideEffects; 34 import '../universe/side_effects.dart' show SideEffects;
33 import '../universe/use.dart' show StaticUse; 35 import '../universe/use.dart' show StaticUse;
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 bool old = _inExpressionOfThrow; 2209 bool old = _inExpressionOfThrow;
2208 try { 2210 try {
2209 _inExpressionOfThrow = true; 2211 _inExpressionOfThrow = true;
2210 expression.accept(this); 2212 expression.accept(this);
2211 } finally { 2213 } finally {
2212 _inExpressionOfThrow = old; 2214 _inExpressionOfThrow = old;
2213 } 2215 }
2214 } 2216 }
2215 2217
2216 @override 2218 @override
2219 void visitRethrow(ir.Rethrow rethrowNode) {
2220 HInstruction exception = rethrowableException;
2221 if (exception == null) {
2222 exception = graph.addConstantNull(closedWorld);
2223 reporter.internalError(node, 'rethrowableException should not be null.');
2224 }
2225 Sourceinformation sourceInformation = null;
2226 closeAndGotoExit(new HThrow(exception, sourceInformation, isRethrow: true));
2227 // ir.Rethrow is an expression so we need to push a value - a constant with
2228 // no type.
2229 stack.add(graph.addConstantUnreachable(closedWorld));
2230 }
2231
2232 @override
2217 void visitThisExpression(ir.ThisExpression thisExpression) { 2233 void visitThisExpression(ir.ThisExpression thisExpression) {
2218 stack.add(localsHandler.readThis()); 2234 stack.add(localsHandler.readThis());
2219 } 2235 }
2220 2236
2221 @override 2237 @override
2222 void visitNot(ir.Not not) { 2238 void visitNot(ir.Not not) {
2223 not.operand.accept(this); 2239 not.operand.accept(this);
2224 push(new HNot(popBoolified(), commonMasks.boolType)); 2240 push(new HNot(popBoolified(), commonMasks.boolType));
2225 } 2241 }
2226 2242
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 kernelBuilder.open(exitBlock); 2502 kernelBuilder.open(exitBlock);
2487 enterBlock.setBlockFlow( 2503 enterBlock.setBlockFlow(
2488 new HTryBlockInformation( 2504 new HTryBlockInformation(
2489 kernelBuilder.wrapStatementGraph(bodyGraph), 2505 kernelBuilder.wrapStatementGraph(bodyGraph),
2490 exception, 2506 exception,
2491 kernelBuilder.wrapStatementGraph(catchGraph), 2507 kernelBuilder.wrapStatementGraph(catchGraph),
2492 kernelBuilder.wrapStatementGraph(finallyGraph)), 2508 kernelBuilder.wrapStatementGraph(finallyGraph)),
2493 exitBlock); 2509 exitBlock);
2494 } 2510 }
2495 } 2511 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698