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