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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/control-builders.h" | 8 #include "src/compiler/control-builders.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 | 1047 |
1048 TEST(LowerReferenceEqual_to_wordeq) { | 1048 TEST(LowerReferenceEqual_to_wordeq) { |
1049 TestingGraph t(Type::Any(), Type::Any()); | 1049 TestingGraph t(Type::Any(), Type::Any()); |
1050 IrOpcode::Value opcode = | 1050 IrOpcode::Value opcode = |
1051 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); | 1051 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); |
1052 t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual(Type::Any())); | 1052 t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual(Type::Any())); |
1053 } | 1053 } |
1054 | 1054 |
1055 | 1055 |
1056 TEST(LowerStringOps_to_call_and_compare) { | 1056 TEST(LowerStringOps_to_call_and_compare) { |
1057 TestingGraph t(Type::String(), Type::String()); | 1057 if (Pipeline::SupportedTarget()) { |
1058 IrOpcode::Value compare_eq = | 1058 // These tests need linkage for the calls. |
1059 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); | 1059 TestingGraph t(Type::String(), Type::String()); |
1060 IrOpcode::Value compare_lt = | 1060 IrOpcode::Value compare_eq = |
1061 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode()); | 1061 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); |
1062 IrOpcode::Value compare_le = | 1062 IrOpcode::Value compare_lt = |
1063 static_cast<IrOpcode::Value>(t.machine()->IntLessThanOrEqual()->opcode()); | 1063 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode()); |
1064 t.CheckLoweringBinop(compare_eq, t.simplified()->StringEqual()); | 1064 IrOpcode::Value compare_le = static_cast<IrOpcode::Value>( |
1065 t.CheckLoweringBinop(compare_lt, t.simplified()->StringLessThan()); | 1065 t.machine()->IntLessThanOrEqual()->opcode()); |
1066 t.CheckLoweringBinop(compare_le, t.simplified()->StringLessThanOrEqual()); | 1066 t.CheckLoweringBinop(compare_eq, t.simplified()->StringEqual()); |
1067 t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringAdd()); | 1067 t.CheckLoweringBinop(compare_lt, t.simplified()->StringLessThan()); |
| 1068 t.CheckLoweringBinop(compare_le, t.simplified()->StringLessThanOrEqual()); |
| 1069 t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringAdd()); |
| 1070 } |
1068 } | 1071 } |
1069 | 1072 |
1070 | 1073 |
1071 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, | 1074 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, |
1072 MachineType to) { | 1075 MachineType to) { |
1073 TestingGraph t(Type::Any()); | 1076 TestingGraph t(Type::Any()); |
1074 Node* in = t.ExampleWithOutput(from); | 1077 Node* in = t.ExampleWithOutput(from); |
1075 Node* use = t.Use(in, to); | 1078 Node* use = t.Use(in, to); |
1076 t.Return(use); | 1079 t.Return(use); |
1077 t.Lower(); | 1080 t.Lower(); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 | 1416 |
1414 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1417 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
1415 t.p1, t.start, t.start); | 1418 t.p1, t.start, t.start); |
1416 t.Effect(store); | 1419 t.Effect(store); |
1417 t.Lower(); | 1420 t.Lower(); |
1418 | 1421 |
1419 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1422 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1420 CHECK_EQ(t.p0, store->InputAt(0)); | 1423 CHECK_EQ(t.p0, store->InputAt(0)); |
1421 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1424 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
1422 } | 1425 } |
OLD | NEW |