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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 2113673002: [stubs]: Convert FastNewContext stub to turbofan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename based on feedback Created 4 years, 5 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/code-stubs.cc ('k') | src/compiler/js-generic-lowering.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/crankshaft/hydrogen.h" 8 #include "src/crankshaft/hydrogen.h"
9 #include "src/crankshaft/lithium.h" 9 #include "src/crankshaft/lithium.h"
10 #include "src/field-index.h" 10 #include "src/field-index.h"
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 1917
1918 template <> 1918 template <>
1919 HValue* CodeStubGraphBuilder<ToObjectStub>::BuildCodeStub() { 1919 HValue* CodeStubGraphBuilder<ToObjectStub>::BuildCodeStub() {
1920 HValue* receiver = GetParameter(TypeConversionDescriptor::kArgumentIndex); 1920 HValue* receiver = GetParameter(TypeConversionDescriptor::kArgumentIndex);
1921 return BuildToObject(receiver); 1921 return BuildToObject(receiver);
1922 } 1922 }
1923 1923
1924 1924
1925 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } 1925 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); }
1926 1926
1927 template<>
1928 HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() {
1929 int length = casted_stub()->slots() + Context::MIN_CONTEXT_SLOTS;
1930
1931 // Get the function.
1932 HParameter* function = GetParameter(FastNewContextStub::kFunction);
1933
1934 // Allocate the context in new space.
1935 HAllocate* function_context = Add<HAllocate>(
1936 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize),
1937 HType::HeapObject(), NOT_TENURED, FIXED_ARRAY_TYPE,
1938 graph()->GetConstant0());
1939
1940 // Set up the object header.
1941 AddStoreMapConstant(function_context,
1942 isolate()->factory()->function_context_map());
1943 Add<HStoreNamedField>(function_context,
1944 HObjectAccess::ForFixedArrayLength(),
1945 Add<HConstant>(length));
1946
1947 // Set up the fixed slots.
1948 Add<HStoreNamedField>(function_context,
1949 HObjectAccess::ForContextSlot(Context::CLOSURE_INDEX),
1950 function);
1951 Add<HStoreNamedField>(function_context,
1952 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX),
1953 context());
1954 Add<HStoreNamedField>(function_context,
1955 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX),
1956 graph()->GetConstantHole());
1957
1958 // Copy the native context from the previous context.
1959 HValue* native_context = Add<HLoadNamedField>(
1960 context(), nullptr,
1961 HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX));
1962 Add<HStoreNamedField>(function_context, HObjectAccess::ForContextSlot(
1963 Context::NATIVE_CONTEXT_INDEX),
1964 native_context);
1965
1966 // Initialize the rest of the slots to undefined.
1967 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) {
1968 Add<HStoreNamedField>(function_context,
1969 HObjectAccess::ForContextSlot(i),
1970 graph()->GetConstantUndefined());
1971 }
1972
1973 return function_context;
1974 }
1975
1976
1977 Handle<Code> FastNewContextStub::GenerateCode() {
1978 return DoGenerateCode(this);
1979 }
1980
1981
1982 template <> 1927 template <>
1983 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { 1928 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() {
1984 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); 1929 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
1985 HValue* key = GetParameter(LoadDescriptor::kNameIndex); 1930 HValue* key = GetParameter(LoadDescriptor::kNameIndex);
1986 1931
1987 Add<HCheckSmi>(key); 1932 Add<HCheckSmi>(key);
1988 1933
1989 HValue* elements = AddLoadElements(receiver); 1934 HValue* elements = AddLoadElements(receiver);
1990 1935
1991 HValue* hash = BuildElementIndexHash(key); 1936 HValue* hash = BuildElementIndexHash(key);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 return Pop(); 2207 return Pop();
2263 } 2208 }
2264 2209
2265 2210
2266 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2211 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2267 return DoGenerateCode(this); 2212 return DoGenerateCode(this);
2268 } 2213 }
2269 2214
2270 } // namespace internal 2215 } // namespace internal
2271 } // namespace v8 2216 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698