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

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

Issue 40593002: Revert "Separate HTypeConversion checked type from output type." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 171dd25689d866d2a4e24103bdc27494f2bf9a68..8c3783a1c0015cc77daa7e207c0ade6940972115 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -2434,39 +2434,39 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
}
- js.Expression generateTest(HInstruction input, HType checkedType) {
+ js.Expression generateTest(HCheck node) {
+ HInstruction input = node.checkedInput;
TypeMask receiver = input.instructionType.computeMask(compiler);
- TypeMask mask = checkedType.computeMask(compiler);
+ TypeMask mask = node.instructionType.computeMask(compiler);
// Figure out if it is beneficial to turn this into a null check.
// V8 generally prefers 'typeof' checks, but for integers and
// indexable primitives we cannot compile this test into a single
// typeof check so the null check is cheaper.
- bool turnIntoNumCheck = input.isIntegerOrNull() && checkedType.isInteger();
+ bool turnIntoNumCheck = input.isIntegerOrNull() && node.isInteger();
bool turnIntoNullCheck = !turnIntoNumCheck
&& (mask.nullable() == receiver)
- && (checkedType.isInteger()
- || checkedType.isIndexablePrimitive(compiler));
+ && (node.isInteger() || node.isIndexablePrimitive(compiler));
js.Expression test;
if (turnIntoNullCheck) {
use(input);
test = new js.Binary("==", pop(), new js.LiteralNull());
- } else if (checkedType.isInteger() && !turnIntoNumCheck) {
+ } else if (node.isInteger() && !turnIntoNumCheck) {
// input is !int
checkInt(input, '!==');
test = pop();
- } else if (checkedType.isNumber() || turnIntoNumCheck) {
+ } else if (node.isNumber() || turnIntoNumCheck) {
// input is !num
checkNum(input, '!==');
test = pop();
- } else if (checkedType.isBoolean()) {
+ } else if (node.isBoolean()) {
// input is !bool
checkBool(input, '!==');
test = pop();
- } else if (checkedType.isString(compiler)) {
+ } else if (node.isString(compiler)) {
// input is !string
checkString(input, '!==');
test = pop();
- } else if (checkedType.isExtendableArray(compiler)) {
+ } else if (node.isExtendableArray(compiler)) {
// input is !Object || input is !Array || input.isFixed
checkObject(input, '!==');
js.Expression objectTest = pop();
@@ -2475,7 +2475,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
checkFixedArray(input);
test = new js.Binary('||', objectTest, arrayTest);
test = new js.Binary('||', test, pop());
- } else if (checkedType.isMutableArray(compiler)) {
+ } else if (node.isMutableArray(compiler)) {
// input is !Object
// || ((input is !Array || input.isImmutable)
// && input is !JsIndexingBehavior)
@@ -2490,7 +2490,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
? new js.Binary('&&', notArrayOrImmutable, pop())
: notArrayOrImmutable;
test = new js.Binary('||', objectTest, notIndexing);
- } else if (checkedType.isReadableArray(compiler)) {
+ } else if (node.isReadableArray(compiler)) {
// input is !Object
// || (input is !Array && input is !JsIndexingBehavior)
checkObject(input, '!==');
@@ -2502,7 +2502,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
? new js.Binary('&&', arrayTest, pop())
: arrayTest;
test = new js.Binary('||', objectTest, notIndexing);
- } else if (checkedType.isIndexablePrimitive(compiler)) {
+ } else if (node.isIndexablePrimitive(compiler)) {
// input is !String
// && (input is !Object
// || (input is !Array && input is !JsIndexingBehavior))
@@ -2529,9 +2529,8 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) {
// An int check if the input is not int or null, is not
// sufficient for doing a argument or receiver check.
- assert(!node.checkedType.isInteger() ||
- node.checkedInput.isIntegerOrNull());
- js.Expression test = generateTest(node.checkedInput, node.checkedType);
+ assert(!node.isInteger() || node.checkedInput.isIntegerOrNull());
+ js.Expression test = generateTest(node);
js.Block oldContainer = currentContainer;
js.Statement body = new js.Block.empty();
currentContainer = body;
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698