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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 946 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
947 __ cmpp(temp, native_context); | 947 __ cmpp(temp, native_context); |
948 __ j(not_equal, &loop_bottom); | 948 __ j(not_equal, &loop_bottom); |
949 // OSR id set to none? | 949 // OSR id set to none? |
950 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 950 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
951 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); | 951 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); |
952 __ SmiToInteger32(temp, temp); | 952 __ SmiToInteger32(temp, temp); |
953 const int bailout_id = BailoutId::None().ToInt(); | 953 const int bailout_id = BailoutId::None().ToInt(); |
954 __ cmpl(temp, Immediate(bailout_id)); | 954 __ cmpl(temp, Immediate(bailout_id)); |
955 __ j(not_equal, &loop_bottom); | 955 __ j(not_equal, &loop_bottom); |
956 | |
957 // Literals available? | 956 // Literals available? |
958 Label got_literals, maybe_cleared_weakcell; | |
959 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 957 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
960 SharedFunctionInfo::kOffsetToPreviousLiterals)); | 958 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
961 // temp contains either a WeakCell pointing to the literals array or the | |
962 // literals array directly. | |
963 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset); | |
964 __ movp(r15, FieldOperand(temp, WeakCell::kValueOffset)); | |
965 __ JumpIfSmi(r15, &maybe_cleared_weakcell); | |
966 // r15 is a pointer, therefore temp is a WeakCell pointing to a literals | |
967 // array. | |
968 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 959 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
969 __ jmp(&got_literals); | 960 __ JumpIfSmi(temp, &gotta_call_runtime); |
970 | |
971 // r15 is a smi. If it's 0, then we are looking at a cleared WeakCell | |
972 // around the literals array, and we should visit the runtime. If it's > 0, | |
973 // then temp already contains the literals array. | |
974 __ bind(&maybe_cleared_weakcell); | |
975 __ cmpp(r15, Immediate(0)); | |
976 __ j(equal, &gotta_call_runtime); | |
977 | 961 |
978 // Save the literals in the closure. | 962 // Save the literals in the closure. |
979 __ bind(&got_literals); | |
980 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); | 963 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); |
981 __ movp(r15, index); | 964 __ movp(r15, index); |
982 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, | 965 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, |
983 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 966 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
984 | 967 |
985 // Code available? | 968 // Code available? |
986 Register entry = rcx; | 969 Register entry = rcx; |
987 __ movp(entry, FieldOperand(map, index, times_pointer_size, | 970 __ movp(entry, FieldOperand(map, index, times_pointer_size, |
988 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 971 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
989 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 972 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3082 // And "return" to the OSR entry point of the function. | 3065 // And "return" to the OSR entry point of the function. |
3083 __ ret(0); | 3066 __ ret(0); |
3084 } | 3067 } |
3085 | 3068 |
3086 #undef __ | 3069 #undef __ |
3087 | 3070 |
3088 } // namespace internal | 3071 } // namespace internal |
3089 } // namespace v8 | 3072 } // namespace v8 |
3090 | 3073 |
3091 #endif // V8_TARGET_ARCH_X64 | 3074 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |