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::kPlainPrimitiveToNumber, r->opcode()); | 491 CHECK_EQ(IrOpcode::kJSToNumber, 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 = | 1036 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); |
1037 B.CheckConvertedInput(IrOpcode::kPlainPrimitiveToNumber, 0, false); | |
1038 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 1037 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
1039 | 1038 |
1040 // Inputs should be commuted. | 1039 // Inputs should be commuted. |
1041 CHECK_EQ(B.p1, i0->InputAt(0)); | 1040 CHECK_EQ(B.p1, i0->InputAt(0)); |
1042 CHECK_EQ(B.p0, i1->InputAt(0)); | 1041 CHECK_EQ(B.p0, i1->InputAt(0)); |
1043 | 1042 |
1044 // But effects should be ordered start -> i1 -> effect_use | 1043 // But effects should be ordered start -> i1 -> effect_use |
1045 B.CheckEffectOrdering(i1); | 1044 B.CheckEffectOrdering(i1); |
1046 } | 1045 } |
1047 | 1046 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 CHECK_EQ(p1, r->InputAt(0)); | 1275 CHECK_EQ(p1, r->InputAt(0)); |
1277 CHECK_EQ(p0, r->InputAt(1)); | 1276 CHECK_EQ(p0, r->InputAt(1)); |
1278 } else { | 1277 } else { |
1279 CHECK_EQ(p0, r->InputAt(0)); | 1278 CHECK_EQ(p0, r->InputAt(0)); |
1280 CHECK_EQ(p1, r->InputAt(1)); | 1279 CHECK_EQ(p1, r->InputAt(1)); |
1281 } | 1280 } |
1282 } | 1281 } |
1283 } | 1282 } |
1284 } | 1283 } |
1285 } | 1284 } |
OLD | NEW |