OLD | NEW |
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 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 | 1882 |
1883 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } | 1883 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } |
1884 | 1884 |
1885 | 1885 |
1886 template<> | 1886 template<> |
1887 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { | 1887 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { |
1888 Counters* counters = isolate()->counters(); | 1888 Counters* counters = isolate()->counters(); |
1889 Factory* factory = isolate()->factory(); | 1889 Factory* factory = isolate()->factory(); |
1890 HInstruction* empty_fixed_array = | 1890 HInstruction* empty_fixed_array = |
1891 Add<HConstant>(factory->empty_fixed_array()); | 1891 Add<HConstant>(factory->empty_fixed_array()); |
| 1892 HInstruction* empty_literals_array = |
| 1893 Add<HConstant>(factory->empty_literals_array()); |
1892 HValue* shared_info = GetParameter(0); | 1894 HValue* shared_info = GetParameter(0); |
1893 | 1895 |
1894 AddIncrementCounter(counters->fast_new_closure_total()); | 1896 AddIncrementCounter(counters->fast_new_closure_total()); |
1895 | 1897 |
1896 // Create a new closure from the given function info in new space | 1898 // Create a new closure from the given function info in new space |
1897 HValue* size = Add<HConstant>(JSFunction::kSize); | 1899 HValue* size = Add<HConstant>(JSFunction::kSize); |
1898 HInstruction* js_function = | 1900 HInstruction* js_function = |
1899 Add<HAllocate>(size, HType::JSObject(), NOT_TENURED, JS_FUNCTION_TYPE); | 1901 Add<HAllocate>(size, HType::JSObject(), NOT_TENURED, JS_FUNCTION_TYPE); |
1900 | 1902 |
1901 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), | 1903 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), |
1902 casted_stub()->kind()); | 1904 casted_stub()->kind()); |
1903 | 1905 |
1904 // Compute the function map in the current native context and set that | 1906 // Compute the function map in the current native context and set that |
1905 // as the map of the allocated object. | 1907 // as the map of the allocated object. |
1906 HInstruction* native_context = BuildGetNativeContext(); | 1908 HInstruction* native_context = BuildGetNativeContext(); |
1907 HInstruction* map_slot_value = Add<HLoadNamedField>( | 1909 HInstruction* map_slot_value = Add<HLoadNamedField>( |
1908 native_context, nullptr, HObjectAccess::ForContextSlot(map_index)); | 1910 native_context, nullptr, HObjectAccess::ForContextSlot(map_index)); |
1909 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); | 1911 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); |
1910 | 1912 |
1911 // Initialize the rest of the function. | 1913 // Initialize the rest of the function. |
1912 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(), | 1914 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(), |
1913 empty_fixed_array); | 1915 empty_fixed_array); |
1914 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), | 1916 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), |
1915 empty_fixed_array); | 1917 empty_fixed_array); |
1916 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), | 1918 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), |
1917 empty_fixed_array); | 1919 empty_literals_array); |
1918 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), | 1920 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), |
1919 graph()->GetConstantHole()); | 1921 graph()->GetConstantHole()); |
1920 Add<HStoreNamedField>( | 1922 Add<HStoreNamedField>( |
1921 js_function, HObjectAccess::ForSharedFunctionInfoPointer(), shared_info); | 1923 js_function, HObjectAccess::ForSharedFunctionInfoPointer(), shared_info); |
1922 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), | 1924 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), |
1923 context()); | 1925 context()); |
1924 | 1926 |
1925 Handle<Code> lazy_builtin( | 1927 Handle<Code> lazy_builtin( |
1926 isolate()->builtins()->builtin(Builtins::kCompileLazy)); | 1928 isolate()->builtins()->builtin(Builtins::kCompileLazy)); |
1927 HConstant* lazy = Add<HConstant>(lazy_builtin); | 1929 HConstant* lazy = Add<HConstant>(lazy_builtin); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 return Pop(); | 2273 return Pop(); |
2272 } | 2274 } |
2273 | 2275 |
2274 | 2276 |
2275 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2277 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2276 return DoGenerateCode(this); | 2278 return DoGenerateCode(this); |
2277 } | 2279 } |
2278 | 2280 |
2279 } // namespace internal | 2281 } // namespace internal |
2280 } // namespace v8 | 2282 } // namespace v8 |
OLD | NEW |