| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 SharedFunctionInfo::kOffsetToPreviousContext)); | 882 SharedFunctionInfo::kOffsetToPreviousContext)); |
| 883 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 883 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
| 884 __ cmp(temp, native_context); | 884 __ cmp(temp, native_context); |
| 885 __ j(not_equal, &loop_bottom); | 885 __ j(not_equal, &loop_bottom); |
| 886 // OSR id set to none? | 886 // OSR id set to none? |
| 887 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, | 887 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, |
| 888 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); | 888 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); |
| 889 const int bailout_id = BailoutId::None().ToInt(); | 889 const int bailout_id = BailoutId::None().ToInt(); |
| 890 __ cmp(temp, Immediate(Smi::FromInt(bailout_id))); | 890 __ cmp(temp, Immediate(Smi::FromInt(bailout_id))); |
| 891 __ j(not_equal, &loop_bottom); | 891 __ j(not_equal, &loop_bottom); |
| 892 | |
| 893 // Literals available? | 892 // Literals available? |
| 894 Label got_literals, maybe_cleared_weakcell; | |
| 895 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, | 893 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, |
| 896 SharedFunctionInfo::kOffsetToPreviousLiterals)); | 894 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
| 897 | |
| 898 // temp contains either a WeakCell pointing to the literals array or the | |
| 899 // literals array directly. | |
| 900 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset); | |
| 901 __ JumpIfSmi(FieldOperand(temp, WeakCell::kValueOffset), | |
| 902 &maybe_cleared_weakcell); | |
| 903 // The WeakCell value is a pointer, therefore it's a valid literals array. | |
| 904 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 895 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
| 905 __ jmp(&got_literals); | 896 __ JumpIfSmi(temp, &gotta_call_runtime); |
| 906 | |
| 907 // We have a smi. If it's 0, then we are looking at a cleared WeakCell | |
| 908 // around the literals array, and we should visit the runtime. If it's > 0, | |
| 909 // then temp already contains the literals array. | |
| 910 __ bind(&maybe_cleared_weakcell); | |
| 911 __ cmp(FieldOperand(temp, WeakCell::kValueOffset), Immediate(0)); | |
| 912 __ j(equal, &gotta_call_runtime); | |
| 913 | 897 |
| 914 // Save the literals in the closure. | 898 // Save the literals in the closure. |
| 915 __ bind(&got_literals); | |
| 916 __ mov(ecx, Operand(esp, 0)); | 899 __ mov(ecx, Operand(esp, 0)); |
| 917 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp); | 900 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp); |
| 918 __ push(index); | 901 __ push(index); |
| 919 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, | 902 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, |
| 920 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 903 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 921 __ pop(index); | 904 __ pop(index); |
| 922 | 905 |
| 923 // Code available? | 906 // Code available? |
| 924 Register entry = ecx; | 907 Register entry = ecx; |
| 925 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, | 908 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, |
| (...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 | 3046 |
| 3064 // And "return" to the OSR entry point of the function. | 3047 // And "return" to the OSR entry point of the function. |
| 3065 __ ret(0); | 3048 __ ret(0); |
| 3066 } | 3049 } |
| 3067 | 3050 |
| 3068 #undef __ | 3051 #undef __ |
| 3069 } // namespace internal | 3052 } // namespace internal |
| 3070 } // namespace v8 | 3053 } // namespace v8 |
| 3071 | 3054 |
| 3072 #endif // V8_TARGET_ARCH_X87 | 3055 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |