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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove reportInternalError Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of ssa; 5 part of ssa;
6 6
7 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 body.statements.add( 894 body.statements.add(
895 new js.If(jsCondition, updateBody, new js.Break(null))); 895 new js.If(jsCondition, updateBody, new js.Break(null)));
896 jsCondition = newLiteralBool(true); 896 jsCondition = newLiteralBool(true);
897 } 897 }
898 loop = new js.Do(unwrapStatement(body), jsCondition); 898 loop = new js.Do(unwrapStatement(body), jsCondition);
899 } 899 }
900 currentContainer = oldContainer; 900 currentContainer = oldContainer;
901 break; 901 break;
902 default: 902 default:
903 compiler.internalError( 903 compiler.internalError(
904 'Unexpected loop kind: ${info.kind}', 904 condition.conditionExpression,
905 instruction: condition.conditionExpression); 905 'Unexpected loop kind: ${info.kind}');
906 } 906 }
907 attachLocationRange(loop, info.sourcePosition, info.endSourcePosition); 907 attachLocationRange(loop, info.sourcePosition, info.endSourcePosition);
908 js.Statement result = loop; 908 js.Statement result = loop;
909 if (info.kind == HLoopBlockInformation.SWITCH_CONTINUE_LOOP) { 909 if (info.kind == HLoopBlockInformation.SWITCH_CONTINUE_LOOP) {
910 String continueLabelString = 910 String continueLabelString =
911 backend.namer.implicitContinueLabelName(info.target); 911 backend.namer.implicitContinueLabelName(info.target);
912 result = new js.LabeledStatement(continueLabelString, result); 912 result = new js.LabeledStatement(continueLabelString, result);
913 } 913 }
914 pushStatement(wrapIntoLabels(result, info.labels)); 914 pushStatement(wrapIntoLabels(result, info.labels));
915 return true; 915 return true;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 HBasicBlock block = node.block; 1273 HBasicBlock block = node.block;
1274 assert(block.successors.length == 1); 1274 assert(block.successors.length == 1);
1275 List<HBasicBlock> dominated = block.dominatedBlocks; 1275 List<HBasicBlock> dominated = block.dominatedBlocks;
1276 // With the exception of the entry-node which dominates its successor 1276 // With the exception of the entry-node which dominates its successor
1277 // and the exit node, no block finishing with a 'goto' can have more than 1277 // and the exit node, no block finishing with a 'goto' can have more than
1278 // one dominated block (since it has only one successor). 1278 // one dominated block (since it has only one successor).
1279 // If the successor is dominated by another block, then the other block 1279 // If the successor is dominated by another block, then the other block
1280 // is responsible for visiting the successor. 1280 // is responsible for visiting the successor.
1281 if (dominated.isEmpty) return; 1281 if (dominated.isEmpty) return;
1282 if (dominated.length > 2) { 1282 if (dominated.length > 2) {
1283 compiler.internalError('dominated.length = ${dominated.length}', 1283 compiler.internalError(node, 'dominated.length = ${dominated.length}');
1284 instruction: node);
1285 } 1284 }
1286 if (dominated.length == 2 && block != currentGraph.entry) { 1285 if (dominated.length == 2 && block != currentGraph.entry) {
1287 compiler.internalError('node.block != currentGraph.entry', 1286 compiler.internalError(node, 'node.block != currentGraph.entry');
1288 instruction: node);
1289 } 1287 }
1290 assert(dominated[0] == block.successors[0]); 1288 assert(dominated[0] == block.successors[0]);
1291 visitBasicBlock(dominated[0]); 1289 visitBasicBlock(dominated[0]);
1292 } 1290 }
1293 1291
1294 visitLoopBranch(HLoopBranch node) { 1292 visitLoopBranch(HLoopBranch node) {
1295 assert(node.block == subGraph.end); 1293 assert(node.block == subGraph.end);
1296 // We are generating code for a loop condition. 1294 // We are generating code for a loop condition.
1297 // If we are generating the subgraph as an expression, the 1295 // If we are generating the subgraph as an expression, the
1298 // condition will be generated as the expression. 1296 // condition will be generated as the expression.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 // try/catch block, ie the try body is always a predecessor 1360 // try/catch block, ie the try body is always a predecessor
1363 // of the catch and finally. Here, we continue visiting the try 1361 // of the catch and finally. Here, we continue visiting the try
1364 // body by visiting the block that contains the user-level control 1362 // body by visiting the block that contains the user-level control
1365 // flow instruction. 1363 // flow instruction.
1366 visitBasicBlock(node.bodyTrySuccessor); 1364 visitBasicBlock(node.bodyTrySuccessor);
1367 } 1365 }
1368 1366
1369 visitTry(HTry node) { 1367 visitTry(HTry node) {
1370 // We should never get here. Try/catch/finally is always handled using block 1368 // We should never get here. Try/catch/finally is always handled using block
1371 // information in [visitTryInfo]. 1369 // information in [visitTryInfo].
1372 compiler.internalError('visitTry should not be called', instruction: node); 1370 compiler.internalError(node, 'visitTry should not be called');
1373 } 1371 }
1374 1372
1375 bool tryControlFlowOperation(HIf node) { 1373 bool tryControlFlowOperation(HIf node) {
1376 if (!controlFlowOperators.contains(node)) return false; 1374 if (!controlFlowOperators.contains(node)) return false;
1377 HPhi phi = node.joinBlock.phis.first; 1375 HPhi phi = node.joinBlock.phis.first;
1378 bool atUseSite = isGenerateAtUseSite(phi); 1376 bool atUseSite = isGenerateAtUseSite(phi);
1379 // Don't generate a conditional operator in this situation: 1377 // Don't generate a conditional operator in this situation:
1380 // i = condition ? bar() : i; 1378 // i = condition ? bar() : i;
1381 // But generate this instead: 1379 // But generate this instead:
1382 // if (condition) i = bar(); 1380 // if (condition) i = bar();
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 if (type is DartType) { 1690 if (type is DartType) {
1693 world.registerInstantiatedType(type, work.resolutionTree); 1691 world.registerInstantiatedType(type, work.resolutionTree);
1694 } 1692 }
1695 }); 1693 });
1696 } 1694 }
1697 1695
1698 visitForeign(HForeign node) { 1696 visitForeign(HForeign node) {
1699 List<HInstruction> inputs = node.inputs; 1697 List<HInstruction> inputs = node.inputs;
1700 if (node.isJsStatement()) { 1698 if (node.isJsStatement()) {
1701 if (!inputs.isEmpty) { 1699 if (!inputs.isEmpty) {
1702 compiler.internalError("foreign statement with inputs", 1700 compiler.internalError(node, "foreign statement with inputs");
1703 instruction: node);
1704 } 1701 }
1705 pushStatement(node.codeAst, node); 1702 pushStatement(node.codeAst, node);
1706 } else { 1703 } else {
1707 if (!inputs.isEmpty) { 1704 if (!inputs.isEmpty) {
1708 List<js.Expression> interpolatedExpressions = <js.Expression>[]; 1705 List<js.Expression> interpolatedExpressions = <js.Expression>[];
1709 for (int i = 0; i < inputs.length; i++) { 1706 for (int i = 0; i < inputs.length; i++) {
1710 use(inputs[i]); 1707 use(inputs[i]);
1711 interpolatedExpressions.add(pop()); 1708 interpolatedExpressions.add(pop());
1712 } 1709 }
1713 var visitor = new js.UninterpolateJSExpression(interpolatedExpressions); 1710 var visitor = new js.UninterpolateJSExpression(interpolatedExpressions);
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 checkArray(input, '!=='); 2490 checkArray(input, '!==');
2494 js.Expression arrayTest = pop(); 2491 js.Expression arrayTest = pop();
2495 2492
2496 js.Binary notIndexingTest = checkIndexingBehavior(input, negative: true) 2493 js.Binary notIndexingTest = checkIndexingBehavior(input, negative: true)
2497 ? new js.Binary('&&', arrayTest, pop()) 2494 ? new js.Binary('&&', arrayTest, pop())
2498 : arrayTest; 2495 : arrayTest;
2499 js.Binary notObjectOrIndexingTest = 2496 js.Binary notObjectOrIndexingTest =
2500 new js.Binary('||', objectTest, notIndexingTest); 2497 new js.Binary('||', objectTest, notIndexingTest);
2501 test = new js.Binary('&&', stringTest, notObjectOrIndexingTest); 2498 test = new js.Binary('&&', stringTest, notObjectOrIndexingTest);
2502 } else { 2499 } else {
2503 compiler.internalError('Unexpected check', instruction: input); 2500 compiler.internalError(input, 'Unexpected check');
2504 } 2501 }
2505 return test; 2502 return test;
2506 } 2503 }
2507 2504
2508 void visitTypeConversion(HTypeConversion node) { 2505 void visitTypeConversion(HTypeConversion node) {
2509 if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) { 2506 if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) {
2510 // An int check if the input is not int or null, is not 2507 // An int check if the input is not int or null, is not
2511 // sufficient for doing a argument or receiver check. 2508 // sufficient for doing a argument or receiver check.
2512 assert(!node.checkedType.containsOnlyInt(compiler) || 2509 assert(!node.checkedType.containsOnlyInt(compiler) ||
2513 node.checkedInput.isIntegerOrNull(compiler)); 2510 node.checkedInput.isIntegerOrNull(compiler));
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 js.PropertyAccess accessHelper(String name) { 2656 js.PropertyAccess accessHelper(String name) {
2660 Element helper = compiler.findHelper(name); 2657 Element helper = compiler.findHelper(name);
2661 if (helper == null) { 2658 if (helper == null) {
2662 // For mocked-up tests. 2659 // For mocked-up tests.
2663 return js.js('(void 0).$name'); 2660 return js.js('(void 0).$name');
2664 } 2661 }
2665 world.registerStaticUse(helper); 2662 world.registerStaticUse(helper);
2666 return backend.namer.elementAccess(helper); 2663 return backend.namer.elementAccess(helper);
2667 } 2664 }
2668 } 2665 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698