Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: test/unittests/compiler/js-builtin-reducer-unittest.cc

Issue 2432143002: [turbofan] Fix invalid Number.parseInt inlining. (Closed)
Patch Set: Fix unittests. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/compiler/regress-5538.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 Node* context = UndefinedConstant(); 1510 Node* context = UndefinedConstant();
1511 Node* frame_state = graph()->start(); 1511 Node* frame_state = graph()->start();
1512 TRACED_FOREACH(Type*, t0, kIntegral32Types) { 1512 TRACED_FOREACH(Type*, t0, kIntegral32Types) {
1513 Node* p0 = Parameter(t0, 0); 1513 Node* p0 = Parameter(t0, 0);
1514 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1514 Node* call = graph()->NewNode(javascript()->CallFunction(3), function,
1515 UndefinedConstant(), p0, context, frame_state, 1515 UndefinedConstant(), p0, context, frame_state,
1516 effect, control); 1516 effect, control);
1517 Reduction r = Reduce(call); 1517 Reduction r = Reduce(call);
1518 1518
1519 ASSERT_TRUE(r.Changed()); 1519 ASSERT_TRUE(r.Changed());
1520 EXPECT_THAT(r.replacement(), IsNumberToInt32(p0)); 1520 EXPECT_EQ(p0, r.replacement());
1521 } 1521 }
1522 } 1522 }
1523 1523
1524 TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32AndUndefined) { 1524 TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32AndUndefined) {
1525 Node* function = NumberFunction("parseInt"); 1525 Node* function = NumberFunction("parseInt");
1526 1526
1527 Node* effect = graph()->start(); 1527 Node* effect = graph()->start();
1528 Node* control = graph()->start(); 1528 Node* control = graph()->start();
1529 Node* context = UndefinedConstant(); 1529 Node* context = UndefinedConstant();
1530 Node* frame_state = graph()->start(); 1530 Node* frame_state = graph()->start();
1531 TRACED_FOREACH(Type*, t0, kIntegral32Types) { 1531 TRACED_FOREACH(Type*, t0, kIntegral32Types) {
1532 Node* p0 = Parameter(t0, 0); 1532 Node* p0 = Parameter(t0, 0);
1533 Node* p1 = Parameter(Type::Undefined(), 1); 1533 Node* p1 = Parameter(Type::Undefined(), 1);
1534 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 1534 Node* call = graph()->NewNode(javascript()->CallFunction(4), function,
1535 UndefinedConstant(), p0, p1, context, 1535 UndefinedConstant(), p0, p1, context,
1536 frame_state, effect, control); 1536 frame_state, effect, control);
1537 Reduction r = Reduce(call); 1537 Reduction r = Reduce(call);
1538 1538
1539 ASSERT_TRUE(r.Changed()); 1539 ASSERT_TRUE(r.Changed());
1540 EXPECT_THAT(r.replacement(), IsNumberToInt32(p0)); 1540 EXPECT_EQ(p0, r.replacement());
1541 } 1541 }
1542 } 1542 }
1543 1543
1544 // ----------------------------------------------------------------------------- 1544 // -----------------------------------------------------------------------------
1545 // String.fromCharCode 1545 // String.fromCharCode
1546 1546
1547 TEST_F(JSBuiltinReducerTest, StringFromCharCodeWithNumber) { 1547 TEST_F(JSBuiltinReducerTest, StringFromCharCodeWithNumber) {
1548 Node* function = StringFunction("fromCharCode"); 1548 Node* function = StringFunction("fromCharCode");
1549 1549
1550 Node* effect = graph()->start(); 1550 Node* effect = graph()->start();
(...skipping 26 matching lines...) Expand all
1577 Reduction r = Reduce(call); 1577 Reduction r = Reduce(call);
1578 1578
1579 ASSERT_TRUE(r.Changed()); 1579 ASSERT_TRUE(r.Changed());
1580 EXPECT_THAT(r.replacement(), 1580 EXPECT_THAT(r.replacement(),
1581 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0))); 1581 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0)));
1582 } 1582 }
1583 1583
1584 } // namespace compiler 1584 } // namespace compiler
1585 } // namespace internal 1585 } // namespace internal
1586 } // namespace v8 1586 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/regress-5538.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698