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