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

Side by Side Diff: src/compiler/js-create-lowering.cc

Issue 2838123004: [turbofan] Fix lowering of Array constructor with one argument. (Closed)
Patch Set: Created 3 years, 8 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/regress/regress-crbug-715404.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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-create-lowering.h" 5 #include "src/compiler/js-create-lowering.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 // where either no arguments are provided, or exactly one unsigned number 808 // where either no arguments are provided, or exactly one unsigned number
809 // argument is given. 809 // argument is given.
810 if (site->CanInlineCall()) { 810 if (site->CanInlineCall()) {
811 if (p.arity() == 0) { 811 if (p.arity() == 0) {
812 Node* length = jsgraph()->ZeroConstant(); 812 Node* length = jsgraph()->ZeroConstant();
813 int capacity = JSArray::kPreallocatedArrayElements; 813 int capacity = JSArray::kPreallocatedArrayElements;
814 return ReduceNewArray(node, length, capacity, site); 814 return ReduceNewArray(node, length, capacity, site);
815 } else if (p.arity() == 1) { 815 } else if (p.arity() == 1) {
816 Node* length = NodeProperties::GetValueInput(node, 2); 816 Node* length = NodeProperties::GetValueInput(node, 2);
817 Type* length_type = NodeProperties::GetType(length); 817 Type* length_type = NodeProperties::GetType(length);
818 if (!length_type->Maybe(Type::Unsigned32())) { 818 if (!length_type->Maybe(Type::Number())) {
819 // Handle the single argument case, where we know that the value 819 // Handle the single argument case, where we know that the value
820 // cannot be a valid Array length. 820 // cannot be a valid Array length.
821 return ReduceNewArray(node, {length}, site); 821 return ReduceNewArray(node, {length}, site);
Michael Achenbach 2017/04/26 12:36:08 Are you sure this code is covered? Sancov bot show
822 } 822 }
823 if (length_type->Is(Type::SignedSmall()) && length_type->Min() >= 0 && 823 if (length_type->Is(Type::SignedSmall()) && length_type->Min() >= 0 &&
824 length_type->Max() <= kElementLoopUnrollLimit && 824 length_type->Max() <= kElementLoopUnrollLimit &&
825 length_type->Min() == length_type->Max()) { 825 length_type->Min() == length_type->Max()) {
826 int capacity = static_cast<int>(length_type->Max()); 826 int capacity = static_cast<int>(length_type->Max());
827 return ReduceNewArray(node, length, capacity, site); 827 return ReduceNewArray(node, length, capacity, site);
828 } 828 }
829 } else if (p.arity() <= JSArray::kInitialMaxFastElementArray) { 829 } else if (p.arity() <= JSArray::kInitialMaxFastElementArray) {
830 std::vector<Node*> values; 830 std::vector<Node*> values;
831 values.reserve(p.arity()); 831 values.reserve(p.arity());
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 return jsgraph()->simplified(); 1443 return jsgraph()->simplified();
1444 } 1444 }
1445 1445
1446 MachineOperatorBuilder* JSCreateLowering::machine() const { 1446 MachineOperatorBuilder* JSCreateLowering::machine() const {
1447 return jsgraph()->machine(); 1447 return jsgraph()->machine();
1448 } 1448 }
1449 1449
1450 } // namespace compiler 1450 } // namespace compiler
1451 } // namespace internal 1451 } // namespace internal
1452 } // namespace v8 1452 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-715404.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698