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 "src/compiler/js-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/typer.h" | 8 #include "src/compiler/typer.h" |
9 #include "test/unittests/compiler/graph-unittest.h" | 9 #include "test/unittests/compiler/graph-unittest.h" |
10 #include "test/unittests/compiler/node-test-utils.h" | 10 #include "test/unittests/compiler/node-test-utils.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 Node* p1 = Parameter(t1, 1); | 105 Node* p1 = Parameter(t1, 1); |
106 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f)); | 106 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f)); |
107 Node* call = graph()->NewNode( | 107 Node* call = graph()->NewNode( |
108 javascript()->CallFunction(4, NO_CALL_FUNCTION_FLAGS), fun, | 108 javascript()->CallFunction(4, NO_CALL_FUNCTION_FLAGS), fun, |
109 UndefinedConstant(), p0, p1); | 109 UndefinedConstant(), p0, p1); |
110 Reduction r = Reduce(call); | 110 Reduction r = Reduce(call); |
111 | 111 |
112 if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) { | 112 if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) { |
113 ASSERT_TRUE(r.Changed()); | 113 ASSERT_TRUE(r.Changed()); |
114 EXPECT_THAT(r.replacement(), | 114 EXPECT_THAT(r.replacement(), |
115 IsSelect(kMachNone, IsNumberLessThan(p1, p0), p1, p0)); | 115 IsSelect(kMachNone, IsNumberLessThan(p1, p0), p0, p1)); |
116 } else { | 116 } else { |
117 ASSERT_FALSE(r.Changed()); | 117 ASSERT_FALSE(r.Changed()); |
118 EXPECT_EQ(IrOpcode::kJSCallFunction, call->opcode()); | 118 EXPECT_EQ(IrOpcode::kJSCallFunction, call->opcode()); |
119 } | 119 } |
120 } | 120 } |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 // ----------------------------------------------------------------------------- | 125 // ----------------------------------------------------------------------------- |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 Reduction r = Reduce(call); | 167 Reduction r = Reduce(call); |
168 | 168 |
169 ASSERT_TRUE(r.Changed()); | 169 ASSERT_TRUE(r.Changed()); |
170 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); | 170 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 } // namespace compiler | 174 } // namespace compiler |
175 } // namespace internal | 175 } // namespace internal |
176 } // namespace v8 | 176 } // namespace v8 |
OLD | NEW |