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

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2692753004: [turbofan] escape analysis supports arguments object and rest elements (Closed)
Patch Set: handle the case where Deoptimizer::function_ is a Smi Created 3 years, 9 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 | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/escape-analysis-reducer.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/effect-control-linearizer.h" 5 #include "src/compiler/effect-control-linearizer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/compiler-source-position-table.h" 9 #include "src/compiler/compiler-source-position-table.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
11 #include "src/compiler/linkage.h" 11 #include "src/compiler/linkage.h"
12 #include "src/compiler/node-matchers.h" 12 #include "src/compiler/node-matchers.h"
13 #include "src/compiler/node-properties.h" 13 #include "src/compiler/node-properties.h"
14 #include "src/compiler/node.h" 14 #include "src/compiler/node.h"
15 #include "src/compiler/schedule.h" 15 #include "src/compiler/schedule.h"
16 #include "src/objects-inl.h"
17 16
18 namespace v8 { 17 namespace v8 {
19 namespace internal { 18 namespace internal {
20 namespace compiler { 19 namespace compiler {
21 20
22 EffectControlLinearizer::EffectControlLinearizer( 21 EffectControlLinearizer::EffectControlLinearizer(
23 JSGraph* js_graph, Schedule* schedule, Zone* temp_zone, 22 JSGraph* js_graph, Schedule* schedule, Zone* temp_zone,
24 SourcePositionTable* source_positions) 23 SourcePositionTable* source_positions)
25 : js_graph_(js_graph), 24 : js_graph_(js_graph),
26 schedule_(schedule), 25 schedule_(schedule),
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 break; 731 break;
733 case IrOpcode::kObjectIsSmi: 732 case IrOpcode::kObjectIsSmi:
734 result = LowerObjectIsSmi(node); 733 result = LowerObjectIsSmi(node);
735 break; 734 break;
736 case IrOpcode::kObjectIsString: 735 case IrOpcode::kObjectIsString:
737 result = LowerObjectIsString(node); 736 result = LowerObjectIsString(node);
738 break; 737 break;
739 case IrOpcode::kObjectIsUndetectable: 738 case IrOpcode::kObjectIsUndetectable:
740 result = LowerObjectIsUndetectable(node); 739 result = LowerObjectIsUndetectable(node);
741 break; 740 break;
742 case IrOpcode::kNewRestParameterElements: 741 case IrOpcode::kArgumentsFrame:
743 result = LowerNewRestParameterElements(node); 742 result = LowerArgumentsFrame(node);
743 break;
744 case IrOpcode::kArgumentsLength:
745 result = LowerArgumentsLength(node);
744 break; 746 break;
745 case IrOpcode::kNewUnmappedArgumentsElements: 747 case IrOpcode::kNewUnmappedArgumentsElements:
746 result = LowerNewUnmappedArgumentsElements(node); 748 result = LowerNewUnmappedArgumentsElements(node);
747 break; 749 break;
748 case IrOpcode::kArrayBufferWasNeutered: 750 case IrOpcode::kArrayBufferWasNeutered:
749 result = LowerArrayBufferWasNeutered(node); 751 result = LowerArrayBufferWasNeutered(node);
750 break; 752 break;
751 case IrOpcode::kStringFromCharCode: 753 case IrOpcode::kStringFromCharCode:
752 result = LowerStringFromCharCode(node); 754 result = LowerStringFromCharCode(node);
753 break; 755 break;
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 __ Int32Constant(0)); 1834 __ Int32Constant(0));
1833 __ Goto(&done, vfalse); 1835 __ Goto(&done, vfalse);
1834 1836
1835 __ Bind(&if_smi); 1837 __ Bind(&if_smi);
1836 __ Goto(&done, __ Int32Constant(0)); 1838 __ Goto(&done, __ Int32Constant(0));
1837 1839
1838 __ Bind(&done); 1840 __ Bind(&done);
1839 return done.PhiAt(0); 1841 return done.PhiAt(0);
1840 } 1842 }
1841 1843
1842 Node* EffectControlLinearizer::LowerNewRestParameterElements(Node* node) { 1844 Node* EffectControlLinearizer::LowerArgumentsLength(Node* node) {
1843 int const formal_parameter_count = ParameterCountOf(node->op()); 1845 Node* arguments_frame = NodeProperties::GetValueInput(node, 0);
1846 int formal_parameter_count = FormalParameterCountOf(node->op());
1847 bool is_rest_length = IsRestLengthOf(node->op());
1848 DCHECK(formal_parameter_count >= 0);
1844 1849
1845 Callable const callable = CodeFactory::NewRestParameterElements(isolate()); 1850 if (is_rest_length) {
1846 Operator::Properties const properties = node->op()->properties(); 1851 // The ArgumentsLength node is computing the number of rest parameters,
1847 CallDescriptor::Flags const flags = CallDescriptor::kNoFlags; 1852 // which is max(0, actual_parameter_count - formal_parameter_count).
1848 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 1853 // We have to distinguish the case, when there is an arguments adaptor frame
1849 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); 1854 // (i.e., arguments_frame != LoadFramePointer()).
1850 return __ Call(desc, __ HeapConstant(callable.code()), 1855 auto if_adaptor_frame = __ MakeLabel<1>();
1851 __ IntPtrConstant(formal_parameter_count), 1856 auto done = __ MakeLabel<3>(MachineRepresentation::kTaggedSigned);
1852 __ NoContextConstant()); 1857
1858 Node* frame = __ LoadFramePointer();
1859 __ GotoIf(__ WordEqual(arguments_frame, frame), &done, __ SmiConstant(0));
1860 __ Goto(&if_adaptor_frame);
1861
1862 __ Bind(&if_adaptor_frame);
1863 Node* arguments_length = __ Load(
1864 MachineType::TaggedSigned(), arguments_frame,
1865 __ IntPtrConstant(ArgumentsAdaptorFrameConstants::kLengthOffset));
1866
1867 Node* rest_length =
1868 __ IntSub(arguments_length, __ SmiConstant(formal_parameter_count));
1869 __ GotoIf(__ IntLessThan(rest_length, __ SmiConstant(0)), &done,
1870 __ SmiConstant(0));
1871 __ Goto(&done, rest_length);
1872
1873 __ Bind(&done);
1874 return done.PhiAt(0);
1875 } else {
1876 // The ArgumentsLength node is computing the actual number of arguments.
1877 // We have to distinguish the case when there is an arguments adaptor frame
1878 // (i.e., arguments_frame != LoadFramePointer()).
1879 auto if_adaptor_frame = __ MakeLabel<1>();
1880 auto done = __ MakeLabel<2>(MachineRepresentation::kTaggedSigned);
1881
1882 Node* frame = __ LoadFramePointer();
1883 __ GotoIf(__ WordEqual(arguments_frame, frame), &done,
1884 __ SmiConstant(formal_parameter_count));
1885 __ Goto(&if_adaptor_frame);
1886
1887 __ Bind(&if_adaptor_frame);
1888 Node* arguments_length = __ Load(
1889 MachineType::TaggedSigned(), arguments_frame,
1890 __ IntPtrConstant(ArgumentsAdaptorFrameConstants::kLengthOffset));
1891 __ Goto(&done, arguments_length);
1892
1893 __ Bind(&done);
1894 return done.PhiAt(0);
1895 }
1896 }
1897
1898 Node* EffectControlLinearizer::LowerArgumentsFrame(Node* node) {
1899 auto done = __ MakeLabel<2>(MachineType::PointerRepresentation());
1900
1901 Node* frame = __ LoadFramePointer();
1902 Node* parent_frame =
1903 __ Load(MachineType::AnyTagged(), frame,
1904 __ IntPtrConstant(StandardFrameConstants::kCallerFPOffset));
1905 Node* parent_frame_type = __ Load(
1906 MachineType::AnyTagged(), parent_frame,
1907 __ IntPtrConstant(CommonFrameConstants::kContextOrFrameTypeOffset));
1908 __ GotoIf(__ WordEqual(parent_frame_type,
1909 __ IntPtrConstant(StackFrame::TypeToMarker(
1910 StackFrame::ARGUMENTS_ADAPTOR))),
1911 &done, parent_frame);
1912 __ Goto(&done, frame);
1913
1914 __ Bind(&done);
1915 return done.PhiAt(0);
1853 } 1916 }
1854 1917
1855 Node* EffectControlLinearizer::LowerNewUnmappedArgumentsElements(Node* node) { 1918 Node* EffectControlLinearizer::LowerNewUnmappedArgumentsElements(Node* node) {
1856 int const formal_parameter_count = ParameterCountOf(node->op()); 1919 Node* frame = NodeProperties::GetValueInput(node, 0);
1920 Node* length = NodeProperties::GetValueInput(node, 1);
1857 1921
1858 Callable const callable = 1922 Callable const callable =
1859 CodeFactory::NewUnmappedArgumentsElements(isolate()); 1923 CodeFactory::NewUnmappedArgumentsElements(isolate());
1860 Operator::Properties const properties = node->op()->properties(); 1924 Operator::Properties const properties = node->op()->properties();
1861 CallDescriptor::Flags const flags = CallDescriptor::kNoFlags; 1925 CallDescriptor::Flags const flags = CallDescriptor::kNoFlags;
1862 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 1926 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
1863 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); 1927 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties);
1864 return __ Call(desc, __ HeapConstant(callable.code()), 1928 return __ Call(desc, __ HeapConstant(callable.code()), frame, length,
1865 __ IntPtrConstant(formal_parameter_count),
1866 __ NoContextConstant()); 1929 __ NoContextConstant());
1867 } 1930 }
1868 1931
1869 Node* EffectControlLinearizer::LowerArrayBufferWasNeutered(Node* node) { 1932 Node* EffectControlLinearizer::LowerArrayBufferWasNeutered(Node* node) {
1870 Node* value = node->InputAt(0); 1933 Node* value = node->InputAt(0);
1871 1934
1872 Node* value_bit_field = 1935 Node* value_bit_field =
1873 __ LoadField(AccessBuilder::ForJSArrayBufferBitField(), value); 1936 __ LoadField(AccessBuilder::ForJSArrayBufferBitField(), value);
1874 return __ Word32Equal( 1937 return __ Word32Equal(
1875 __ Word32Equal( 1938 __ Word32Equal(
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2787 return isolate()->factory(); 2850 return isolate()->factory();
2788 } 2851 }
2789 2852
2790 Isolate* EffectControlLinearizer::isolate() const { 2853 Isolate* EffectControlLinearizer::isolate() const {
2791 return jsgraph()->isolate(); 2854 return jsgraph()->isolate();
2792 } 2855 }
2793 2856
2794 } // namespace compiler 2857 } // namespace compiler
2795 } // namespace internal 2858 } // namespace internal
2796 } // namespace v8 2859 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/escape-analysis-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698