| 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/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
| 9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Math.imul | 142 // Math.imul |
| 143 | 143 |
| 144 | 144 |
| 145 TEST_F(JSBuiltinReducerTest, MathImul) { | 145 TEST_F(JSBuiltinReducerTest, MathImul) { |
| 146 Node* function = MathFunction("imul"); | 146 Node* function = MathFunction("imul"); |
| 147 | 147 |
| 148 Node* effect = graph()->start(); | 148 Node* effect = graph()->start(); |
| 149 Node* control = graph()->start(); | 149 Node* control = graph()->start(); |
| 150 Node* context = UndefinedConstant(); | 150 Node* context = UndefinedConstant(); |
| 151 Node* frame_state = graph()->start(); | 151 Node* frame_state = graph()->start(); |
| 152 TRACED_FOREACH(Type*, t0, kIntegral32Types) { | 152 TRACED_FOREACH(Type*, t0, kNumberTypes) { |
| 153 TRACED_FOREACH(Type*, t1, kIntegral32Types) { | 153 TRACED_FOREACH(Type*, t1, kNumberTypes) { |
| 154 Node* p0 = Parameter(t0, 0); | 154 Node* p0 = Parameter(t0, 0); |
| 155 Node* p1 = Parameter(t1, 1); | 155 Node* p1 = Parameter(t1, 1); |
| 156 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, | 156 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, |
| 157 UndefinedConstant(), p0, p1, context, | 157 UndefinedConstant(), p0, p1, context, |
| 158 frame_state, frame_state, effect, control); | 158 frame_state, frame_state, effect, control); |
| 159 Reduction r = Reduce(call); | 159 Reduction r = Reduce(call); |
| 160 | 160 |
| 161 ASSERT_TRUE(r.Changed()); | 161 ASSERT_TRUE(r.Changed()); |
| 162 EXPECT_THAT(r.replacement(), IsInt32Mul(p0, p1)); | 162 EXPECT_THAT(r.replacement(), |
| 163 IsNumberImul(IsNumberToUint32(p0), IsNumberToUint32(p1))); |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 } | 166 } |
| 166 | 167 |
| 167 | 168 |
| 168 // ----------------------------------------------------------------------------- | 169 // ----------------------------------------------------------------------------- |
| 169 // Math.fround | 170 // Math.fround |
| 170 | 171 |
| 171 | 172 |
| 172 TEST_F(JSBuiltinReducerTest, MathFround) { | 173 TEST_F(JSBuiltinReducerTest, MathFround) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 184 Reduction r = Reduce(call); | 185 Reduction r = Reduce(call); |
| 185 | 186 |
| 186 ASSERT_TRUE(r.Changed()); | 187 ASSERT_TRUE(r.Changed()); |
| 187 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); | 188 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 } // namespace compiler | 192 } // namespace compiler |
| 192 } // namespace internal | 193 } // namespace internal |
| 193 } // namespace v8 | 194 } // namespace v8 |
| OLD | NEW |