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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 | 1044 |
1045 | 1045 |
1046 TEST(LowerReferenceEqual_to_wordeq) { | 1046 TEST(LowerReferenceEqual_to_wordeq) { |
1047 TestingGraph t(Type::Any(), Type::Any()); | 1047 TestingGraph t(Type::Any(), Type::Any()); |
1048 IrOpcode::Value opcode = | 1048 IrOpcode::Value opcode = |
1049 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); | 1049 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); |
1050 t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual(Type::Any())); | 1050 t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual(Type::Any())); |
1051 } | 1051 } |
1052 | 1052 |
1053 | 1053 |
1054 TEST(LowerStringOps_to_call_and_wordeq) { | 1054 TEST(LowerStringOps_to_call_and_compare) { |
1055 TestingGraph t(Type::String(), Type::String()); | 1055 TestingGraph t(Type::String(), Type::String()); |
1056 IrOpcode::Value opcode = | 1056 IrOpcode::Value compare_eq = |
1057 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); | 1057 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); |
1058 t.CheckLoweringBinop(opcode, t.simplified()->StringEqual()); | 1058 IrOpcode::Value compare_lt = |
1059 if (false) { // TODO(titzer): lower StringOps to stub/runtime calls | 1059 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode()); |
1060 t.CheckLoweringBinop(opcode, t.simplified()->StringLessThan()); | 1060 IrOpcode::Value compare_le = |
1061 t.CheckLoweringBinop(opcode, t.simplified()->StringLessThanOrEqual()); | 1061 static_cast<IrOpcode::Value>(t.machine()->IntLessThanOrEqual()->opcode()); |
1062 } | 1062 t.CheckLoweringBinop(compare_eq, t.simplified()->StringEqual()); |
| 1063 t.CheckLoweringBinop(compare_lt, t.simplified()->StringLessThan()); |
| 1064 t.CheckLoweringBinop(compare_le, t.simplified()->StringLessThanOrEqual()); |
1063 t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringAdd()); | 1065 t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringAdd()); |
1064 } | 1066 } |
1065 | 1067 |
1066 | 1068 |
1067 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, | 1069 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, |
1068 MachineType to) { | 1070 MachineType to) { |
1069 TestingGraph t(Type::Any()); | 1071 TestingGraph t(Type::Any()); |
1070 Node* in = t.ExampleWithOutput(from); | 1072 Node* in = t.ExampleWithOutput(from); |
1071 Node* use = t.Use(in, to); | 1073 Node* use = t.Use(in, to); |
1072 t.Return(use); | 1074 t.Return(use); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 | 1411 |
1410 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1412 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
1411 t.p1, t.start, t.start); | 1413 t.p1, t.start, t.start); |
1412 t.Effect(store); | 1414 t.Effect(store); |
1413 t.Lower(); | 1415 t.Lower(); |
1414 | 1416 |
1415 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1417 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1416 CHECK_EQ(t.p0, store->InputAt(0)); | 1418 CHECK_EQ(t.p0, store->InputAt(0)); |
1417 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1419 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
1418 } | 1420 } |
OLD | NEW |