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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 955 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
956 __ cmpp(temp, native_context); | 956 __ cmpp(temp, native_context); |
957 __ j(not_equal, &loop_bottom); | 957 __ j(not_equal, &loop_bottom); |
958 // OSR id set to none? | 958 // OSR id set to none? |
959 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 959 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
960 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); | 960 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); |
961 __ SmiToInteger32(temp, temp); | 961 __ SmiToInteger32(temp, temp); |
962 const int bailout_id = BailoutId::None().ToInt(); | 962 const int bailout_id = BailoutId::None().ToInt(); |
963 __ cmpl(temp, Immediate(bailout_id)); | 963 __ cmpl(temp, Immediate(bailout_id)); |
964 __ j(not_equal, &loop_bottom); | 964 __ j(not_equal, &loop_bottom); |
| 965 |
965 // Literals available? | 966 // Literals available? |
| 967 Label got_literals, maybe_cleared_weakcell; |
966 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 968 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
967 SharedFunctionInfo::kOffsetToPreviousLiterals)); | 969 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
| 970 // temp contains either a WeakCell pointing to the literals array or the |
| 971 // literals array directly. |
| 972 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset); |
| 973 __ movp(r15, FieldOperand(temp, WeakCell::kValueOffset)); |
| 974 __ JumpIfSmi(r15, &maybe_cleared_weakcell); |
| 975 // r15 is a pointer, therefore temp is a WeakCell pointing to a literals |
| 976 // array. |
968 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 977 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
969 __ JumpIfSmi(temp, &gotta_call_runtime); | 978 __ jmp(&got_literals); |
| 979 |
| 980 // r15 is a smi. If it's 0, then we are looking at a cleared WeakCell |
| 981 // around the literals array, and we should visit the runtime. If it's > 0, |
| 982 // then temp already contains the literals array. |
| 983 __ bind(&maybe_cleared_weakcell); |
| 984 __ cmpp(r15, Immediate(0)); |
| 985 __ j(equal, &gotta_call_runtime); |
970 | 986 |
971 // Save the literals in the closure. | 987 // Save the literals in the closure. |
| 988 __ bind(&got_literals); |
972 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); | 989 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); |
973 __ movp(r15, index); | 990 __ movp(r15, index); |
974 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, | 991 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, |
975 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 992 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
976 | 993 |
977 // Code available? | 994 // Code available? |
978 Register entry = rcx; | 995 Register entry = rcx; |
979 __ movp(entry, FieldOperand(map, index, times_pointer_size, | 996 __ movp(entry, FieldOperand(map, index, times_pointer_size, |
980 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 997 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
981 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 998 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2944 __ ret(0); | 2961 __ ret(0); |
2945 } | 2962 } |
2946 | 2963 |
2947 | 2964 |
2948 #undef __ | 2965 #undef __ |
2949 | 2966 |
2950 } // namespace internal | 2967 } // namespace internal |
2951 } // namespace v8 | 2968 } // namespace v8 |
2952 | 2969 |
2953 #endif // V8_TARGET_ARCH_X64 | 2970 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |