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

Side by Side Diff: src/compiler/js-builtin-reducer.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 | « no previous file | test/mjsunit/compiler/regress-5538.js » ('j') | 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 6
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 return NoChange(); 880 return NoChange();
881 } 881 }
882 882
883 // ES6 section 20.1.2.13 Number.parseInt ( string, radix ) 883 // ES6 section 20.1.2.13 Number.parseInt ( string, radix )
884 Reduction JSBuiltinReducer::ReduceNumberParseInt(Node* node) { 884 Reduction JSBuiltinReducer::ReduceNumberParseInt(Node* node) {
885 JSCallReduction r(node); 885 JSCallReduction r(node);
886 if (r.InputsMatchOne(type_cache_.kSafeInteger) || 886 if (r.InputsMatchOne(type_cache_.kSafeInteger) ||
887 r.InputsMatchTwo(type_cache_.kSafeInteger, 887 r.InputsMatchTwo(type_cache_.kSafeInteger,
888 type_cache_.kZeroOrUndefined) || 888 type_cache_.kZeroOrUndefined) ||
889 r.InputsMatchTwo(type_cache_.kSafeInteger, type_cache_.kTenOrUndefined)) { 889 r.InputsMatchTwo(type_cache_.kSafeInteger, type_cache_.kTenOrUndefined)) {
890 // Number.parseInt(a:safe-integer) -> NumberToInt32(a) 890 // Number.parseInt(a:safe-integer) -> a
891 // Number.parseInt(a:safe-integer,b:#0\/undefined) -> NumberToInt32(a) 891 // Number.parseInt(a:safe-integer,b:#0\/undefined) -> a
892 // Number.parseInt(a:safe-integer,b:#10\/undefined) -> NumberToInt32(a) 892 // Number.parseInt(a:safe-integer,b:#10\/undefined) -> a
893 Node* input = r.GetJSCallInput(0); 893 Node* value = r.GetJSCallInput(0);
894 Node* value = graph()->NewNode(simplified()->NumberToInt32(), input);
895 return Replace(value); 894 return Replace(value);
896 } 895 }
897 return NoChange(); 896 return NoChange();
898 } 897 }
899 898
900 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) 899 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits )
901 Reduction JSBuiltinReducer::ReduceStringFromCharCode(Node* node) { 900 Reduction JSBuiltinReducer::ReduceStringFromCharCode(Node* node) {
902 JSCallReduction r(node); 901 JSCallReduction r(node);
903 if (r.InputsMatchOne(Type::PlainPrimitive())) { 902 if (r.InputsMatchOne(Type::PlainPrimitive())) {
904 // String.fromCharCode(a:plain-primitive) -> StringFromCharCode(a) 903 // String.fromCharCode(a:plain-primitive) -> StringFromCharCode(a)
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 return jsgraph()->simplified(); 1439 return jsgraph()->simplified();
1441 } 1440 }
1442 1441
1443 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 1442 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
1444 return jsgraph()->javascript(); 1443 return jsgraph()->javascript();
1445 } 1444 }
1446 1445
1447 } // namespace compiler 1446 } // namespace compiler
1448 } // namespace internal 1447 } // namespace internal
1449 } // namespace v8 1448 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-5538.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698