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/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 CHECK_EQ(p0, r->InputAt(0)); | 255 CHECK_EQ(p0, r->InputAt(0)); |
256 CHECK_EQ(p1, r->InputAt(1)); | 256 CHECK_EQ(p1, r->InputAt(1)); |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) { | 263 static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) { |
264 Type* old_type = NodeProperties::GetBounds(old_input).upper; | 264 Type* old_type = NodeProperties::GetBounds(old_input).upper; |
265 Type* new_type = NodeProperties::GetBounds(new_input).upper; | |
266 Type* expected_type = I32Type(is_signed); | 265 Type* expected_type = I32Type(is_signed); |
267 CHECK(new_type->Is(expected_type)); | |
268 if (old_type->Is(expected_type)) { | 266 if (old_type->Is(expected_type)) { |
269 CHECK_EQ(old_input, new_input); | 267 CHECK_EQ(old_input, new_input); |
270 } else if (new_input->opcode() == IrOpcode::kNumberConstant) { | 268 } else if (new_input->opcode() == IrOpcode::kNumberConstant) { |
| 269 CHECK(NodeProperties::GetBounds(new_input).upper->Is(expected_type)); |
271 double v = OpParameter<double>(new_input); | 270 double v = OpParameter<double>(new_input); |
272 double e = static_cast<double>(is_signed ? FastD2I(v) : FastD2UI(v)); | 271 double e = static_cast<double>(is_signed ? FastD2I(v) : FastD2UI(v)); |
273 CHECK_EQ(e, v); | 272 CHECK_EQ(e, v); |
| 273 } else { |
| 274 CHECK_EQ(NumberToI32(is_signed), new_input->opcode()); |
274 } | 275 } |
275 } | 276 } |
276 | 277 |
277 | 278 |
278 // A helper class for testing lowering of bitwise shift operators. | 279 // A helper class for testing lowering of bitwise shift operators. |
279 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { | 280 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { |
280 public: | 281 public: |
281 static const int kNumberOps = 6; | 282 static const int kNumberOps = 6; |
282 const Operator* ops[kNumberOps]; | 283 const Operator* ops[kNumberOps]; |
283 bool signedness[kNumberOps]; | 284 bool signedness[kNumberOps]; |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 CHECK_EQ(p1, r->InputAt(0)); | 1378 CHECK_EQ(p1, r->InputAt(0)); |
1378 CHECK_EQ(p0, r->InputAt(1)); | 1379 CHECK_EQ(p0, r->InputAt(1)); |
1379 } else { | 1380 } else { |
1380 CHECK_EQ(p0, r->InputAt(0)); | 1381 CHECK_EQ(p0, r->InputAt(0)); |
1381 CHECK_EQ(p1, r->InputAt(1)); | 1382 CHECK_EQ(p1, r->InputAt(1)); |
1382 } | 1383 } |
1383 } | 1384 } |
1384 } | 1385 } |
1385 } | 1386 } |
1386 } | 1387 } |
OLD | NEW |