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/compilation-dependencies.h" | 5 #include "src/compilation-dependencies.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 CHECK_EQ(n, add->InputAt(0)); | 456 CHECK_EQ(n, add->InputAt(0)); |
457 CHECK_EQ(r, add->InputAt(1)); | 457 CHECK_EQ(r, add->InputAt(1)); |
458 R.CheckEffectInput(R.start(), effect_use); | 458 R.CheckEffectInput(R.start(), effect_use); |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 | 462 |
463 TEST(JSToNumberOfConstant) { | 463 TEST(JSToNumberOfConstant) { |
464 JSTypedLoweringTester R; | 464 JSTypedLoweringTester R; |
465 | 465 |
466 const Operator* ops[] = { | 466 const Operator* ops[] = {R.common.NumberConstant(0), |
467 R.common.NumberConstant(0), R.common.NumberConstant(-1), | 467 R.common.NumberConstant(-1), |
468 R.common.NumberConstant(0.1), R.common.Int32Constant(1177), | 468 R.common.NumberConstant(0.1)}; |
469 R.common.Float64Constant(0.99)}; | |
470 | 469 |
471 for (size_t i = 0; i < arraysize(ops); i++) { | 470 for (size_t i = 0; i < arraysize(ops); i++) { |
472 Node* n = R.graph.NewNode(ops[i]); | 471 Node* n = R.graph.NewNode(ops[i]); |
473 Node* convert = R.Unop(R.javascript.ToNumber(), n); | 472 Node* convert = R.Unop(R.javascript.ToNumber(), n); |
474 Node* r = R.reduce(convert); | 473 Node* r = R.reduce(convert); |
475 // Note that either outcome below is correct. It only depends on whether | 474 // Note that either outcome below is correct. It only depends on whether |
476 // the types of constants are eagerly computed or only computed by the | 475 // the types of constants are eagerly computed or only computed by the |
477 // typing pass. | 476 // typing pass. |
478 if (NodeProperties::GetType(n)->Is(Type::Number())) { | 477 if (NodeProperties::GetType(n)->Is(Type::Number())) { |
479 // If number constants are eagerly typed, then reduction should | 478 // If number constants are eagerly typed, then reduction should |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 CHECK_EQ(p1, r->InputAt(1)); | 1235 CHECK_EQ(p1, r->InputAt(1)); |
1237 } | 1236 } |
1238 } | 1237 } |
1239 } | 1238 } |
1240 } | 1239 } |
1241 } | 1240 } |
1242 | 1241 |
1243 } // namespace compiler | 1242 } // namespace compiler |
1244 } // namespace internal | 1243 } // namespace internal |
1245 } // namespace v8 | 1244 } // namespace v8 |
OLD | NEW |