| 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 931 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
| 932 __ cmpp(temp, native_context); | 932 __ cmpp(temp, native_context); |
| 933 __ j(not_equal, &loop_bottom); | 933 __ j(not_equal, &loop_bottom); |
| 934 // OSR id set to none? | 934 // OSR id set to none? |
| 935 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 935 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
| 936 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); | 936 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); |
| 937 __ SmiToInteger32(temp, temp); | 937 __ SmiToInteger32(temp, temp); |
| 938 const int bailout_id = BailoutId::None().ToInt(); | 938 const int bailout_id = BailoutId::None().ToInt(); |
| 939 __ cmpl(temp, Immediate(bailout_id)); | 939 __ cmpl(temp, Immediate(bailout_id)); |
| 940 __ j(not_equal, &loop_bottom); | 940 __ j(not_equal, &loop_bottom); |
| 941 |
| 941 // Literals available? | 942 // Literals available? |
| 943 Label got_literals, maybe_cleared_weakcell; |
| 942 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 944 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
| 943 SharedFunctionInfo::kOffsetToPreviousLiterals)); | 945 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
| 946 // temp contains either a WeakCell pointing to the literals array or the |
| 947 // literals array directly. |
| 948 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset); |
| 949 __ movp(r15, FieldOperand(temp, WeakCell::kValueOffset)); |
| 950 __ JumpIfSmi(r15, &maybe_cleared_weakcell); |
| 951 // r15 is a pointer, therefore temp is a WeakCell pointing to a literals |
| 952 // array. |
| 944 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 953 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
| 945 __ JumpIfSmi(temp, &gotta_call_runtime); | 954 __ jmp(&got_literals); |
| 955 |
| 956 // r15 is a smi. If it's 0, then we are looking at a cleared WeakCell |
| 957 // around the literals array, and we should visit the runtime. If it's > 0, |
| 958 // then temp already contains the literals array. |
| 959 __ bind(&maybe_cleared_weakcell); |
| 960 __ cmpp(r15, Immediate(Smi::FromInt(0))); |
| 961 __ j(equal, &gotta_call_runtime); |
| 946 | 962 |
| 947 // Save the literals in the closure. | 963 // Save the literals in the closure. |
| 964 __ bind(&got_literals); |
| 948 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); | 965 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); |
| 949 __ movp(r15, index); | 966 __ movp(r15, index); |
| 950 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, | 967 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, |
| 951 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 968 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 952 | 969 |
| 953 // Code available? | 970 // Code available? |
| 954 Register entry = rcx; | 971 Register entry = rcx; |
| 955 __ movp(entry, FieldOperand(map, index, times_pointer_size, | 972 __ movp(entry, FieldOperand(map, index, times_pointer_size, |
| 956 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 973 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
| 957 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 974 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2920 __ ret(0); | 2937 __ ret(0); |
| 2921 } | 2938 } |
| 2922 | 2939 |
| 2923 | 2940 |
| 2924 #undef __ | 2941 #undef __ |
| 2925 | 2942 |
| 2926 } // namespace internal | 2943 } // namespace internal |
| 2927 } // namespace v8 | 2944 } // namespace v8 |
| 2928 | 2945 |
| 2929 #endif // V8_TARGET_ARCH_X64 | 2946 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |