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 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode()); | 1196 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode()); |
1197 IrOpcode::Value compare_le = static_cast<IrOpcode::Value>( | 1197 IrOpcode::Value compare_le = static_cast<IrOpcode::Value>( |
1198 t.machine()->IntLessThanOrEqual()->opcode()); | 1198 t.machine()->IntLessThanOrEqual()->opcode()); |
1199 t.CheckLoweringStringBinop(compare_eq, t.simplified()->StringEqual()); | 1199 t.CheckLoweringStringBinop(compare_eq, t.simplified()->StringEqual()); |
1200 t.CheckLoweringStringBinop(compare_lt, t.simplified()->StringLessThan()); | 1200 t.CheckLoweringStringBinop(compare_lt, t.simplified()->StringLessThan()); |
1201 t.CheckLoweringStringBinop(compare_le, | 1201 t.CheckLoweringStringBinop(compare_le, |
1202 t.simplified()->StringLessThanOrEqual()); | 1202 t.simplified()->StringLessThanOrEqual()); |
1203 } | 1203 } |
1204 | 1204 |
1205 | 1205 |
1206 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, | 1206 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, |
1207 MachineType to) { | 1207 MachineType to, Type* type = Type::Any()) { |
1208 TestingGraph t(Type::Any()); | 1208 TestingGraph t(Type::Any()); |
1209 Node* in = t.ExampleWithOutput(from); | 1209 Node* in = t.ExampleWithOutput(from); |
| 1210 NodeProperties::SetType(in, type); |
1210 Node* use = t.Use(in, to); | 1211 Node* use = t.Use(in, to); |
1211 t.Return(use); | 1212 t.Return(use); |
1212 t.Lower(); | 1213 t.Lower(); |
1213 CHECK_EQ(expected, use->InputAt(0)->opcode()); | 1214 CHECK_EQ(expected, use->InputAt(0)->opcode()); |
1214 CHECK_EQ(in, use->InputAt(0)->InputAt(0)); | 1215 CHECK_EQ(in, use->InputAt(0)->InputAt(0)); |
1215 } | 1216 } |
1216 | 1217 |
1217 | 1218 |
1218 TEST(InsertBasicChanges) { | 1219 TEST(InsertBasicChanges) { |
1219 CheckChangeInsertion(IrOpcode::kChangeFloat64ToInt32, kRepFloat64, | 1220 CheckChangeInsertion(IrOpcode::kChangeFloat64ToInt32, kRepFloat64, kTypeInt32, |
1220 kTypeInt32); | 1221 Type::Signed32()); |
1221 CheckChangeInsertion(IrOpcode::kChangeFloat64ToUint32, kRepFloat64, | 1222 CheckChangeInsertion(IrOpcode::kChangeFloat64ToUint32, kRepFloat64, |
1222 kTypeUint32); | 1223 kTypeUint32, Type::Unsigned32()); |
1223 CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, kRepTagged, kTypeInt32); | 1224 CheckChangeInsertion(IrOpcode::kTruncateFloat64ToInt32, kRepFloat64, |
1224 CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32, kRepTagged, | 1225 kTypeUint32, Type::Integral32()); |
1225 kTypeUint32); | 1226 CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, kRepTagged, kTypeInt32, |
| 1227 Type::Signed32()); |
| 1228 CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32, kRepTagged, kTypeUint32, |
| 1229 Type::Unsigned32()); |
1226 | 1230 |
1227 CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, kRepFloat64, | 1231 CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, kRepFloat64, |
1228 kRepTagged); | 1232 kRepTagged); |
1229 CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64, kRepTagged, | 1233 CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64, kRepTagged, |
1230 kRepFloat64); | 1234 kRepFloat64); |
1231 | 1235 |
1232 CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, kTypeInt32, | 1236 CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, kTypeInt32, |
1233 kRepFloat64); | 1237 kRepFloat64); |
1234 CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, kTypeInt32, kRepTagged); | 1238 CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, kTypeInt32, kRepTagged); |
1235 | 1239 |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 t.Return(use); | 2015 t.Return(use); |
2012 t.Lower(); | 2016 t.Lower(); |
2013 | 2017 |
2014 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); | 2018 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); |
2015 } | 2019 } |
2016 } | 2020 } |
2017 | 2021 |
2018 } // namespace compiler | 2022 } // namespace compiler |
2019 } // namespace internal | 2023 } // namespace internal |
2020 } // namespace v8 | 2024 } // namespace v8 |
OLD | NEW |