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 7022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7033 // ----------------------------------- | 7033 // ----------------------------------- |
7034 // Set transitioned map. | 7034 // Set transitioned map. |
7035 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 7035 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
7036 __ RecordWriteField(edx, | 7036 __ RecordWriteField(edx, |
7037 HeapObject::kMapOffset, | 7037 HeapObject::kMapOffset, |
7038 ebx, | 7038 ebx, |
7039 edi, | 7039 edi, |
7040 kDontSaveFPRegs, | 7040 kDontSaveFPRegs, |
7041 EMIT_REMEMBERED_SET, | 7041 EMIT_REMEMBERED_SET, |
7042 OMIT_SMI_CHECK); | 7042 OMIT_SMI_CHECK); |
| 7043 |
| 7044 if (FLAG_trace_element_transitions) { |
| 7045 // Save registers and make sure return address is on top. |
| 7046 __ pop(esi); |
| 7047 __ push(eax); |
| 7048 __ push(ebx); |
| 7049 __ push(ecx); |
| 7050 __ push(edx); |
| 7051 __ push(esi); |
| 7052 { |
| 7053 FrameScope scope(masm, StackFrame::INTERNAL); |
| 7054 __ push(edx); |
| 7055 __ push(Immediate(FAST_SMI_ONLY_ELEMENTS << kSmiTagSize)); |
| 7056 __ push(FieldOperand(edx, JSObject::kElementsOffset)); |
| 7057 __ push(Immediate(FAST_ELEMENTS << kSmiTagSize)); |
| 7058 __ push(FieldOperand(edx, JSObject::kElementsOffset)); |
| 7059 __ CallRuntime(Runtime::kTraceElementsKindTransition, 5); |
| 7060 } |
| 7061 // Restore registers and make sure return address is on top. |
| 7062 __ pop(esi); |
| 7063 __ pop(edx); |
| 7064 __ pop(ecx); |
| 7065 __ pop(ebx); |
| 7066 __ pop(eax); |
| 7067 __ push(esi); |
| 7068 } |
7043 } | 7069 } |
7044 | 7070 |
7045 | 7071 |
7046 void FastElementsConversionStub::GenerateSmiOnlyToDouble( | 7072 void FastElementsConversionStub::GenerateSmiOnlyToDouble( |
7047 MacroAssembler* masm, StrictModeFlag strict_mode) { | 7073 MacroAssembler* masm, StrictModeFlag strict_mode) { |
7048 // ----------- S t a t e ------------- | 7074 // ----------- S t a t e ------------- |
7049 // -- eax : value | 7075 // -- eax : value |
7050 // -- ebx : target map | 7076 // -- ebx : target map |
7051 // -- ecx : key | 7077 // -- ecx : key |
7052 // -- edx : receiver | 7078 // -- edx : receiver |
7053 // -- esp[0] : return address | 7079 // -- esp[0] : return address |
7054 // ----------------------------------- | 7080 // ----------------------------------- |
7055 Label loop, entry, convert_hole, gc_required; | 7081 Label loop, entry, convert_hole, gc_required; |
| 7082 // Make sure to change the following when pushing more values on the stack. |
| 7083 static int registers_already_on_stack = 2; |
7056 __ push(eax); | 7084 __ push(eax); |
7057 __ push(ebx); | 7085 __ push(ebx); |
7058 | 7086 |
7059 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 7087 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
7060 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); | 7088 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); |
7061 | 7089 |
7062 // Allocate new FixedDoubleArray. | 7090 // Allocate new FixedDoubleArray. |
7063 // edx: receiver | 7091 // edx: receiver |
7064 // edi: length of source FixedArray (smi-tagged) | 7092 // edi: length of source FixedArray (smi-tagged) |
7065 __ lea(esi, Operand(edi, times_4, FixedDoubleArray::kHeaderSize)); | 7093 __ lea(esi, Operand(edi, times_4, FixedDoubleArray::kHeaderSize)); |
(...skipping 12 matching lines...) Expand all Loading... |
7078 __ RecordWriteField(edx, | 7106 __ RecordWriteField(edx, |
7079 JSObject::kElementsOffset, | 7107 JSObject::kElementsOffset, |
7080 ebx, | 7108 ebx, |
7081 edi, | 7109 edi, |
7082 kDontSaveFPRegs, | 7110 kDontSaveFPRegs, |
7083 EMIT_REMEMBERED_SET, | 7111 EMIT_REMEMBERED_SET, |
7084 OMIT_SMI_CHECK); | 7112 OMIT_SMI_CHECK); |
7085 | 7113 |
7086 __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); | 7114 __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); |
7087 | 7115 |
| 7116 if (FLAG_trace_element_transitions) { |
| 7117 static int registers_to_save = 6; |
| 7118 // Swizzle the stack so that all registers are saved below the return |
| 7119 // address, which must be at the top of stack when calling out. |
| 7120 int registers_slot_for_return_address = |
| 7121 registers_to_save + registers_already_on_stack; |
| 7122 __ sub(esp, Immediate(registers_to_save * kPointerSize)); |
| 7123 __ mov(Operand(esp, 5 * kPointerSize), ebx); |
| 7124 __ mov(Operand(esp, 4 * kPointerSize), ecx); |
| 7125 __ mov(Operand(esp, 3 * kPointerSize), edx); |
| 7126 __ mov(Operand(esp, 2 * kPointerSize), esi); |
| 7127 __ mov(Operand(esp, 1 * kPointerSize), edi); |
| 7128 __ mov(ebx, Operand(esp, registers_slot_for_return_address * kPointerSize)); |
| 7129 __ mov(Operand(esp, 0), ebx); |
| 7130 __ mov(Operand(esp, registers_slot_for_return_address * kPointerSize), eax); |
| 7131 { |
| 7132 FrameScope scope(masm, StackFrame::INTERNAL); |
| 7133 __ push(edx); |
| 7134 __ push(Immediate(FAST_SMI_ONLY_ELEMENTS << kSmiTagSize)); |
| 7135 __ push(esi); |
| 7136 __ push(Immediate(FAST_DOUBLE_ELEMENTS << kSmiTagSize)); |
| 7137 __ push(eax); |
| 7138 __ CallRuntime(Runtime::kTraceElementsKindTransition, 5); |
| 7139 } |
| 7140 // Restore all the registers that were saved before the internal frame scope |
| 7141 // was created, ensuring that the return address remains on the top of |
| 7142 // stack. |
| 7143 __ mov(eax, Operand(esp, registers_slot_for_return_address * kPointerSize)); |
| 7144 __ mov(ebx, Operand(esp, 0)); |
| 7145 __ mov(Operand(esp, registers_slot_for_return_address * kPointerSize), ebx); |
| 7146 __ mov(ebx, Operand(esp, 5 * kPointerSize)); |
| 7147 __ mov(ecx, Operand(esp, 4 * kPointerSize)); |
| 7148 __ mov(edx, Operand(esp, 3 * kPointerSize)); |
| 7149 __ mov(esi, Operand(esp, 2 * kPointerSize)); |
| 7150 __ mov(edi, Operand(esp, 1 * kPointerSize)); |
| 7151 __ add(esp, Immediate(registers_to_save * kPointerSize)); |
| 7152 } |
| 7153 |
7088 // Prepare for conversion loop. | 7154 // Prepare for conversion loop. |
7089 ExternalReference canonical_the_hole_nan_reference = | 7155 ExternalReference canonical_the_hole_nan_reference = |
7090 ExternalReference::address_of_the_hole_nan(); | 7156 ExternalReference::address_of_the_hole_nan(); |
7091 XMMRegister the_hole_nan = xmm1; | 7157 XMMRegister the_hole_nan = xmm1; |
7092 if (CpuFeatures::IsSupported(SSE2)) { | 7158 if (CpuFeatures::IsSupported(SSE2)) { |
7093 CpuFeatures::Scope use_sse2(SSE2); | 7159 CpuFeatures::Scope use_sse2(SSE2); |
7094 __ movdbl(the_hole_nan, | 7160 __ movdbl(the_hole_nan, |
7095 Operand::StaticVariable(canonical_the_hole_nan_reference)); | 7161 Operand::StaticVariable(canonical_the_hole_nan_reference)); |
7096 } | 7162 } |
7097 __ jmp(&entry); | 7163 __ jmp(&entry); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7250 // edx: receiver | 7316 // edx: receiver |
7251 // Set transitioned map. | 7317 // Set transitioned map. |
7252 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 7318 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
7253 __ RecordWriteField(edx, | 7319 __ RecordWriteField(edx, |
7254 HeapObject::kMapOffset, | 7320 HeapObject::kMapOffset, |
7255 ebx, | 7321 ebx, |
7256 edi, | 7322 edi, |
7257 kDontSaveFPRegs, | 7323 kDontSaveFPRegs, |
7258 EMIT_REMEMBERED_SET, | 7324 EMIT_REMEMBERED_SET, |
7259 OMIT_SMI_CHECK); | 7325 OMIT_SMI_CHECK); |
| 7326 |
| 7327 if (FLAG_trace_element_transitions) { |
| 7328 static int registers_already_on_stack = 1; |
| 7329 static int registers_to_save = 4; |
| 7330 // Swizzle the stack so that all registers are saved below the return |
| 7331 // address, which must be at the top of stack when calling out. |
| 7332 int registers_slot_for_return_address = |
| 7333 registers_to_save + registers_already_on_stack; |
| 7334 __ sub(esp, Immediate(registers_to_save * kPointerSize)); |
| 7335 __ mov(Operand(esp, 3 * kPointerSize), edx); |
| 7336 __ mov(Operand(esp, 2 * kPointerSize), ecx); |
| 7337 __ mov(Operand(esp, 1 * kPointerSize), ebx); |
| 7338 __ mov(ebx, Operand(esp, registers_slot_for_return_address * kPointerSize)); |
| 7339 __ mov(Operand(esp, 0), ebx); |
| 7340 __ mov(Operand(esp, registers_slot_for_return_address * kPointerSize), eax); |
| 7341 { |
| 7342 FrameScope scope(masm, StackFrame::INTERNAL); |
| 7343 __ push(edx); |
| 7344 __ push(Immediate(FAST_DOUBLE_ELEMENTS << kSmiTagSize)); |
| 7345 __ push(FieldOperand(edx, JSObject::kElementsOffset)); |
| 7346 __ push(Immediate(FAST_ELEMENTS << kSmiTagSize)); |
| 7347 __ push(eax); |
| 7348 __ CallRuntime(Runtime::kTraceElementsKindTransition, 5); |
| 7349 } |
| 7350 // Restore all the registers that were saved before the internal frame scope |
| 7351 // was created, ensuring that the return address remains on the top of |
| 7352 // stack. |
| 7353 __ mov(eax, Operand(esp, registers_slot_for_return_address * kPointerSize)); |
| 7354 __ mov(ebx, Operand(esp, 0)); |
| 7355 __ mov(Operand(esp, registers_slot_for_return_address * kPointerSize), ebx); |
| 7356 __ mov(edx, Operand(esp, 3 * kPointerSize)); |
| 7357 __ mov(ecx, Operand(esp, 2 * kPointerSize)); |
| 7358 __ mov(ebx, Operand(esp, 1 * kPointerSize)); |
| 7359 __ add(esp, Immediate(registers_to_save * kPointerSize)); |
| 7360 } |
| 7361 |
7260 // Replace receiver's backing store with newly created and filled FixedArray. | 7362 // Replace receiver's backing store with newly created and filled FixedArray. |
7261 __ mov(FieldOperand(edx, JSObject::kElementsOffset), eax); | 7363 __ mov(FieldOperand(edx, JSObject::kElementsOffset), eax); |
7262 __ RecordWriteField(edx, | 7364 __ RecordWriteField(edx, |
7263 JSObject::kElementsOffset, | 7365 JSObject::kElementsOffset, |
7264 eax, | 7366 eax, |
7265 edi, | 7367 edi, |
7266 kDontSaveFPRegs, | 7368 kDontSaveFPRegs, |
7267 EMIT_REMEMBERED_SET, | 7369 EMIT_REMEMBERED_SET, |
7268 OMIT_SMI_CHECK); | 7370 OMIT_SMI_CHECK); |
7269 | 7371 |
7270 // Restore registers. | 7372 // Restore registers. |
7271 __ pop(eax); | 7373 __ pop(eax); |
7272 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 7374 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
7273 } | 7375 } |
7274 | 7376 |
7275 #undef __ | 7377 #undef __ |
7276 | 7378 |
7277 } } // namespace v8::internal | 7379 } } // namespace v8::internal |
7278 | 7380 |
7279 #endif // V8_TARGET_ARCH_IA32 | 7381 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |