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