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