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

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

Issue 2499573002: [turbofan] Fix a couple of invalid Uint32Constant/Int32Constant uses. (Closed)
Patch Set: Created 4 years, 1 month 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-inlining.cc ('k') | no next file » | 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/compiler/js-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 6
7 #include "src/ast/modules.h" 7 #include "src/ast/modules.h"
8 #include "src/builtins/builtins-utils.h" 8 #include "src/builtins/builtins-utils.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compilation-dependencies.h" 10 #include "src/compilation-dependencies.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 effect = graph()->NewNode( 665 effect = graph()->NewNode(
666 common()->BeginRegion(RegionObservability::kNotObservable), effect); 666 common()->BeginRegion(RegionObservability::kNotObservable), effect);
667 Node* value = effect = 667 Node* value = effect =
668 graph()->NewNode(simplified()->Allocate(NOT_TENURED), 668 graph()->NewNode(simplified()->Allocate(NOT_TENURED),
669 jsgraph()->Constant(ConsString::kSize), effect, control); 669 jsgraph()->Constant(ConsString::kSize), effect, control);
670 NodeProperties::SetType(value, Type::OtherString()); 670 NodeProperties::SetType(value, Type::OtherString());
671 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 671 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
672 value, value_map, effect, control); 672 value, value_map, effect, control);
673 effect = graph()->NewNode( 673 effect = graph()->NewNode(
674 simplified()->StoreField(AccessBuilder::ForNameHashField()), value, 674 simplified()->StoreField(AccessBuilder::ForNameHashField()), value,
675 jsgraph()->Uint32Constant(Name::kEmptyHashField), effect, control); 675 jsgraph()->Constant(Name::kEmptyHashField), effect, control);
676 effect = graph()->NewNode( 676 effect = graph()->NewNode(
677 simplified()->StoreField(AccessBuilder::ForStringLength()), value, length, 677 simplified()->StoreField(AccessBuilder::ForStringLength()), value, length,
678 effect, control); 678 effect, control);
679 effect = graph()->NewNode( 679 effect = graph()->NewNode(
680 simplified()->StoreField(AccessBuilder::ForConsStringFirst()), value, 680 simplified()->StoreField(AccessBuilder::ForConsStringFirst()), value,
681 first, effect, control); 681 first, effect, control);
682 effect = graph()->NewNode( 682 effect = graph()->NewNode(
683 simplified()->StoreField(AccessBuilder::ForConsStringSecond()), value, 683 simplified()->StoreField(AccessBuilder::ForConsStringSecond()), value,
684 second, effect, control); 684 second, effect, control);
685 685
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 1842
1843 ReduceBuiltin(isolate(), jsgraph(), node, builtin_index, arity, flags); 1843 ReduceBuiltin(isolate(), jsgraph(), node, builtin_index, arity, flags);
1844 } else { 1844 } else {
1845 // Patch {node} to an indirect call via the {function}s construct stub. 1845 // Patch {node} to an indirect call via the {function}s construct stub.
1846 Callable callable(handle(shared->construct_stub(), isolate()), 1846 Callable callable(handle(shared->construct_stub(), isolate()),
1847 ConstructStubDescriptor(isolate())); 1847 ConstructStubDescriptor(isolate()));
1848 node->RemoveInput(arity + 1); 1848 node->RemoveInput(arity + 1);
1849 node->InsertInput(graph()->zone(), 0, 1849 node->InsertInput(graph()->zone(), 0,
1850 jsgraph()->HeapConstant(callable.code())); 1850 jsgraph()->HeapConstant(callable.code()));
1851 node->InsertInput(graph()->zone(), 2, new_target); 1851 node->InsertInput(graph()->zone(), 2, new_target);
1852 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(arity)); 1852 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(arity));
1853 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); 1853 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
1854 node->InsertInput(graph()->zone(), 5, jsgraph()->UndefinedConstant()); 1854 node->InsertInput(graph()->zone(), 5, jsgraph()->UndefinedConstant());
1855 NodeProperties::ChangeOp( 1855 NodeProperties::ChangeOp(
1856 node, common()->Call(Linkage::GetStubCallDescriptor( 1856 node, common()->Call(Linkage::GetStubCallDescriptor(
1857 isolate(), graph()->zone(), callable.descriptor(), 1857 isolate(), graph()->zone(), callable.descriptor(),
1858 1 + arity, flags))); 1858 1 + arity, flags)));
1859 } 1859 }
1860 return Changed(node); 1860 return Changed(node);
1861 } 1861 }
1862 1862
1863 // Check if {target} is a JSFunction. 1863 // Check if {target} is a JSFunction.
1864 if (target_type->Is(Type::Function())) { 1864 if (target_type->Is(Type::Function())) {
1865 // Patch {node} to an indirect call via the ConstructFunction builtin. 1865 // Patch {node} to an indirect call via the ConstructFunction builtin.
1866 Callable callable = CodeFactory::ConstructFunction(isolate()); 1866 Callable callable = CodeFactory::ConstructFunction(isolate());
1867 node->RemoveInput(arity + 1); 1867 node->RemoveInput(arity + 1);
1868 node->InsertInput(graph()->zone(), 0, 1868 node->InsertInput(graph()->zone(), 0,
1869 jsgraph()->HeapConstant(callable.code())); 1869 jsgraph()->HeapConstant(callable.code()));
1870 node->InsertInput(graph()->zone(), 2, new_target); 1870 node->InsertInput(graph()->zone(), 2, new_target);
1871 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(arity)); 1871 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(arity));
1872 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); 1872 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
1873 NodeProperties::ChangeOp( 1873 NodeProperties::ChangeOp(
1874 node, common()->Call(Linkage::GetStubCallDescriptor( 1874 node, common()->Call(Linkage::GetStubCallDescriptor(
1875 isolate(), graph()->zone(), callable.descriptor(), 1 + arity, 1875 isolate(), graph()->zone(), callable.descriptor(), 1 + arity,
1876 CallDescriptor::kNeedsFrameState))); 1876 CallDescriptor::kNeedsFrameState)));
1877 return Changed(node); 1877 return Changed(node);
1878 } 1878 }
1879 1879
1880 return NoChange(); 1880 return NoChange();
1881 } 1881 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 // Update the effect dependency for the {node}. 1932 // Update the effect dependency for the {node}.
1933 NodeProperties::ReplaceEffectInput(node, effect); 1933 NodeProperties::ReplaceEffectInput(node, effect);
1934 1934
1935 // Compute flags for the call. 1935 // Compute flags for the call.
1936 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; 1936 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState;
1937 if (p.tail_call_mode() == TailCallMode::kAllow) { 1937 if (p.tail_call_mode() == TailCallMode::kAllow) {
1938 flags |= CallDescriptor::kSupportsTailCalls; 1938 flags |= CallDescriptor::kSupportsTailCalls;
1939 } 1939 }
1940 1940
1941 Node* new_target = jsgraph()->UndefinedConstant(); 1941 Node* new_target = jsgraph()->UndefinedConstant();
1942 Node* argument_count = jsgraph()->Int32Constant(arity); 1942 Node* argument_count = jsgraph()->Constant(arity);
1943 if (NeedsArgumentAdaptorFrame(shared, arity)) { 1943 if (NeedsArgumentAdaptorFrame(shared, arity)) {
1944 // Patch {node} to an indirect call via the ArgumentsAdaptorTrampoline. 1944 // Patch {node} to an indirect call via the ArgumentsAdaptorTrampoline.
1945 Callable callable = CodeFactory::ArgumentAdaptor(isolate()); 1945 Callable callable = CodeFactory::ArgumentAdaptor(isolate());
1946 node->InsertInput(graph()->zone(), 0, 1946 node->InsertInput(graph()->zone(), 0,
1947 jsgraph()->HeapConstant(callable.code())); 1947 jsgraph()->HeapConstant(callable.code()));
1948 node->InsertInput(graph()->zone(), 2, new_target); 1948 node->InsertInput(graph()->zone(), 2, new_target);
1949 node->InsertInput(graph()->zone(), 3, argument_count); 1949 node->InsertInput(graph()->zone(), 3, argument_count);
1950 node->InsertInput( 1950 node->InsertInput(
1951 graph()->zone(), 4, 1951 graph()->zone(), 4,
1952 jsgraph()->Int32Constant(shared->internal_formal_parameter_count())); 1952 jsgraph()->Constant(shared->internal_formal_parameter_count()));
1953 NodeProperties::ChangeOp( 1953 NodeProperties::ChangeOp(
1954 node, common()->Call(Linkage::GetStubCallDescriptor( 1954 node, common()->Call(Linkage::GetStubCallDescriptor(
1955 isolate(), graph()->zone(), callable.descriptor(), 1955 isolate(), graph()->zone(), callable.descriptor(),
1956 1 + arity, flags))); 1956 1 + arity, flags)));
1957 } else if (is_builtin && Builtins::HasCppImplementation(builtin_index) && 1957 } else if (is_builtin && Builtins::HasCppImplementation(builtin_index) &&
1958 ((flags & CallDescriptor::kSupportsTailCalls) == 0)) { 1958 ((flags & CallDescriptor::kSupportsTailCalls) == 0)) {
1959 // Patch {node} to a direct CEntryStub call. 1959 // Patch {node} to a direct CEntryStub call.
1960 ReduceBuiltin(isolate(), jsgraph(), node, builtin_index, arity, flags); 1960 ReduceBuiltin(isolate(), jsgraph(), node, builtin_index, arity, flags);
1961 } else { 1961 } else {
1962 // Patch {node} to a direct call. 1962 // Patch {node} to a direct call.
(...skipping 11 matching lines...) Expand all
1974 // Compute flags for the call. 1974 // Compute flags for the call.
1975 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; 1975 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState;
1976 if (p.tail_call_mode() == TailCallMode::kAllow) { 1976 if (p.tail_call_mode() == TailCallMode::kAllow) {
1977 flags |= CallDescriptor::kSupportsTailCalls; 1977 flags |= CallDescriptor::kSupportsTailCalls;
1978 } 1978 }
1979 1979
1980 // Patch {node} to an indirect call via the CallFunction builtin. 1980 // Patch {node} to an indirect call via the CallFunction builtin.
1981 Callable callable = CodeFactory::CallFunction(isolate(), convert_mode); 1981 Callable callable = CodeFactory::CallFunction(isolate(), convert_mode);
1982 node->InsertInput(graph()->zone(), 0, 1982 node->InsertInput(graph()->zone(), 0,
1983 jsgraph()->HeapConstant(callable.code())); 1983 jsgraph()->HeapConstant(callable.code()));
1984 node->InsertInput(graph()->zone(), 2, jsgraph()->Int32Constant(arity)); 1984 node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(arity));
1985 NodeProperties::ChangeOp( 1985 NodeProperties::ChangeOp(
1986 node, common()->Call(Linkage::GetStubCallDescriptor( 1986 node, common()->Call(Linkage::GetStubCallDescriptor(
1987 isolate(), graph()->zone(), callable.descriptor(), 1 + arity, 1987 isolate(), graph()->zone(), callable.descriptor(), 1 + arity,
1988 flags))); 1988 flags)));
1989 return Changed(node); 1989 return Changed(node);
1990 } 1990 }
1991 1991
1992 // Maybe we did at least learn something about the {receiver}. 1992 // Maybe we did at least learn something about the {receiver}.
1993 if (p.convert_mode() != convert_mode) { 1993 if (p.convert_mode() != convert_mode) {
1994 NodeProperties::ChangeOp( 1994 NodeProperties::ChangeOp(
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 } 2250 }
2251 2251
2252 2252
2253 CompilationDependencies* JSTypedLowering::dependencies() const { 2253 CompilationDependencies* JSTypedLowering::dependencies() const {
2254 return dependencies_; 2254 return dependencies_;
2255 } 2255 }
2256 2256
2257 } // namespace compiler 2257 } // namespace compiler
2258 } // namespace internal 2258 } // namespace internal
2259 } // namespace v8 2259 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698