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; |
265 Type* expected_type = I32Type(is_signed); | 266 Type* expected_type = I32Type(is_signed); |
| 267 CHECK(new_type->Is(expected_type)); |
266 if (old_type->Is(expected_type)) { | 268 if (old_type->Is(expected_type)) { |
267 CHECK_EQ(old_input, new_input); | 269 CHECK_EQ(old_input, new_input); |
268 } else if (new_input->opcode() == IrOpcode::kNumberConstant) { | 270 } else if (new_input->opcode() == IrOpcode::kNumberConstant) { |
269 CHECK(NodeProperties::GetBounds(new_input).upper->Is(expected_type)); | |
270 double v = OpParameter<double>(new_input); | 271 double v = OpParameter<double>(new_input); |
271 double e = static_cast<double>(is_signed ? FastD2I(v) : FastD2UI(v)); | 272 double e = static_cast<double>(is_signed ? FastD2I(v) : FastD2UI(v)); |
272 CHECK_EQ(e, v); | 273 CHECK_EQ(e, v); |
273 } else { | |
274 CHECK_EQ(NumberToI32(is_signed), new_input->opcode()); | |
275 } | 274 } |
276 } | 275 } |
277 | 276 |
278 | 277 |
279 // A helper class for testing lowering of bitwise shift operators. | 278 // A helper class for testing lowering of bitwise shift operators. |
280 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { | 279 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { |
281 public: | 280 public: |
282 static const int kNumberOps = 6; | 281 static const int kNumberOps = 6; |
283 const Operator* ops[kNumberOps]; | 282 const Operator* ops[kNumberOps]; |
284 bool signedness[kNumberOps]; | 283 bool signedness[kNumberOps]; |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 CHECK_EQ(p1, r->InputAt(0)); | 1377 CHECK_EQ(p1, r->InputAt(0)); |
1379 CHECK_EQ(p0, r->InputAt(1)); | 1378 CHECK_EQ(p0, r->InputAt(1)); |
1380 } else { | 1379 } else { |
1381 CHECK_EQ(p0, r->InputAt(0)); | 1380 CHECK_EQ(p0, r->InputAt(0)); |
1382 CHECK_EQ(p1, r->InputAt(1)); | 1381 CHECK_EQ(p1, r->InputAt(1)); |
1383 } | 1382 } |
1384 } | 1383 } |
1385 } | 1384 } |
1386 } | 1385 } |
1387 } | 1386 } |
OLD | NEW |