| 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 7026 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  7037   //  -- esp[0] : return address |  7037   //  -- esp[0] : return address | 
|  7038   // ----------------------------------- |  7038   // ----------------------------------- | 
|  7039  |  7039  | 
|  7040   Label element_done; |  7040   Label element_done; | 
|  7041   Label double_elements; |  7041   Label double_elements; | 
|  7042   Label smi_element; |  7042   Label smi_element; | 
|  7043   Label slow_elements; |  7043   Label slow_elements; | 
|  7044   Label slow_elements_from_double; |  7044   Label slow_elements_from_double; | 
|  7045   Label fast_elements; |  7045   Label fast_elements; | 
|  7046  |  7046  | 
|  7047   if (!FLAG_trace_elements_transitions) { |  7047   __ CheckFastElements(edi, &double_elements); | 
|  7048     __ CheckFastElements(edi, &double_elements); |  | 
|  7049  |  7048  | 
|  7050     // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS |  7049   // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS | 
|  7051     __ JumpIfSmi(eax, &smi_element); |  7050   __ JumpIfSmi(eax, &smi_element); | 
|  7052     __ CheckFastSmiOnlyElements(edi, &fast_elements, Label::kNear); |  7051   __ CheckFastSmiOnlyElements(edi, &fast_elements, Label::kNear); | 
|  7053  |  7052  | 
|  7054     // Store into the array literal requires a elements transition. Call into |  7053   // Store into the array literal requires a elements transition. Call into | 
|  7055     // the runtime. |  7054   // the runtime. | 
|  7056   } |  | 
|  7057  |  7055  | 
|  7058   __ bind(&slow_elements); |  7056   __ bind(&slow_elements); | 
|  7059   __ pop(edi);  // Pop return address and remember to put back later for tail |  7057   __ pop(edi);  // Pop return address and remember to put back later for tail | 
|  7060                 // call. |  7058                 // call. | 
|  7061   __ push(ebx); |  7059   __ push(ebx); | 
|  7062   __ push(ecx); |  7060   __ push(ecx); | 
|  7063   __ push(eax); |  7061   __ push(eax); | 
|  7064   __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |  7062   __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 
|  7065   __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); |  7063   __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | 
|  7066   __ push(edx); |  7064   __ push(edx); | 
|  7067   __ push(edi);  // Return return address so that tail call returns to right |  7065   __ push(edi);  // Return return address so that tail call returns to right | 
|  7068                  // place. |  7066                  // place. | 
|  7069   __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); |  7067   __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | 
|  7070  |  7068  | 
|  7071   if (!FLAG_trace_elements_transitions) { |  7069   __ bind(&slow_elements_from_double); | 
|  7072     // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |  7070   __ pop(edx); | 
|  7073     __ bind(&double_elements); |  7071   __ jmp(&slow_elements); | 
|  7074  |  7072  | 
|  7075     __ push(edx); |  7073   // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. | 
|  7076     __ mov(edx, FieldOperand(ebx, JSObject::kElementsOffset)); |  7074   __ bind(&fast_elements); | 
|  7077     __ StoreNumberToDoubleElements(eax, |  7075   __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | 
|  7078                                    edx, |  7076   __ lea(ecx, FieldOperand(ebx, ecx, times_half_pointer_size, | 
|  7079                                    ecx, |  7077                            FixedArrayBase::kHeaderSize)); | 
|  7080                                    edi, |  7078   __ mov(Operand(ecx, 0), eax); | 
|  7081                                    xmm0, |  7079   // Update the write barrier for the array store. | 
|  7082                                    &slow_elements_from_double, |  7080   __ RecordWrite(ebx, ecx, eax, | 
|  7083                                    false); |  7081                  kDontSaveFPRegs, | 
|  7084     __ pop(edx); |  7082                  EMIT_REMEMBERED_SET, | 
|  7085     __ jmp(&element_done); |  7083                  OMIT_SMI_CHECK); | 
 |  7084   __ ret(0); | 
|  7086  |  7085  | 
|  7087     __ bind(&slow_elements_from_double); |  7086   // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or | 
|  7088     __ pop(edx); |  7087   // FAST_ELEMENTS, and value is Smi. | 
|  7089     __ jmp(&slow_elements); |  7088   __ bind(&smi_element); | 
 |  7089   __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | 
 |  7090   __ mov(FieldOperand(ebx, ecx, times_half_pointer_size, | 
 |  7091                       FixedArrayBase::kHeaderSize), eax); | 
 |  7092   __ ret(0); | 
|  7090  |  7093  | 
|  7091     // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. |  7094   // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. | 
|  7092     __ bind(&fast_elements); |  7095   __ bind(&double_elements); | 
|  7093     __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); |  | 
|  7094     __ lea(ecx, FieldOperand(ebx, ecx, times_half_pointer_size, |  | 
|  7095                              FixedArrayBase::kHeaderSize)); |  | 
|  7096     __ mov(Operand(ecx, 0), eax); |  | 
|  7097     // Update the write barrier for the array store. |  | 
|  7098     __ RecordWrite(ebx, ecx, eax, |  | 
|  7099                    kDontSaveFPRegs, |  | 
|  7100                    EMIT_REMEMBERED_SET, |  | 
|  7101                    OMIT_SMI_CHECK); |  | 
|  7102     __ jmp(&element_done); |  | 
|  7103  |  7096  | 
|  7104     // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or |  7097   __ push(edx); | 
|  7105     // FAST_ELEMENTS, and value is Smi. |  7098   __ mov(edx, FieldOperand(ebx, JSObject::kElementsOffset)); | 
|  7106     __ bind(&smi_element); |  7099   __ StoreNumberToDoubleElements(eax, | 
|  7107     __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); |  7100                                  edx, | 
|  7108     __ mov(FieldOperand(ebx, ecx, times_half_pointer_size, |  7101                                  ecx, | 
|  7109                         FixedArrayBase::kHeaderSize), eax); |  7102                                  edi, | 
|  7110     // Fall through |  7103                                  xmm0, | 
|  7111     __ bind(&element_done); |  7104                                  &slow_elements_from_double, | 
|  7112     __ ret(0); |  7105                                  false); | 
|  7113   } |  7106   __ pop(edx); | 
 |  7107   __ ret(0); | 
|  7114 } |  7108 } | 
|  7115  |  7109  | 
|  7116 #undef __ |  7110 #undef __ | 
|  7117  |  7111  | 
|  7118 } }  // namespace v8::internal |  7112 } }  // namespace v8::internal | 
|  7119  |  7113  | 
|  7120 #endif  // V8_TARGET_ARCH_IA32 |  7114 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |