| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
| 6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
| 8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 481 |
| 482 | 482 |
| 483 TEST(JSToNumberOfNumberOrOtherPrimitive) { | 483 TEST(JSToNumberOfNumberOrOtherPrimitive) { |
| 484 JSTypedLoweringTester R; | 484 JSTypedLoweringTester R; |
| 485 Type* others[] = {Type::Undefined(), Type::Null(), Type::Boolean(), | 485 Type* others[] = {Type::Undefined(), Type::Null(), Type::Boolean(), |
| 486 Type::String()}; | 486 Type::String()}; |
| 487 | 487 |
| 488 for (size_t i = 0; i < arraysize(others); i++) { | 488 for (size_t i = 0; i < arraysize(others); i++) { |
| 489 Type* t = Type::Union(Type::Number(), others[i], R.main_zone()); | 489 Type* t = Type::Union(Type::Number(), others[i], R.main_zone()); |
| 490 Node* r = R.ReduceUnop(R.javascript.ToNumber(), t); | 490 Node* r = R.ReduceUnop(R.javascript.ToNumber(), t); |
| 491 CHECK_EQ(IrOpcode::kJSToNumber, r->opcode()); | 491 CHECK_EQ(IrOpcode::kPlainPrimitiveToNumber, r->opcode()); |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 | 494 |
| 495 | 495 |
| 496 TEST(JSToBoolean) { | 496 TEST(JSToBoolean) { |
| 497 JSTypedLoweringTester R; | 497 JSTypedLoweringTester R; |
| 498 const Operator* op = R.javascript.ToBoolean(); | 498 const Operator* op = R.javascript.ToBoolean(); |
| 499 | 499 |
| 500 { // ToBoolean(undefined) | 500 { // ToBoolean(undefined) |
| 501 Node* r = R.ReduceUnop(op, Type::Undefined()); | 501 Node* r = R.ReduceUnop(op, Type::Undefined()); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 | 1026 |
| 1027 const Operator* ops[] = { | 1027 const Operator* ops[] = { |
| 1028 R.javascript.GreaterThan(), R.simplified.NumberLessThan(), | 1028 R.javascript.GreaterThan(), R.simplified.NumberLessThan(), |
| 1029 R.javascript.GreaterThanOrEqual(), R.simplified.NumberLessThanOrEqual(), | 1029 R.javascript.GreaterThanOrEqual(), R.simplified.NumberLessThanOrEqual(), |
| 1030 }; | 1030 }; |
| 1031 | 1031 |
| 1032 for (size_t j = 0; j < arraysize(ops); j += 2) { | 1032 for (size_t j = 0; j < arraysize(ops); j += 2) { |
| 1033 BinopEffectsTester B(ops[j], Type::Symbol(), Type::String()); | 1033 BinopEffectsTester B(ops[j], Type::Symbol(), Type::String()); |
| 1034 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); | 1034 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); |
| 1035 | 1035 |
| 1036 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); | 1036 Node* i0 = |
| 1037 B.CheckConvertedInput(IrOpcode::kPlainPrimitiveToNumber, 0, false); |
| 1037 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 1038 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
| 1038 | 1039 |
| 1039 // Inputs should be commuted. | 1040 // Inputs should be commuted. |
| 1040 CHECK_EQ(B.p1, i0->InputAt(0)); | 1041 CHECK_EQ(B.p1, i0->InputAt(0)); |
| 1041 CHECK_EQ(B.p0, i1->InputAt(0)); | 1042 CHECK_EQ(B.p0, i1->InputAt(0)); |
| 1042 | 1043 |
| 1043 // But effects should be ordered start -> i1 -> effect_use | 1044 // But effects should be ordered start -> i1 -> effect_use |
| 1044 B.CheckEffectOrdering(i1); | 1045 B.CheckEffectOrdering(i1); |
| 1045 } | 1046 } |
| 1046 | 1047 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 CHECK_EQ(p1, r->InputAt(0)); | 1276 CHECK_EQ(p1, r->InputAt(0)); |
| 1276 CHECK_EQ(p0, r->InputAt(1)); | 1277 CHECK_EQ(p0, r->InputAt(1)); |
| 1277 } else { | 1278 } else { |
| 1278 CHECK_EQ(p0, r->InputAt(0)); | 1279 CHECK_EQ(p0, r->InputAt(0)); |
| 1279 CHECK_EQ(p1, r->InputAt(1)); | 1280 CHECK_EQ(p1, r->InputAt(1)); |
| 1280 } | 1281 } |
| 1281 } | 1282 } |
| 1282 } | 1283 } |
| 1283 } | 1284 } |
| 1284 } | 1285 } |
| OLD | NEW |