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-graph.h" | 5 #include "src/compiler/js-graph.h" |
6 #include "src/compiler/js-typed-lowering.h" | 6 #include "src/compiler/js-typed-lowering.h" |
7 #include "src/compiler/machine-operator.h" | 7 #include "src/compiler/machine-operator.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 455 } |
456 | 456 |
457 | 457 |
458 TEST(JSToNumber_replacement) { | 458 TEST(JSToNumber_replacement) { |
459 JSTypedLoweringTester R; | 459 JSTypedLoweringTester R; |
460 | 460 |
461 Type* types[] = {Type::Null(), Type::Undefined(), Type::Number()}; | 461 Type* types[] = {Type::Null(), Type::Undefined(), Type::Number()}; |
462 | 462 |
463 for (size_t i = 0; i < arraysize(types); i++) { | 463 for (size_t i = 0; i < arraysize(types); i++) { |
464 Node* n = R.Parameter(types[i]); | 464 Node* n = R.Parameter(types[i]); |
465 Node* c = R.graph.NewNode(R.javascript.ToNumber(), n, R.context(), | 465 Node* c = |
466 R.start(), R.start()); | 466 R.graph.NewNode(R.javascript.ToNumber(), n, R.context(), |
| 467 R.EmptyFrameState(R.context()), R.start(), R.start()); |
467 Node* effect_use = R.UseForEffect(c); | 468 Node* effect_use = R.UseForEffect(c); |
468 Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(Type::Any()), n, c); | 469 Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(Type::Any()), n, c); |
469 | 470 |
470 R.CheckEffectInput(c, effect_use); | 471 R.CheckEffectInput(c, effect_use); |
471 Node* r = R.reduce(c); | 472 Node* r = R.reduce(c); |
472 | 473 |
473 if (types[i]->Is(Type::Number())) { | 474 if (types[i]->Is(Type::Number())) { |
474 CHECK_EQ(n, r); | 475 CHECK_EQ(n, r); |
475 } else { | 476 } else { |
476 CHECK_EQ(IrOpcode::kNumberConstant, r->opcode()); | 477 CHECK_EQ(IrOpcode::kNumberConstant, r->opcode()); |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 CHECK_EQ(p1, r->InputAt(0)); | 1275 CHECK_EQ(p1, r->InputAt(0)); |
1275 CHECK_EQ(p0, r->InputAt(1)); | 1276 CHECK_EQ(p0, r->InputAt(1)); |
1276 } else { | 1277 } else { |
1277 CHECK_EQ(p0, r->InputAt(0)); | 1278 CHECK_EQ(p0, r->InputAt(0)); |
1278 CHECK_EQ(p1, r->InputAt(1)); | 1279 CHECK_EQ(p1, r->InputAt(1)); |
1279 } | 1280 } |
1280 } | 1281 } |
1281 } | 1282 } |
1282 } | 1283 } |
1283 } | 1284 } |
OLD | NEW |