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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 | 1860 |
1861 void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode( | 1861 void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode( |
1862 HValue* js_function, | 1862 HValue* js_function, |
1863 HValue* native_context, | 1863 HValue* native_context, |
1864 IfBuilder* builder, | 1864 IfBuilder* builder, |
1865 HValue* optimized_map, | 1865 HValue* optimized_map, |
1866 HValue* map_index) { | 1866 HValue* map_index) { |
1867 HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt()); | 1867 HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt()); |
1868 HValue* context_slot = LoadFromOptimizedCodeMap( | 1868 HValue* context_slot = LoadFromOptimizedCodeMap( |
1869 optimized_map, map_index, SharedFunctionInfo::kContextOffset); | 1869 optimized_map, map_index, SharedFunctionInfo::kContextOffset); |
| 1870 context_slot = Add<HLoadNamedField>(context_slot, nullptr, |
| 1871 HObjectAccess::ForWeakCellValue()); |
1870 HValue* osr_ast_slot = LoadFromOptimizedCodeMap( | 1872 HValue* osr_ast_slot = LoadFromOptimizedCodeMap( |
1871 optimized_map, map_index, SharedFunctionInfo::kOsrAstIdOffset); | 1873 optimized_map, map_index, SharedFunctionInfo::kOsrAstIdOffset); |
1872 HValue* code_object = LoadFromOptimizedCodeMap( | 1874 HValue* code_object = LoadFromOptimizedCodeMap( |
1873 optimized_map, map_index, SharedFunctionInfo::kCachedCodeOffset); | 1875 optimized_map, map_index, SharedFunctionInfo::kCachedCodeOffset); |
| 1876 code_object = Add<HLoadNamedField>(code_object, nullptr, |
| 1877 HObjectAccess::ForWeakCellValue()); |
1874 builder->If<HCompareObjectEqAndBranch>(native_context, | 1878 builder->If<HCompareObjectEqAndBranch>(native_context, |
1875 context_slot); | 1879 context_slot); |
1876 builder->AndIf<HCompareObjectEqAndBranch>(osr_ast_slot, osr_ast_id_none); | 1880 builder->AndIf<HCompareObjectEqAndBranch>(osr_ast_slot, osr_ast_id_none); |
1877 builder->And(); | 1881 builder->And(); |
1878 builder->IfNot<HCompareObjectEqAndBranch>(code_object, | 1882 builder->IfNot<HCompareObjectEqAndBranch>(code_object, |
1879 graph()->GetConstantUndefined()); | 1883 graph()->GetConstant0()); |
1880 builder->Then(); | 1884 builder->Then(); |
1881 HValue* literals = LoadFromOptimizedCodeMap(optimized_map, | 1885 HValue* literals = LoadFromOptimizedCodeMap(optimized_map, |
1882 map_index, SharedFunctionInfo::kLiteralsOffset); | 1886 map_index, SharedFunctionInfo::kLiteralsOffset); |
| 1887 literals = Add<HLoadNamedField>(literals, nullptr, |
| 1888 HObjectAccess::ForWeakCellValue()); |
| 1889 IfBuilder maybe_deopt(this); |
| 1890 maybe_deopt.If<HCompareObjectEqAndBranch>(literals, graph()->GetConstant0()); |
| 1891 maybe_deopt.ThenDeopt(Deoptimizer::kLiteralsWereDisposed); |
| 1892 maybe_deopt.End(); |
1883 | 1893 |
1884 BuildInstallOptimizedCode(js_function, native_context, code_object, literals); | 1894 BuildInstallOptimizedCode(js_function, native_context, code_object, literals); |
1885 | 1895 |
1886 // The builder continues in the "then" after this function. | 1896 // The builder continues in the "then" after this function. |
1887 } | 1897 } |
1888 | 1898 |
1889 | 1899 |
1890 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode(HValue* js_function, | 1900 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode(HValue* js_function, |
1891 HValue* native_context, | 1901 HValue* native_context, |
1892 HValue* code_object, | 1902 HValue* code_object, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 // find a context-dependent code and try context-independent code next. | 2006 // find a context-dependent code and try context-independent code next. |
1997 IfBuilder no_optimized_code_check(this); | 2007 IfBuilder no_optimized_code_check(this); |
1998 no_optimized_code_check.If<HCompareNumericAndBranch>( | 2008 no_optimized_code_check.If<HCompareNumericAndBranch>( |
1999 slot_iterator, first_entry_index, Token::LT); | 2009 slot_iterator, first_entry_index, Token::LT); |
2000 no_optimized_code_check.Then(); | 2010 no_optimized_code_check.Then(); |
2001 { | 2011 { |
2002 IfBuilder shared_code_check(this); | 2012 IfBuilder shared_code_check(this); |
2003 HValue* shared_code = | 2013 HValue* shared_code = |
2004 Add<HLoadNamedField>(optimized_map, nullptr, | 2014 Add<HLoadNamedField>(optimized_map, nullptr, |
2005 HObjectAccess::ForOptimizedCodeMapSharedCode()); | 2015 HObjectAccess::ForOptimizedCodeMapSharedCode()); |
| 2016 shared_code = Add<HLoadNamedField>(shared_code, nullptr, |
| 2017 HObjectAccess::ForWeakCellValue()); |
2006 shared_code_check.IfNot<HCompareObjectEqAndBranch>( | 2018 shared_code_check.IfNot<HCompareObjectEqAndBranch>( |
2007 shared_code, graph()->GetConstantUndefined()); | 2019 shared_code, graph()->GetConstant0()); |
2008 shared_code_check.Then(); | 2020 shared_code_check.Then(); |
2009 { | 2021 { |
2010 // Store the context-independent optimized code. | 2022 // Store the context-independent optimized code. |
2011 HValue* literals = Add<HConstant>(factory->empty_fixed_array()); | 2023 HValue* literals = Add<HConstant>(factory->empty_fixed_array()); |
2012 BuildInstallOptimizedCode(js_function, native_context, shared_code, | 2024 BuildInstallOptimizedCode(js_function, native_context, shared_code, |
2013 literals); | 2025 literals); |
2014 } | 2026 } |
2015 shared_code_check.Else(); | 2027 shared_code_check.Else(); |
2016 { | 2028 { |
2017 // Store the unoptimized code. | 2029 // Store the unoptimized code. |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 return Pop(); | 2424 return Pop(); |
2413 } | 2425 } |
2414 | 2426 |
2415 | 2427 |
2416 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2428 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2417 return DoGenerateCode(this); | 2429 return DoGenerateCode(this); |
2418 } | 2430 } |
2419 | 2431 |
2420 } // namespace internal | 2432 } // namespace internal |
2421 } // namespace v8 | 2433 } // namespace v8 |
OLD | NEW |