| OLD | NEW |
| 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 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 | 1810 |
| 1811 // Remove the eager bailout frame state. | 1811 // Remove the eager bailout frame state. |
| 1812 NodeProperties::RemoveFrameStateInput(node, 1); | 1812 NodeProperties::RemoveFrameStateInput(node, 1); |
| 1813 | 1813 |
| 1814 // Compute flags for the call. | 1814 // Compute flags for the call. |
| 1815 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; | 1815 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; |
| 1816 if (p.tail_call_mode() == TailCallMode::kAllow) { | 1816 if (p.tail_call_mode() == TailCallMode::kAllow) { |
| 1817 flags |= CallDescriptor::kSupportsTailCalls; | 1817 flags |= CallDescriptor::kSupportsTailCalls; |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 Node* new_target = jsgraph()->UndefinedConstant(); |
| 1821 Node* argument_count = jsgraph()->Int32Constant(arity); |
| 1820 if (shared->internal_formal_parameter_count() == arity || | 1822 if (shared->internal_formal_parameter_count() == arity || |
| 1821 shared->internal_formal_parameter_count() == | 1823 shared->internal_formal_parameter_count() == |
| 1822 SharedFunctionInfo::kDontAdaptArgumentsSentinel) { | 1824 SharedFunctionInfo::kDontAdaptArgumentsSentinel) { |
| 1823 Node* new_target = jsgraph()->UndefinedConstant(); | |
| 1824 Node* argument_count = jsgraph()->Int32Constant(arity); | |
| 1825 // Patch {node} to a direct call. | 1825 // Patch {node} to a direct call. |
| 1826 node->InsertInput(graph()->zone(), arity + 2, new_target); | 1826 node->InsertInput(graph()->zone(), arity + 2, new_target); |
| 1827 node->InsertInput(graph()->zone(), arity + 3, argument_count); | 1827 node->InsertInput(graph()->zone(), arity + 3, argument_count); |
| 1828 NodeProperties::ChangeOp(node, | 1828 NodeProperties::ChangeOp(node, |
| 1829 common()->Call(Linkage::GetJSCallDescriptor( | 1829 common()->Call(Linkage::GetJSCallDescriptor( |
| 1830 graph()->zone(), false, 1 + arity, flags))); | 1830 graph()->zone(), false, 1 + arity, flags))); |
| 1831 } else { | 1831 } else { |
| 1832 // Patch {node} to an indirect call via the ArgumentsAdaptorTrampoline. | 1832 // Patch {node} to an indirect call via the ArgumentsAdaptorTrampoline. |
| 1833 Callable callable = CodeFactory::ArgumentAdaptor(isolate()); | 1833 Callable callable = CodeFactory::ArgumentAdaptor(isolate()); |
| 1834 node->InsertInput(graph()->zone(), 0, | 1834 node->InsertInput(graph()->zone(), 0, |
| 1835 jsgraph()->HeapConstant(callable.code())); | 1835 jsgraph()->HeapConstant(callable.code())); |
| 1836 node->InsertInput(graph()->zone(), 2, jsgraph()->Int32Constant(arity)); | 1836 node->InsertInput(graph()->zone(), 2, new_target); |
| 1837 node->InsertInput(graph()->zone(), 3, argument_count); |
| 1837 node->InsertInput( | 1838 node->InsertInput( |
| 1838 graph()->zone(), 3, | 1839 graph()->zone(), 4, |
| 1839 jsgraph()->Int32Constant(shared->internal_formal_parameter_count())); | 1840 jsgraph()->Int32Constant(shared->internal_formal_parameter_count())); |
| 1840 NodeProperties::ChangeOp( | 1841 NodeProperties::ChangeOp( |
| 1841 node, common()->Call(Linkage::GetStubCallDescriptor( | 1842 node, common()->Call(Linkage::GetStubCallDescriptor( |
| 1842 isolate(), graph()->zone(), callable.descriptor(), | 1843 isolate(), graph()->zone(), callable.descriptor(), |
| 1843 1 + arity, flags))); | 1844 1 + arity, flags))); |
| 1844 } | 1845 } |
| 1845 return Changed(node); | 1846 return Changed(node); |
| 1846 } | 1847 } |
| 1847 | 1848 |
| 1848 // Check if {target} is a JSFunction. | 1849 // Check if {target} is a JSFunction. |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2385 } | 2386 } |
| 2386 | 2387 |
| 2387 | 2388 |
| 2388 CompilationDependencies* JSTypedLowering::dependencies() const { | 2389 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2389 return dependencies_; | 2390 return dependencies_; |
| 2390 } | 2391 } |
| 2391 | 2392 |
| 2392 } // namespace compiler | 2393 } // namespace compiler |
| 2393 } // namespace internal | 2394 } // namespace internal |
| 2394 } // namespace v8 | 2395 } // namespace v8 |
| OLD | NEW |