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

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

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

Powered by Google App Engine
This is Rietveld 408576698