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 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 | 1798 |
1799 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } | 1799 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } |
1800 | 1800 |
1801 | 1801 |
1802 template<> | 1802 template<> |
1803 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { | 1803 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { |
1804 Counters* counters = isolate()->counters(); | 1804 Counters* counters = isolate()->counters(); |
1805 Factory* factory = isolate()->factory(); | 1805 Factory* factory = isolate()->factory(); |
1806 HInstruction* empty_fixed_array = | 1806 HInstruction* empty_fixed_array = |
1807 Add<HConstant>(factory->empty_fixed_array()); | 1807 Add<HConstant>(factory->empty_fixed_array()); |
| 1808 HInstruction* empty_literals_array = |
| 1809 Add<HConstant>(factory->empty_literals_array()); |
1808 HValue* shared_info = GetParameter(0); | 1810 HValue* shared_info = GetParameter(0); |
1809 | 1811 |
1810 AddIncrementCounter(counters->fast_new_closure_total()); | 1812 AddIncrementCounter(counters->fast_new_closure_total()); |
1811 | 1813 |
1812 // Create a new closure from the given function info in new space | 1814 // Create a new closure from the given function info in new space |
1813 HValue* size = Add<HConstant>(JSFunction::kSize); | 1815 HValue* size = Add<HConstant>(JSFunction::kSize); |
1814 HInstruction* js_function = | 1816 HInstruction* js_function = |
1815 Add<HAllocate>(size, HType::JSObject(), NOT_TENURED, JS_FUNCTION_TYPE, | 1817 Add<HAllocate>(size, HType::JSObject(), NOT_TENURED, JS_FUNCTION_TYPE, |
1816 graph()->GetConstant0()); | 1818 graph()->GetConstant0()); |
1817 | 1819 |
1818 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), | 1820 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), |
1819 casted_stub()->kind()); | 1821 casted_stub()->kind()); |
1820 | 1822 |
1821 // Compute the function map in the current native context and set that | 1823 // Compute the function map in the current native context and set that |
1822 // as the map of the allocated object. | 1824 // as the map of the allocated object. |
1823 HInstruction* native_context = BuildGetNativeContext(); | 1825 HInstruction* native_context = BuildGetNativeContext(); |
1824 HInstruction* map_slot_value = Add<HLoadNamedField>( | 1826 HInstruction* map_slot_value = Add<HLoadNamedField>( |
1825 native_context, nullptr, HObjectAccess::ForContextSlot(map_index)); | 1827 native_context, nullptr, HObjectAccess::ForContextSlot(map_index)); |
1826 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); | 1828 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); |
1827 | 1829 |
1828 // Initialize the rest of the function. | 1830 // Initialize the rest of the function. |
1829 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(), | 1831 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(), |
1830 empty_fixed_array); | 1832 empty_fixed_array); |
1831 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), | 1833 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), |
1832 empty_fixed_array); | 1834 empty_fixed_array); |
1833 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), | 1835 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), |
1834 empty_fixed_array); | 1836 empty_literals_array); |
1835 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), | 1837 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), |
1836 graph()->GetConstantHole()); | 1838 graph()->GetConstantHole()); |
1837 Add<HStoreNamedField>( | 1839 Add<HStoreNamedField>( |
1838 js_function, HObjectAccess::ForSharedFunctionInfoPointer(), shared_info); | 1840 js_function, HObjectAccess::ForSharedFunctionInfoPointer(), shared_info); |
1839 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), | 1841 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), |
1840 context()); | 1842 context()); |
1841 | 1843 |
1842 Handle<Code> lazy_builtin( | 1844 Handle<Code> lazy_builtin( |
1843 isolate()->builtins()->builtin(Builtins::kCompileLazy)); | 1845 isolate()->builtins()->builtin(Builtins::kCompileLazy)); |
1844 HConstant* lazy = Add<HConstant>(lazy_builtin); | 1846 HConstant* lazy = Add<HConstant>(lazy_builtin); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 return Pop(); | 2191 return Pop(); |
2190 } | 2192 } |
2191 | 2193 |
2192 | 2194 |
2193 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2195 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2194 return DoGenerateCode(this); | 2196 return DoGenerateCode(this); |
2195 } | 2197 } |
2196 | 2198 |
2197 } // namespace internal | 2199 } // namespace internal |
2198 } // namespace v8 | 2200 } // namespace v8 |
OLD | NEW |