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

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

Issue 1475383002: [compiler] Always pass closure argument to with, catch and block context creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove WithExpression from messages.h 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/ast-graph-builder.cc ('k') | src/full-codegen/arm/full-codegen-arm.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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 1831
1832 return NoChange(); 1832 return NoChange();
1833 } 1833 }
1834 1834
1835 1835
1836 Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) { 1836 Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
1837 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode()); 1837 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
1838 int slot_count = OpParameter<int>(node->op()); 1838 int slot_count = OpParameter<int>(node->op());
1839 Node* const closure = NodeProperties::GetValueInput(node, 0); 1839 Node* const closure = NodeProperties::GetValueInput(node, 0);
1840 1840
1841 // The closure can be NumberConstant(0) if the closure is global code
1842 // (rather than a function). We exclude that case here.
1843 // TODO(jarin) Find a better way to check that the closure is a function.
1844
1845 // Use inline allocation for function contexts up to a size limit. 1841 // Use inline allocation for function contexts up to a size limit.
1846 if (slot_count < kFunctionContextAllocationLimit && 1842 if (slot_count < kFunctionContextAllocationLimit) {
1847 closure->opcode() != IrOpcode::kNumberConstant) {
1848 // JSCreateFunctionContext[slot_count < limit]](fun) 1843 // JSCreateFunctionContext[slot_count < limit]](fun)
1849 Node* const effect = NodeProperties::GetEffectInput(node); 1844 Node* const effect = NodeProperties::GetEffectInput(node);
1850 Node* const control = NodeProperties::GetControlInput(node); 1845 Node* const control = NodeProperties::GetControlInput(node);
1851 Node* const context = NodeProperties::GetContextInput(node); 1846 Node* const context = NodeProperties::GetContextInput(node);
1852 Node* const extension = jsgraph()->ZeroConstant(); 1847 Node* const extension = jsgraph()->ZeroConstant();
1853 Node* const load = graph()->NewNode( 1848 Node* const load = graph()->NewNode(
1854 simplified()->LoadField( 1849 simplified()->LoadField(
1855 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1850 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
1856 context, effect, control); 1851 context, effect, control);
1857 AllocationBuilder a(jsgraph(), effect, control); 1852 AllocationBuilder a(jsgraph(), effect, control);
(...skipping 27 matching lines...) Expand all
1885 } 1880 }
1886 1881
1887 return NoChange(); 1882 return NoChange();
1888 } 1883 }
1889 1884
1890 1885
1891 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { 1886 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
1892 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); 1887 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
1893 Node* const input = NodeProperties::GetValueInput(node, 0); 1888 Node* const input = NodeProperties::GetValueInput(node, 0);
1894 Node* const closure = NodeProperties::GetValueInput(node, 1); 1889 Node* const closure = NodeProperties::GetValueInput(node, 1);
1895 Type* input_type = NodeProperties::GetType(input); 1890 Type* const input_type = NodeProperties::GetType(input);
1896
1897 // The closure can be NumberConstant(0) if the closure is global code
1898 // (rather than a function). We exclude that case here.
1899 // TODO(jarin) Find a better way to check that the closure is a function.
1900 1891
1901 // Use inline allocation for with contexts for regular objects. 1892 // Use inline allocation for with contexts for regular objects.
1902 if (input_type->Is(Type::Receiver()) && 1893 if (input_type->Is(Type::Receiver())) {
1903 closure->opcode() != IrOpcode::kNumberConstant) {
1904 // JSCreateWithContext(o:receiver, fun) 1894 // JSCreateWithContext(o:receiver, fun)
1905 Node* const effect = NodeProperties::GetEffectInput(node); 1895 Node* const effect = NodeProperties::GetEffectInput(node);
1906 Node* const control = NodeProperties::GetControlInput(node); 1896 Node* const control = NodeProperties::GetControlInput(node);
1907 Node* const context = NodeProperties::GetContextInput(node); 1897 Node* const context = NodeProperties::GetContextInput(node);
1908 Node* const load = graph()->NewNode( 1898 Node* const load = graph()->NewNode(
1909 simplified()->LoadField( 1899 simplified()->LoadField(
1910 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1900 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
1911 context, effect, control); 1901 context, effect, control);
1912 AllocationBuilder a(jsgraph(), effect, control); 1902 AllocationBuilder a(jsgraph(), effect, control);
1913 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. 1903 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
(...skipping 10 matching lines...) Expand all
1924 return NoChange(); 1914 return NoChange();
1925 } 1915 }
1926 1916
1927 1917
1928 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { 1918 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
1929 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); 1919 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
1930 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); 1920 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node);
1931 int context_length = scope_info->ContextLength(); 1921 int context_length = scope_info->ContextLength();
1932 Node* const closure = NodeProperties::GetValueInput(node, 0); 1922 Node* const closure = NodeProperties::GetValueInput(node, 0);
1933 1923
1934 // The closure can be NumberConstant(0) if the closure is global code
1935 // (rather than a function). We exclude that case here.
1936 // TODO(jarin) Find a better way to check that the closure is a function.
1937
1938 // Use inline allocation for block contexts up to a size limit. 1924 // Use inline allocation for block contexts up to a size limit.
1939 if (context_length < kBlockContextAllocationLimit && 1925 if (context_length < kBlockContextAllocationLimit) {
1940 closure->opcode() != IrOpcode::kNumberConstant) {
1941 // JSCreateBlockContext[scope[length < limit]](fun) 1926 // JSCreateBlockContext[scope[length < limit]](fun)
1942 Node* const effect = NodeProperties::GetEffectInput(node); 1927 Node* const effect = NodeProperties::GetEffectInput(node);
1943 Node* const control = NodeProperties::GetControlInput(node); 1928 Node* const control = NodeProperties::GetControlInput(node);
1944 Node* const context = NodeProperties::GetContextInput(node); 1929 Node* const context = NodeProperties::GetContextInput(node);
1945 Node* const extension = jsgraph()->Constant(scope_info); 1930 Node* const extension = jsgraph()->Constant(scope_info);
1946 Node* const load = graph()->NewNode( 1931 Node* const load = graph()->NewNode(
1947 simplified()->LoadField( 1932 simplified()->LoadField(
1948 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1933 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
1949 context, effect, control); 1934 context, effect, control);
1950 AllocationBuilder a(jsgraph(), effect, control); 1935 AllocationBuilder a(jsgraph(), effect, control);
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 } 2606 }
2622 2607
2623 2608
2624 CompilationDependencies* JSTypedLowering::dependencies() const { 2609 CompilationDependencies* JSTypedLowering::dependencies() const {
2625 return dependencies_; 2610 return dependencies_;
2626 } 2611 }
2627 2612
2628 } // namespace compiler 2613 } // namespace compiler
2629 } // namespace internal 2614 } // namespace internal
2630 } // namespace v8 2615 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698