| 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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 | 1892 |
| 1893 void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode( | 1893 void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode( |
| 1894 HValue* js_function, | 1894 HValue* js_function, |
| 1895 HValue* native_context, | 1895 HValue* native_context, |
| 1896 IfBuilder* builder, | 1896 IfBuilder* builder, |
| 1897 HValue* optimized_map, | 1897 HValue* optimized_map, |
| 1898 HValue* map_index) { | 1898 HValue* map_index) { |
| 1899 HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt()); | 1899 HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt()); |
| 1900 HValue* context_slot = LoadFromOptimizedCodeMap( | 1900 HValue* context_slot = LoadFromOptimizedCodeMap( |
| 1901 optimized_map, map_index, SharedFunctionInfo::kContextOffset); | 1901 optimized_map, map_index, SharedFunctionInfo::kContextOffset); |
| 1902 context_slot = Add<HLoadNamedField>(context_slot, nullptr, |
| 1903 HObjectAccess::ForWeakCellValue()); |
| 1902 HValue* osr_ast_slot = LoadFromOptimizedCodeMap( | 1904 HValue* osr_ast_slot = LoadFromOptimizedCodeMap( |
| 1903 optimized_map, map_index, SharedFunctionInfo::kOsrAstIdOffset); | 1905 optimized_map, map_index, SharedFunctionInfo::kOsrAstIdOffset); |
| 1904 HValue* code_object = LoadFromOptimizedCodeMap( | 1906 HValue* code_object = LoadFromOptimizedCodeMap( |
| 1905 optimized_map, map_index, SharedFunctionInfo::kCachedCodeOffset); | 1907 optimized_map, map_index, SharedFunctionInfo::kCachedCodeOffset); |
| 1908 code_object = Add<HLoadNamedField>(code_object, nullptr, |
| 1909 HObjectAccess::ForWeakCellValue()); |
| 1906 builder->If<HCompareObjectEqAndBranch>(native_context, | 1910 builder->If<HCompareObjectEqAndBranch>(native_context, |
| 1907 context_slot); | 1911 context_slot); |
| 1908 builder->AndIf<HCompareObjectEqAndBranch>(osr_ast_slot, osr_ast_id_none); | 1912 builder->AndIf<HCompareObjectEqAndBranch>(osr_ast_slot, osr_ast_id_none); |
| 1909 builder->And(); | 1913 builder->And(); |
| 1910 builder->IfNot<HCompareObjectEqAndBranch>(code_object, | 1914 builder->IfNot<HCompareObjectEqAndBranch>(code_object, |
| 1911 graph()->GetConstantUndefined()); | 1915 graph()->GetConstant0()); |
| 1912 builder->Then(); | 1916 builder->Then(); |
| 1913 HValue* literals = LoadFromOptimizedCodeMap(optimized_map, | 1917 HValue* literals = LoadFromOptimizedCodeMap(optimized_map, |
| 1914 map_index, SharedFunctionInfo::kLiteralsOffset); | 1918 map_index, SharedFunctionInfo::kLiteralsOffset); |
| 1919 literals = Add<HLoadNamedField>(literals, nullptr, |
| 1920 HObjectAccess::ForWeakCellValue()); |
| 1921 IfBuilder maybe_deopt(this); |
| 1922 maybe_deopt.If<HCompareObjectEqAndBranch>(literals, graph()->GetConstant0()); |
| 1923 maybe_deopt.ThenDeopt(Deoptimizer::kLiteralsWereDisposed); |
| 1924 maybe_deopt.End(); |
| 1915 | 1925 |
| 1916 BuildInstallOptimizedCode(js_function, native_context, code_object, literals); | 1926 BuildInstallOptimizedCode(js_function, native_context, code_object, literals); |
| 1917 | 1927 |
| 1918 // The builder continues in the "then" after this function. | 1928 // The builder continues in the "then" after this function. |
| 1919 } | 1929 } |
| 1920 | 1930 |
| 1921 | 1931 |
| 1922 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode(HValue* js_function, | 1932 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode(HValue* js_function, |
| 1923 HValue* native_context, | 1933 HValue* native_context, |
| 1924 HValue* code_object, | 1934 HValue* code_object, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 // find a context-dependent code and try context-independent code next. | 2038 // find a context-dependent code and try context-independent code next. |
| 2029 IfBuilder no_optimized_code_check(this); | 2039 IfBuilder no_optimized_code_check(this); |
| 2030 no_optimized_code_check.If<HCompareNumericAndBranch>( | 2040 no_optimized_code_check.If<HCompareNumericAndBranch>( |
| 2031 slot_iterator, first_entry_index, Token::LT); | 2041 slot_iterator, first_entry_index, Token::LT); |
| 2032 no_optimized_code_check.Then(); | 2042 no_optimized_code_check.Then(); |
| 2033 { | 2043 { |
| 2034 IfBuilder shared_code_check(this); | 2044 IfBuilder shared_code_check(this); |
| 2035 HValue* shared_code = | 2045 HValue* shared_code = |
| 2036 Add<HLoadNamedField>(optimized_map, nullptr, | 2046 Add<HLoadNamedField>(optimized_map, nullptr, |
| 2037 HObjectAccess::ForOptimizedCodeMapSharedCode()); | 2047 HObjectAccess::ForOptimizedCodeMapSharedCode()); |
| 2048 shared_code = Add<HLoadNamedField>(shared_code, nullptr, |
| 2049 HObjectAccess::ForWeakCellValue()); |
| 2038 shared_code_check.IfNot<HCompareObjectEqAndBranch>( | 2050 shared_code_check.IfNot<HCompareObjectEqAndBranch>( |
| 2039 shared_code, graph()->GetConstantUndefined()); | 2051 shared_code, graph()->GetConstant0()); |
| 2040 shared_code_check.Then(); | 2052 shared_code_check.Then(); |
| 2041 { | 2053 { |
| 2042 // Store the context-independent optimized code. | 2054 // Store the context-independent optimized code. |
| 2043 HValue* literals = Add<HConstant>(factory->empty_fixed_array()); | 2055 HValue* literals = Add<HConstant>(factory->empty_fixed_array()); |
| 2044 BuildInstallOptimizedCode(js_function, native_context, shared_code, | 2056 BuildInstallOptimizedCode(js_function, native_context, shared_code, |
| 2045 literals); | 2057 literals); |
| 2046 } | 2058 } |
| 2047 shared_code_check.Else(); | 2059 shared_code_check.Else(); |
| 2048 { | 2060 { |
| 2049 // Store the unoptimized code. | 2061 // Store the unoptimized code. |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2445 return Pop(); | 2457 return Pop(); |
| 2446 } | 2458 } |
| 2447 | 2459 |
| 2448 | 2460 |
| 2449 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2461 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
| 2450 return DoGenerateCode(this); | 2462 return DoGenerateCode(this); |
| 2451 } | 2463 } |
| 2452 | 2464 |
| 2453 } // namespace internal | 2465 } // namespace internal |
| 2454 } // namespace v8 | 2466 } // namespace v8 |
| OLD | NEW |