| 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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1258 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1259 val, t.start, t.start); | 1259 val, t.start, t.start); |
| 1260 t.Effect(store); | 1260 t.Effect(store); |
| 1261 t.Lower(); | 1261 t.Lower(); |
| 1262 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1262 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1263 CHECK_EQ(val, store->InputAt(2)); | 1263 CHECK_EQ(val, store->InputAt(2)); |
| 1264 CheckFieldAccessArithmetic(access, store); | 1264 CheckFieldAccessArithmetic(access, store); |
| 1265 | 1265 |
| 1266 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); | 1266 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); |
| 1267 if (machine_reps[i] & kRepTagged) { | 1267 if (machine_reps[i] & kRepTagged) { |
| 1268 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind); | 1268 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); |
| 1269 } | 1269 } |
| 1270 CHECK_EQ(machine_reps[i], rep.machine_type); | 1270 CHECK_EQ(machine_reps[i], rep.machine_type()); |
| 1271 } | 1271 } |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 | 1274 |
| 1275 TEST(LowerLoadElement_to_load) { | 1275 TEST(LowerLoadElement_to_load) { |
| 1276 TestingGraph t(Type::Any(), Type::Signed32()); | 1276 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1277 | 1277 |
| 1278 for (size_t i = 0; i < arraysize(machine_reps); i++) { | 1278 for (size_t i = 0; i < arraysize(machine_reps); i++) { |
| 1279 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1279 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
| 1280 Type::Any(), machine_reps[i]}; | 1280 Type::Any(), machine_reps[i]}; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1305 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, | 1305 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, |
| 1306 t.p1, val, t.start, t.start); | 1306 t.p1, val, t.start, t.start); |
| 1307 t.Effect(store); | 1307 t.Effect(store); |
| 1308 t.Lower(); | 1308 t.Lower(); |
| 1309 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1309 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1310 CHECK_EQ(val, store->InputAt(2)); | 1310 CHECK_EQ(val, store->InputAt(2)); |
| 1311 CheckElementAccessArithmetic(access, store); | 1311 CheckElementAccessArithmetic(access, store); |
| 1312 | 1312 |
| 1313 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); | 1313 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); |
| 1314 if (machine_reps[i] & kRepTagged) { | 1314 if (machine_reps[i] & kRepTagged) { |
| 1315 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind); | 1315 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); |
| 1316 } | 1316 } |
| 1317 CHECK_EQ(machine_reps[i], rep.machine_type); | 1317 CHECK_EQ(machine_reps[i], rep.machine_type()); |
| 1318 } | 1318 } |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 | 1321 |
| 1322 TEST(InsertChangeForLoadElementIndex) { | 1322 TEST(InsertChangeForLoadElementIndex) { |
| 1323 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged) => | 1323 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged) => |
| 1324 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) | 1324 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) |
| 1325 TestingGraph t(Type::Any(), Type::Signed32()); | 1325 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1326 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), | 1326 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), |
| 1327 kMachAnyTagged}; | 1327 kMachAnyTagged}; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, | 1441 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, |
| 1442 load1, t.start); | 1442 load1, t.start); |
| 1443 t.Return(t.Use(phi, kMachineTypes[i])); | 1443 t.Return(t.Use(phi, kMachineTypes[i])); |
| 1444 t.Lower(); | 1444 t.Lower(); |
| 1445 | 1445 |
| 1446 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); | 1446 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); |
| 1447 CHECK_EQ(RepresentationOf(kMachineTypes[i]), | 1447 CHECK_EQ(RepresentationOf(kMachineTypes[i]), |
| 1448 RepresentationOf(OpParameter<MachineType>(phi))); | 1448 RepresentationOf(OpParameter<MachineType>(phi))); |
| 1449 } | 1449 } |
| 1450 } | 1450 } |
| OLD | NEW |