| 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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 TEST(LowerLoadElement_to_load) { | 1348 TEST(LowerLoadElement_to_load) { |
| 1349 TestingGraph t(Type::Any(), Type::Signed32()); | 1349 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1350 | 1350 |
| 1351 for (size_t i = 0; i < arraysize(machine_reps); i++) { | 1351 for (size_t i = 0; i < arraysize(machine_reps); i++) { |
| 1352 ElementAccess access = {kNoBoundsCheck, kTaggedBase, | 1352 ElementAccess access = {kNoBoundsCheck, kTaggedBase, |
| 1353 FixedArrayBase::kHeaderSize, Type::Any(), | 1353 FixedArrayBase::kHeaderSize, Type::Any(), |
| 1354 machine_reps[i]}; | 1354 machine_reps[i]}; |
| 1355 | 1355 |
| 1356 Node* load = | 1356 Node* load = |
| 1357 t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1, | 1357 t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1, |
| 1358 t.jsgraph.Int32Constant(1024), t.start); | 1358 t.jsgraph.Int32Constant(1024), t.start, t.start); |
| 1359 Node* use = t.Use(load, machine_reps[i]); | 1359 Node* use = t.Use(load, machine_reps[i]); |
| 1360 t.Return(use); | 1360 t.Return(use); |
| 1361 t.Lower(); | 1361 t.Lower(); |
| 1362 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1362 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
| 1363 CHECK_EQ(t.p0, load->InputAt(0)); | 1363 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1364 CheckElementAccessArithmetic(access, load); | 1364 CheckElementAccessArithmetic(access, load); |
| 1365 | 1365 |
| 1366 MachineType rep = OpParameter<MachineType>(load); | 1366 MachineType rep = OpParameter<MachineType>(load); |
| 1367 CHECK_EQ(machine_reps[i], rep); | 1367 CHECK_EQ(machine_reps[i], rep); |
| 1368 } | 1368 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1398 | 1398 |
| 1399 TEST(InsertChangeForLoadElementIndex) { | 1399 TEST(InsertChangeForLoadElementIndex) { |
| 1400 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged, length) => | 1400 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged, length) => |
| 1401 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) | 1401 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) |
| 1402 TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); | 1402 TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); |
| 1403 ElementAccess access = {kNoBoundsCheck, kTaggedBase, | 1403 ElementAccess access = {kNoBoundsCheck, kTaggedBase, |
| 1404 FixedArrayBase::kHeaderSize, Type::Any(), | 1404 FixedArrayBase::kHeaderSize, Type::Any(), |
| 1405 kMachAnyTagged}; | 1405 kMachAnyTagged}; |
| 1406 | 1406 |
| 1407 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, | 1407 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, |
| 1408 t.p1, t.p2, t.start); | 1408 t.p1, t.p2, t.start, t.start); |
| 1409 t.Return(load); | 1409 t.Return(load); |
| 1410 t.Lower(); | 1410 t.Lower(); |
| 1411 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1411 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
| 1412 CHECK_EQ(t.p0, load->InputAt(0)); | 1412 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1413 | 1413 |
| 1414 Node* index = CheckElementAccessArithmetic(access, load); | 1414 Node* index = CheckElementAccessArithmetic(access, load); |
| 1415 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index); | 1415 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index); |
| 1416 } | 1416 } |
| 1417 | 1417 |
| 1418 | 1418 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1438 | 1438 |
| 1439 | 1439 |
| 1440 TEST(InsertChangeForLoadElement) { | 1440 TEST(InsertChangeForLoadElement) { |
| 1441 // TODO(titzer): test all load/store representation change insertions. | 1441 // TODO(titzer): test all load/store representation change insertions. |
| 1442 TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); | 1442 TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); |
| 1443 ElementAccess access = {kNoBoundsCheck, kTaggedBase, | 1443 ElementAccess access = {kNoBoundsCheck, kTaggedBase, |
| 1444 FixedArrayBase::kHeaderSize, Type::Any(), | 1444 FixedArrayBase::kHeaderSize, Type::Any(), |
| 1445 kMachFloat64}; | 1445 kMachFloat64}; |
| 1446 | 1446 |
| 1447 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, | 1447 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, |
| 1448 t.p1, t.p1, t.start); | 1448 t.p1, t.p1, t.start, t.start); |
| 1449 t.Return(load); | 1449 t.Return(load); |
| 1450 t.Lower(); | 1450 t.Lower(); |
| 1451 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1451 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
| 1452 CHECK_EQ(t.p0, load->InputAt(0)); | 1452 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1453 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); | 1453 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 | 1456 |
| 1457 TEST(InsertChangeForLoadField) { | 1457 TEST(InsertChangeForLoadField) { |
| 1458 // TODO(titzer): test all load/store representation change insertions. | 1458 // TODO(titzer): test all load/store representation change insertions. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, | 1522 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, |
| 1523 load1, t.start); | 1523 load1, t.start); |
| 1524 t.Return(t.Use(phi, kMachineTypes[i])); | 1524 t.Return(t.Use(phi, kMachineTypes[i])); |
| 1525 t.Lower(); | 1525 t.Lower(); |
| 1526 | 1526 |
| 1527 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); | 1527 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); |
| 1528 CHECK_EQ(RepresentationOf(kMachineTypes[i]), | 1528 CHECK_EQ(RepresentationOf(kMachineTypes[i]), |
| 1529 RepresentationOf(OpParameter<MachineType>(phi))); | 1529 RepresentationOf(OpParameter<MachineType>(phi))); |
| 1530 } | 1530 } |
| 1531 } | 1531 } |
| OLD | NEW |