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 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, | 1503 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, |
1504 load1, t.start); | 1504 load1, t.start); |
1505 t.Return(t.Use(phi, kMachineTypes[i])); | 1505 t.Return(t.Use(phi, kMachineTypes[i])); |
1506 t.Lower(); | 1506 t.Lower(); |
1507 | 1507 |
1508 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); | 1508 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); |
1509 CHECK_EQ(RepresentationOf(kMachineTypes[i]), | 1509 CHECK_EQ(RepresentationOf(kMachineTypes[i]), |
1510 RepresentationOf(OpParameter<MachineType>(phi))); | 1510 RepresentationOf(OpParameter<MachineType>(phi))); |
1511 } | 1511 } |
1512 } | 1512 } |
| 1513 |
| 1514 |
| 1515 // TODO(titzer): this tests current behavior of assuming an implicit |
| 1516 // representation change in loading float32s. Fix when float32 is fully |
| 1517 // supported. |
| 1518 TEST(ImplicitFloat32ToFloat64InLoads) { |
| 1519 TestingGraph t(Type::Any()); |
| 1520 |
| 1521 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
| 1522 Handle<Name>::null(), Type::Any(), kMachFloat32}; |
| 1523 |
| 1524 Node* load = |
| 1525 t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, t.start); |
| 1526 t.Return(load); |
| 1527 t.Lower(); |
| 1528 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
| 1529 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1530 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
| 1531 } |
| 1532 |
| 1533 |
| 1534 TEST(ImplicitFloat64ToFloat32InStores) { |
| 1535 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1536 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
| 1537 Handle<Name>::null(), Type::Any(), kMachFloat32}; |
| 1538 |
| 1539 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1540 t.p1, t.start, t.start); |
| 1541 t.Effect(store); |
| 1542 t.Lower(); |
| 1543 |
| 1544 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1545 CHECK_EQ(t.p0, store->InputAt(0)); |
| 1546 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
| 1547 } |
OLD | NEW |