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

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

Issue 2561743002: Generate traps for unhandled statement nodes (Closed)
Patch Set: Generate traps for unhandled statement nodes Created 4 years 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) 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 import 'package:kernel/text/ast_to_text.dart' show debugNodeToString;
Siggi Cherem (dart-lang) 2016/12/08 05:30:06 delete? (unused?)
6 7
7 import '../closure.dart'; 8 import '../closure.dart';
8 import '../common.dart'; 9 import '../common.dart';
9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 10 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
10 import '../common/names.dart'; 11 import '../common/names.dart';
11 import '../common/tasks.dart' show CompilerTask; 12 import '../common/tasks.dart' show CompilerTask;
12 import '../compiler.dart'; 13 import '../compiler.dart';
13 import '../constants/values.dart' 14 import '../constants/values.dart'
14 show 15 show
15 ConstantValue, 16 ConstantValue,
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 426
426 /// Pushes a boolean checking [expression] against null. 427 /// Pushes a boolean checking [expression] against null.
427 pushCheckNull(HInstruction expression) { 428 pushCheckNull(HInstruction expression) {
428 push(new HIdentity( 429 push(new HIdentity(
429 expression, graph.addConstantNull(compiler), null, backend.boolType)); 430 expression, graph.addConstantNull(compiler), null, backend.boolType));
430 } 431 }
431 432
432 @override 433 @override
433 void defaultExpression(ir.Expression expression) { 434 void defaultExpression(ir.Expression expression) {
434 // TODO(het): This is only to get tests working. 435 // TODO(het): This is only to get tests working.
435 String message = 'Unhandled ir.${expression.runtimeType} $expression'; 436 _trap('Unhandled ir.${expression.runtimeType} $expression');
437 }
438
439 @override
440 void defaultStatement(ir.Statement statement) {
441 _trap('Unhandled ir.${statement.runtimeType} $statement');
442 pop();
443 }
444
445 void _trap(String message) {
436 HInstruction nullValue = graph.addConstantNull(compiler); 446 HInstruction nullValue = graph.addConstantNull(compiler);
437 HInstruction errorMessage = 447 HInstruction errorMessage =
438 graph.addConstantString(new DartString.literal(message), compiler); 448 graph.addConstantString(new DartString.literal(message), compiler);
439 HInstruction trap = new HForeignCode(js.js.parseForeignJS("#.#"), 449 HInstruction trap = new HForeignCode(js.js.parseForeignJS("#.#"),
440 backend.dynamicType, <HInstruction>[nullValue, errorMessage]); 450 backend.dynamicType, <HInstruction>[nullValue, errorMessage]);
441 trap.sideEffects 451 trap.sideEffects
442 ..setAllSideEffects() 452 ..setAllSideEffects()
443 ..setDependsOnSomething(); 453 ..setDependsOnSomething();
444 push(trap); 454 push(trap);
445 } 455 }
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 push(new HNot(popBoolified(), backend.boolType)); 1921 push(new HNot(popBoolified(), backend.boolType));
1912 } 1922 }
1913 1923
1914 @override 1924 @override
1915 void visitStringConcatenation(ir.StringConcatenation stringConcat) { 1925 void visitStringConcatenation(ir.StringConcatenation stringConcat) {
1916 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); 1926 KernelStringBuilder stringBuilder = new KernelStringBuilder(this);
1917 stringConcat.accept(stringBuilder); 1927 stringConcat.accept(stringBuilder);
1918 stack.add(stringBuilder.result); 1928 stack.add(stringBuilder.result);
1919 } 1929 }
1920 } 1930 }
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