OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this | 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include <cmath> | 5 #include <cmath> |
6 #include <functional> | 6 #include <functional> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 CHECK_EQ(7, m.Call(uint32_t(0xdfbec580))); | 65 CHECK_EQ(7, m.Call(uint32_t(0xdfbec580))); |
66 CHECK_EQ(6, m.Call(uint32_t(0x27a9db40))); | 66 CHECK_EQ(6, m.Call(uint32_t(0x27a9db40))); |
67 CHECK_EQ(5, m.Call(uint32_t(0xde3bcb20))); | 67 CHECK_EQ(5, m.Call(uint32_t(0xde3bcb20))); |
68 CHECK_EQ(4, m.Call(uint32_t(0xd7e8a610))); | 68 CHECK_EQ(4, m.Call(uint32_t(0xd7e8a610))); |
69 CHECK_EQ(3, m.Call(uint32_t(0x9afdbc88))); | 69 CHECK_EQ(3, m.Call(uint32_t(0x9afdbc88))); |
70 CHECK_EQ(2, m.Call(uint32_t(0x9afdbc84))); | 70 CHECK_EQ(2, m.Call(uint32_t(0x9afdbc84))); |
71 CHECK_EQ(1, m.Call(uint32_t(0x9afdbc82))); | 71 CHECK_EQ(1, m.Call(uint32_t(0x9afdbc82))); |
72 CHECK_EQ(0, m.Call(uint32_t(0x9afdbc81))); | 72 CHECK_EQ(0, m.Call(uint32_t(0x9afdbc81))); |
73 } | 73 } |
74 | 74 |
75 TEST(RunStackSlot) { | |
titzer
2016/01/28 09:02:18
Can you write another test that tries the same for
ahaas
2016/01/28 14:55:44
Done.
| |
76 BufferedRawMachineAssemblerTester<double> m; | |
77 | |
78 Node* slot1 = m.StackSlot(MachineRepresentation::kFloat64); | |
79 Node* slot2 = m.StackSlot(MachineRepresentation::kWord32); | |
80 | |
81 m.Store(MachineRepresentation::kFloat64, slot1, m.Float64Constant(2143.64543), | |
82 WriteBarrierKind::kNoWriteBarrier); | |
83 m.Store(MachineRepresentation::kWord32, slot2, m.Int32Constant(2143), | |
84 WriteBarrierKind::kNoWriteBarrier); | |
85 m.Return(m.Load(MachineType::Float64(), slot1)); | |
86 | |
87 CHECK_EQ(2143.64543, m.Call()); | |
88 } | |
75 | 89 |
76 TEST(RunWord32Clz) { | 90 TEST(RunWord32Clz) { |
77 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32()); | 91 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32()); |
78 m.Return(m.Word32Clz(m.Parameter(0))); | 92 m.Return(m.Word32Clz(m.Parameter(0))); |
79 | 93 |
80 CHECK_EQ(0, m.Call(uint32_t(0x80001000))); | 94 CHECK_EQ(0, m.Call(uint32_t(0x80001000))); |
81 CHECK_EQ(1, m.Call(uint32_t(0x40000500))); | 95 CHECK_EQ(1, m.Call(uint32_t(0x40000500))); |
82 CHECK_EQ(2, m.Call(uint32_t(0x20000300))); | 96 CHECK_EQ(2, m.Call(uint32_t(0x20000300))); |
83 CHECK_EQ(3, m.Call(uint32_t(0x10000003))); | 97 CHECK_EQ(3, m.Call(uint32_t(0x10000003))); |
84 CHECK_EQ(4, m.Call(uint32_t(0x08050000))); | 98 CHECK_EQ(4, m.Call(uint32_t(0x08050000))); |
(...skipping 5998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6083 Node* call = r.AddNode(r.common()->Call(desc), phi); | 6097 Node* call = r.AddNode(r.common()->Call(desc), phi); |
6084 r.Return(call); | 6098 r.Return(call); |
6085 | 6099 |
6086 CHECK_EQ(33, r.Call(1)); | 6100 CHECK_EQ(33, r.Call(1)); |
6087 CHECK_EQ(44, r.Call(0)); | 6101 CHECK_EQ(44, r.Call(0)); |
6088 } | 6102 } |
6089 | 6103 |
6090 } // namespace compiler | 6104 } // namespace compiler |
6091 } // namespace internal | 6105 } // namespace internal |
6092 } // namespace v8 | 6106 } // namespace v8 |
OLD | NEW |