OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7054 __ mov(ebx, eax); | 7054 __ mov(ebx, eax); |
7055 __ RecordWriteField(edx, | 7055 __ RecordWriteField(edx, |
7056 JSObject::kElementsOffset, | 7056 JSObject::kElementsOffset, |
7057 ebx, | 7057 ebx, |
7058 edi, | 7058 edi, |
7059 kDontSaveFPRegs, | 7059 kDontSaveFPRegs, |
7060 EMIT_REMEMBERED_SET, | 7060 EMIT_REMEMBERED_SET, |
7061 OMIT_SMI_CHECK); | 7061 OMIT_SMI_CHECK); |
7062 | 7062 |
7063 __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); | 7063 __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); |
7064 // Convert and copy elements | 7064 |
7065 // esi: source FixedArray | 7065 // Prepare for conversion loop. |
7066 // edi: number of elements to convert/copy | |
7067 ExternalReference canonical_the_hole_nan_reference = | 7066 ExternalReference canonical_the_hole_nan_reference = |
7068 ExternalReference::address_of_the_hole_nan(); | 7067 ExternalReference::address_of_the_hole_nan(); |
7069 XMMRegister the_hole_nan = xmm1; | 7068 XMMRegister the_hole_nan = xmm1; |
7070 if (CpuFeatures::IsSupported(SSE2)) { | 7069 if (CpuFeatures::IsSupported(SSE2)) { |
7071 CpuFeatures::Scope use_sse2(SSE2); | 7070 CpuFeatures::Scope use_sse2(SSE2); |
7072 __ movdbl(the_hole_nan, | 7071 __ movdbl(the_hole_nan, |
7073 Operand::StaticVariable(canonical_the_hole_nan_reference)); | 7072 Operand::StaticVariable(canonical_the_hole_nan_reference)); |
7074 } | 7073 } |
7075 __ jmp(&entry); | 7074 __ jmp(&entry); |
| 7075 |
| 7076 // Call into runtime if GC is required. |
| 7077 __ bind(&gc_required); |
| 7078 // Restore registers before jumping into runtime. |
| 7079 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 7080 __ pop(ebx); |
| 7081 __ pop(eax); |
| 7082 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); |
| 7083 |
| 7084 // Convert and copy elements |
| 7085 // esi: source FixedArray |
| 7086 // edi: number of elements to convert/copy |
7076 __ bind(&loop); | 7087 __ bind(&loop); |
7077 __ sub(edi, Immediate(Smi::FromInt(1))); | 7088 __ sub(edi, Immediate(Smi::FromInt(1))); |
7078 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); | 7089 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); |
7079 // ebx: current element from source | 7090 // ebx: current element from source |
7080 // edi: index of current element | 7091 // edi: index of current element |
7081 __ JumpIfNotSmi(ebx, &convert_hole); | 7092 __ JumpIfNotSmi(ebx, &convert_hole); |
7082 | 7093 |
7083 // Normal smi, convert it to double and store. | 7094 // Normal smi, convert it to double and store. |
7084 __ SmiUntag(ebx); | 7095 __ SmiUntag(ebx); |
7085 if (CpuFeatures::IsSupported(SSE2)) { | 7096 if (CpuFeatures::IsSupported(SSE2)) { |
(...skipping 17 matching lines...) Expand all Loading... |
7103 the_hole_nan); | 7114 the_hole_nan); |
7104 } else { | 7115 } else { |
7105 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); | 7116 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); |
7106 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); | 7117 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); |
7107 } | 7118 } |
7108 | 7119 |
7109 __ bind(&entry); | 7120 __ bind(&entry); |
7110 __ test(edi, edi); | 7121 __ test(edi, edi); |
7111 __ j(not_zero, &loop); | 7122 __ j(not_zero, &loop); |
7112 | 7123 |
7113 Label done; | |
7114 __ pop(ebx); | 7124 __ pop(ebx); |
7115 __ pop(eax); | 7125 __ pop(eax); |
7116 // eax: value | 7126 // eax: value |
7117 // ebx: target map | 7127 // ebx: target map |
7118 // Set transitioned map. | 7128 // Set transitioned map. |
7119 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 7129 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
7120 __ RecordWriteField(edx, | 7130 __ RecordWriteField(edx, |
7121 HeapObject::kMapOffset, | 7131 HeapObject::kMapOffset, |
7122 ebx, | 7132 ebx, |
7123 edi, | 7133 edi, |
7124 kDontSaveFPRegs, | 7134 kDontSaveFPRegs, |
7125 EMIT_REMEMBERED_SET, | 7135 EMIT_REMEMBERED_SET, |
7126 OMIT_SMI_CHECK); | 7136 OMIT_SMI_CHECK); |
7127 // Restore esi. | 7137 // Restore esi. |
7128 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 7138 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
7129 __ jmp(&done, Label::kNear); | |
7130 | |
7131 __ bind(&gc_required); | |
7132 // Restore registers before jumping into runtime. | |
7133 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
7134 __ pop(ebx); | |
7135 __ pop(eax); | |
7136 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); | |
7137 __ bind(&done); | |
7138 } | 7139 } |
7139 | 7140 |
7140 | 7141 |
7141 void FastElementsConversionStub::GenerateDoubleToObject( | 7142 void FastElementsConversionStub::GenerateDoubleToObject( |
7142 MacroAssembler* masm, StrictModeFlag strict_mode) { | 7143 MacroAssembler* masm, StrictModeFlag strict_mode) { |
7143 // ----------- S t a t e ------------- | 7144 // ----------- S t a t e ------------- |
7144 // -- eax : value | 7145 // -- eax : value |
7145 // -- ebx : target map | 7146 // -- ebx : target map |
7146 // -- ecx : key | 7147 // -- ecx : key |
7147 // -- edx : receiver | 7148 // -- edx : receiver |
(...skipping 12 matching lines...) Expand all Loading... |
7160 __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); | 7161 __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); |
7161 __ AllocateInNewSpace(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT); | 7162 __ AllocateInNewSpace(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT); |
7162 | 7163 |
7163 // eax: destination FixedArray | 7164 // eax: destination FixedArray |
7164 // ebx: number of elements | 7165 // ebx: number of elements |
7165 __ mov(FieldOperand(eax, HeapObject::kMapOffset), | 7166 __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
7166 Immediate(masm->isolate()->factory()->fixed_array_map())); | 7167 Immediate(masm->isolate()->factory()->fixed_array_map())); |
7167 __ mov(FieldOperand(eax, FixedArray::kLengthOffset), ebx); | 7168 __ mov(FieldOperand(eax, FixedArray::kLengthOffset), ebx); |
7168 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 7169 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
7169 | 7170 |
| 7171 __ jmp(&entry); |
| 7172 |
| 7173 // Call into runtime if GC is required. |
| 7174 __ bind(&gc_required); |
| 7175 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 7176 __ pop(ebx); |
| 7177 __ pop(edx); |
| 7178 __ pop(eax); |
| 7179 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); |
| 7180 |
7170 // Box doubles into heap numbers. | 7181 // Box doubles into heap numbers. |
7171 // edi: source FixedDoubleArray | 7182 // edi: source FixedDoubleArray |
7172 // eax: destination FixedArray | 7183 // eax: destination FixedArray |
7173 __ jmp(&entry); | |
7174 __ bind(&loop); | 7184 __ bind(&loop); |
7175 __ sub(ebx, Immediate(Smi::FromInt(1))); | 7185 __ sub(ebx, Immediate(Smi::FromInt(1))); |
7176 // ebx: index of current element (smi-tagged) | 7186 // ebx: index of current element (smi-tagged) |
7177 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | 7187 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
7178 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); | 7188 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); |
7179 __ j(equal, &convert_hole); | 7189 __ j(equal, &convert_hole); |
7180 | 7190 |
7181 // Non-hole double, copy value into a heap number. | 7191 // Non-hole double, copy value into a heap number. |
7182 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); | 7192 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); |
7183 // edx: new heap number | 7193 // edx: new heap number |
7184 if (CpuFeatures::IsSupported(SSE2)) { | 7194 if (CpuFeatures::IsSupported(SSE2)) { |
7185 CpuFeatures::Scope fscope(SSE2); | 7195 CpuFeatures::Scope fscope(SSE2); |
7186 __ movdbl(xmm0, | 7196 __ movdbl(xmm0, |
7187 FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); | 7197 FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
7188 __ movdbl(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); | 7198 __ movdbl(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); |
7189 } else { | 7199 } else { |
7190 __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); | 7200 __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
7191 __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi); | 7201 __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi); |
7192 __ mov(esi, FieldOperand(edi, ebx, times_4, offset)); | 7202 __ mov(esi, FieldOperand(edi, ebx, times_4, offset)); |
7193 __ mov(FieldOperand(edx, HeapNumber::kValueOffset + kPointerSize), esi); | 7203 __ mov(FieldOperand(edx, HeapNumber::kValueOffset + kPointerSize), esi); |
7194 } | 7204 } |
7195 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), edx); | 7205 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), edx); |
7196 __ mov(esi, ebx); | 7206 __ mov(esi, ebx); |
7197 __ RecordWriteArray(eax, | 7207 __ RecordWriteArray(eax, |
7198 edx, | 7208 edx, |
7199 esi, | 7209 esi, |
7200 kDontSaveFPRegs, | 7210 kDontSaveFPRegs, |
7201 EMIT_REMEMBERED_SET, | 7211 EMIT_REMEMBERED_SET, |
7202 OMIT_SMI_CHECK); | 7212 OMIT_SMI_CHECK); |
7203 __ jmp(&entry); | 7213 __ jmp(&entry, Label::kNear); |
7204 | 7214 |
7205 // Replace the-hole nan with the-hole pointer. | 7215 // Replace the-hole NaN with the-hole pointer. |
7206 __ bind(&convert_hole); | 7216 __ bind(&convert_hole); |
7207 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), | 7217 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), |
7208 masm->isolate()->factory()->the_hole_value()); | 7218 masm->isolate()->factory()->the_hole_value()); |
7209 | 7219 |
7210 __ bind(&entry); | 7220 __ bind(&entry); |
7211 __ test(ebx, ebx); | 7221 __ test(ebx, ebx); |
7212 __ j(not_zero, &loop); | 7222 __ j(not_zero, &loop); |
7213 | 7223 |
7214 __ pop(ebx); | 7224 __ pop(ebx); |
7215 __ pop(edx); | 7225 __ pop(edx); |
(...skipping 12 matching lines...) Expand all Loading... |
7228 __ mov(FieldOperand(edx, JSObject::kElementsOffset), eax); | 7238 __ mov(FieldOperand(edx, JSObject::kElementsOffset), eax); |
7229 __ RecordWriteField(edx, | 7239 __ RecordWriteField(edx, |
7230 JSObject::kElementsOffset, | 7240 JSObject::kElementsOffset, |
7231 eax, | 7241 eax, |
7232 edi, | 7242 edi, |
7233 kDontSaveFPRegs, | 7243 kDontSaveFPRegs, |
7234 EMIT_REMEMBERED_SET, | 7244 EMIT_REMEMBERED_SET, |
7235 OMIT_SMI_CHECK); | 7245 OMIT_SMI_CHECK); |
7236 | 7246 |
7237 // Restore registers. | 7247 // Restore registers. |
7238 Label done; | |
7239 __ pop(eax); | 7248 __ pop(eax); |
7240 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 7249 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
7241 __ jmp(&done, Label::kNear); | |
7242 | |
7243 __ bind(&gc_required); | |
7244 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
7245 __ pop(ebx); | |
7246 __ pop(edx); | |
7247 __ pop(eax); | |
7248 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); | |
7249 __ bind(&done); | |
7250 } | 7250 } |
7251 | 7251 |
7252 #undef __ | 7252 #undef __ |
7253 | 7253 |
7254 } } // namespace v8::internal | 7254 } } // namespace v8::internal |
7255 | 7255 |
7256 #endif // V8_TARGET_ARCH_IA32 | 7256 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |