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

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

Issue 707493003: dart2js: Trust type annotations more often with --trust-type-annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix argument spelling. Created 6 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/compiler_helper.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) 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 2554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 } else { 2565 } else {
2566 compiler.internalError(input, 'Unexpected check.'); 2566 compiler.internalError(input, 'Unexpected check.');
2567 } 2567 }
2568 return test; 2568 return test;
2569 } 2569 }
2570 2570
2571 void visitTypeConversion(HTypeConversion node) { 2571 void visitTypeConversion(HTypeConversion node) {
2572 if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) { 2572 if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) {
2573 ClassWorld classWorld = compiler.world; 2573 ClassWorld classWorld = compiler.world;
2574 // An int check if the input is not int or null, is not 2574 // An int check if the input is not int or null, is not
2575 // sufficient for doing a argument or receiver check. 2575 // sufficient for doing an argument or receiver check.
2576 assert(!node.checkedType.containsOnlyInt(classWorld) || 2576 assert(compiler.trustTypeAnnotations ||
2577 !node.checkedType.containsOnlyInt(classWorld) ||
2577 node.checkedInput.isIntegerOrNull(compiler)); 2578 node.checkedInput.isIntegerOrNull(compiler));
2578 js.Expression test = generateTest(node.checkedInput, node.checkedType); 2579 js.Expression test = generateTest(node.checkedInput, node.checkedType);
2579 js.Block oldContainer = currentContainer; 2580 js.Block oldContainer = currentContainer;
2580 js.Statement body = new js.Block.empty(); 2581 js.Statement body = new js.Block.empty();
2581 currentContainer = body; 2582 currentContainer = body;
2582 if (node.isArgumentTypeCheck) { 2583 if (node.isArgumentTypeCheck) {
2583 generateThrowWithHelper('iae', node.checkedInput); 2584 generateThrowWithHelper('iae', node.checkedInput);
2584 } else if (node.isReceiverTypeCheck) { 2585 } else if (node.isReceiverTypeCheck) {
2585 use(node.checkedInput); 2586 use(node.checkedInput);
2586 String methodName = 2587 String methodName =
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 js.PropertyAccess accessHelper(String name) { 2723 js.PropertyAccess accessHelper(String name) {
2723 Element helper = backend.findHelper(name); 2724 Element helper = backend.findHelper(name);
2724 if (helper == null) { 2725 if (helper == null) {
2725 // For mocked-up tests. 2726 // For mocked-up tests.
2726 return js.js('(void 0).$name'); 2727 return js.js('(void 0).$name');
2727 } 2728 }
2728 registry.registerStaticUse(helper); 2729 registry.registerStaticUse(helper);
2729 return backend.namer.elementAccess(helper); 2730 return backend.namer.elementAccess(helper);
2730 } 2731 }
2731 } 2732 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698