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

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

Issue 2100883003: [Code Stubs] Convert FastNewClosureStub to a TurboFanCodeStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ia32 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/code-assembler.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 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
1928 template<>
1929 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() {
1930 Counters* counters = isolate()->counters();
1931 Factory* factory = isolate()->factory();
1932 HInstruction* empty_fixed_array =
1933 Add<HConstant>(factory->empty_fixed_array());
1934 HInstruction* empty_literals_array =
1935 Add<HConstant>(factory->empty_literals_array());
1936 HValue* shared_info = GetParameter(0);
1937
1938 AddIncrementCounter(counters->fast_new_closure_total());
1939
1940 // Create a new closure from the given function info in new space
1941 HValue* size = Add<HConstant>(JSFunction::kSize);
1942 HInstruction* js_function =
1943 Add<HAllocate>(size, HType::JSObject(), NOT_TENURED, JS_FUNCTION_TYPE,
1944 graph()->GetConstant0());
1945
1946 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(),
1947 casted_stub()->kind());
1948
1949 // Compute the function map in the current native context and set that
1950 // as the map of the allocated object.
1951 HInstruction* native_context = BuildGetNativeContext();
1952 HInstruction* map_slot_value = Add<HLoadNamedField>(
1953 native_context, nullptr, HObjectAccess::ForContextSlot(map_index));
1954 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value);
1955
1956 // Initialize the rest of the function.
1957 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(),
1958 empty_fixed_array);
1959 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(),
1960 empty_fixed_array);
1961 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(),
1962 empty_literals_array);
1963 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(),
1964 graph()->GetConstantHole());
1965 Add<HStoreNamedField>(
1966 js_function, HObjectAccess::ForSharedFunctionInfoPointer(), shared_info);
1967 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(),
1968 context());
1969
1970 Handle<Code> lazy_builtin(
1971 isolate()->builtins()->builtin(Builtins::kCompileLazy));
1972 HConstant* lazy = Add<HConstant>(lazy_builtin);
1973 Add<HStoreCodeEntry>(js_function, lazy);
1974 Add<HStoreNamedField>(js_function,
1975 HObjectAccess::ForNextFunctionLinkPointer(),
1976 graph()->GetConstantUndefined());
1977
1978 return js_function;
1979 }
1980
1981
1982 Handle<Code> FastNewClosureStub::GenerateCode() {
1983 return DoGenerateCode(this);
1984 }
1985
1986
1987 template<> 1927 template<>
1988 HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() { 1928 HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() {
1989 int length = casted_stub()->slots() + Context::MIN_CONTEXT_SLOTS; 1929 int length = casted_stub()->slots() + Context::MIN_CONTEXT_SLOTS;
1990 1930
1991 // Get the function. 1931 // Get the function.
1992 HParameter* function = GetParameter(FastNewContextStub::kFunction); 1932 HParameter* function = GetParameter(FastNewContextStub::kFunction);
1993 1933
1994 // Allocate the context in new space. 1934 // Allocate the context in new space.
1995 HAllocate* function_context = Add<HAllocate>( 1935 HAllocate* function_context = Add<HAllocate>(
1996 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize), 1936 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize),
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 return Pop(); 2262 return Pop();
2323 } 2263 }
2324 2264
2325 2265
2326 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2266 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2327 return DoGenerateCode(this); 2267 return DoGenerateCode(this);
2328 } 2268 }
2329 2269
2330 } // namespace internal 2270 } // namespace internal
2331 } // namespace v8 2271 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698