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

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

Issue 1475613002: [turbofan] Introduce proper CreateLiteralParameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ArrayLiteral_LiteralIndexPush
Patch Set: Created 5 years 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 | « src/compiler/js-operator.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 NodeProperties::ChangeOp(node, new_op); 1758 NodeProperties::ChangeOp(node, new_op);
1759 return Changed(node); 1759 return Changed(node);
1760 } 1760 }
1761 1761
1762 return NoChange(); 1762 return NoChange();
1763 } 1763 }
1764 1764
1765 1765
1766 Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { 1766 Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) {
1767 DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode()); 1767 DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode());
1768 HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2)); 1768 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
1769 int length = Handle<FixedArray>::cast(mconst.Value())->length(); 1769 int const length = p.constants()->length();
1770 int flags = OpParameter<int>(node->op()); 1770 int const flags = p.flags();
1771 1771
1772 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the 1772 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the
1773 // initial length limit for arrays with "fast" elements kind. 1773 // initial length limit for arrays with "fast" elements kind.
1774 // TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub. 1774 // TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub.
1775 if ((flags & ArrayLiteral::kShallowElements) != 0 && 1775 if ((flags & ArrayLiteral::kShallowElements) != 0 &&
1776 (flags & ArrayLiteral::kIsStrong) == 0 && 1776 (flags & ArrayLiteral::kIsStrong) == 0 &&
1777 length < JSArray::kInitialMaxFastElementArray) { 1777 length < JSArray::kInitialMaxFastElementArray) {
1778 Isolate* isolate = jsgraph()->isolate(); 1778 Isolate* isolate = jsgraph()->isolate();
1779 Callable callable = CodeFactory::FastCloneShallowArray(isolate); 1779 Callable callable = CodeFactory::FastCloneShallowArray(isolate);
1780 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 1780 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
1781 isolate, graph()->zone(), callable.descriptor(), 0, 1781 isolate, graph()->zone(), callable.descriptor(), 0,
1782 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0) 1782 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0)
1783 ? CallDescriptor::kNeedsFrameState 1783 ? CallDescriptor::kNeedsFrameState
1784 : CallDescriptor::kNoFlags); 1784 : CallDescriptor::kNoFlags);
1785 const Operator* new_op = common()->Call(desc); 1785 const Operator* new_op = common()->Call(desc);
1786 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 1786 Node* stub_code = jsgraph()->HeapConstant(callable.code());
1787 Node* literal_index = jsgraph()->SmiConstant(p.index());
1788 Node* constant_elements = jsgraph()->HeapConstant(p.constants());
1787 node->InsertInput(graph()->zone(), 0, stub_code); 1789 node->InsertInput(graph()->zone(), 0, stub_code);
1790 node->InsertInput(graph()->zone(), 2, literal_index);
1791 node->InsertInput(graph()->zone(), 3, constant_elements);
1788 NodeProperties::ChangeOp(node, new_op); 1792 NodeProperties::ChangeOp(node, new_op);
1789 return Changed(node); 1793 return Changed(node);
1790 } 1794 }
1791 1795
1792 return NoChange(); 1796 return NoChange();
1793 } 1797 }
1794 1798
1795 1799
1796 Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) { 1800 Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) {
1797 DCHECK_EQ(IrOpcode::kJSCreateLiteralObject, node->opcode()); 1801 DCHECK_EQ(IrOpcode::kJSCreateLiteralObject, node->opcode());
1798 HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2)); 1802 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
1799 // Constants are pairs, see ObjectLiteral::properties_count(). 1803 // Constants are pairs, see ObjectLiteral::properties_count().
1800 int length = Handle<FixedArray>::cast(mconst.Value())->length() / 2; 1804 int const length = p.constants()->length() / 2;
1801 int flags = OpParameter<int>(node->op()); 1805 int const flags = p.flags();
1802 1806
1803 // Use the FastCloneShallowObjectStub only for shallow boilerplates without 1807 // Use the FastCloneShallowObjectStub only for shallow boilerplates without
1804 // elements up to the number of properties that the stubs can handle. 1808 // elements up to the number of properties that the stubs can handle.
1805 if ((flags & ObjectLiteral::kShallowProperties) != 0 && 1809 if ((flags & ObjectLiteral::kShallowProperties) != 0 &&
1806 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) { 1810 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) {
1807 Isolate* isolate = jsgraph()->isolate(); 1811 Isolate* isolate = jsgraph()->isolate();
1808 Callable callable = CodeFactory::FastCloneShallowObject(isolate, length); 1812 Callable callable = CodeFactory::FastCloneShallowObject(isolate, length);
1809 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 1813 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
1810 isolate, graph()->zone(), callable.descriptor(), 0, 1814 isolate, graph()->zone(), callable.descriptor(), 0,
1811 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0) 1815 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0)
1812 ? CallDescriptor::kNeedsFrameState 1816 ? CallDescriptor::kNeedsFrameState
1813 : CallDescriptor::kNoFlags); 1817 : CallDescriptor::kNoFlags);
1814 const Operator* new_op = common()->Call(desc); 1818 const Operator* new_op = common()->Call(desc);
1815 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 1819 Node* stub_code = jsgraph()->HeapConstant(callable.code());
1816 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(flags)); 1820 Node* literal_index = jsgraph()->SmiConstant(p.index());
1821 Node* literal_flags = jsgraph()->SmiConstant(flags);
1822 Node* constant_elements = jsgraph()->HeapConstant(p.constants());
1817 node->InsertInput(graph()->zone(), 0, stub_code); 1823 node->InsertInput(graph()->zone(), 0, stub_code);
1824 node->InsertInput(graph()->zone(), 2, literal_index);
1825 node->InsertInput(graph()->zone(), 3, constant_elements);
1826 node->InsertInput(graph()->zone(), 4, literal_flags);
1818 NodeProperties::ChangeOp(node, new_op); 1827 NodeProperties::ChangeOp(node, new_op);
1819 return Changed(node); 1828 return Changed(node);
1820 } 1829 }
1821 1830
1822 return NoChange(); 1831 return NoChange();
1823 } 1832 }
1824 1833
1825 1834
1826 Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) { 1835 Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
1827 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode()); 1836 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 } 2620 }
2612 2621
2613 2622
2614 CompilationDependencies* JSTypedLowering::dependencies() const { 2623 CompilationDependencies* JSTypedLowering::dependencies() const {
2615 return dependencies_; 2624 return dependencies_;
2616 } 2625 }
2617 2626
2618 } // namespace compiler 2627 } // namespace compiler
2619 } // namespace internal 2628 } // namespace internal
2620 } // namespace v8 2629 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698