| 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 5950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5961 // -- rdx : array literal index in function | 5961 // -- rdx : array literal index in function |
| 5962 // -- rsp[0] : return address | 5962 // -- rsp[0] : return address |
| 5963 // ----------------------------------- | 5963 // ----------------------------------- |
| 5964 | 5964 |
| 5965 Label element_done; | 5965 Label element_done; |
| 5966 Label double_elements; | 5966 Label double_elements; |
| 5967 Label smi_element; | 5967 Label smi_element; |
| 5968 Label slow_elements; | 5968 Label slow_elements; |
| 5969 Label fast_elements; | 5969 Label fast_elements; |
| 5970 | 5970 |
| 5971 if (!FLAG_trace_elements_transitions) { | 5971 __ CheckFastElements(rdi, &double_elements); |
| 5972 __ CheckFastElements(rdi, &double_elements); | |
| 5973 | 5972 |
| 5974 // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS | 5973 // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS |
| 5975 __ JumpIfSmi(rax, &smi_element); | 5974 __ JumpIfSmi(rax, &smi_element); |
| 5976 __ CheckFastSmiOnlyElements(rdi, &fast_elements); | 5975 __ CheckFastSmiOnlyElements(rdi, &fast_elements); |
| 5977 | 5976 |
| 5978 // Store into the array literal requires a elements transition. Call into | 5977 // Store into the array literal requires a elements transition. Call into |
| 5979 // the runtime. | 5978 // the runtime. |
| 5980 } | |
| 5981 | 5979 |
| 5982 __ bind(&slow_elements); | 5980 __ bind(&slow_elements); |
| 5983 __ pop(rdi); // Pop return address and remember to put back later for tail | 5981 __ pop(rdi); // Pop return address and remember to put back later for tail |
| 5984 // call. | 5982 // call. |
| 5985 __ push(rbx); | 5983 __ push(rbx); |
| 5986 __ push(rcx); | 5984 __ push(rcx); |
| 5987 __ push(rax); | 5985 __ push(rax); |
| 5988 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 5986 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 5989 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); | 5987 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
| 5990 __ push(rdx); | 5988 __ push(rdx); |
| 5991 __ push(rdi); // Return return address so that tail call returns to right | 5989 __ push(rdi); // Return return address so that tail call returns to right |
| 5992 // place. | 5990 // place. |
| 5993 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | 5991 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); |
| 5994 | 5992 |
| 5995 if (!FLAG_trace_elements_transitions) { | 5993 // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. |
| 5996 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. | 5994 __ bind(&fast_elements); |
| 5997 __ bind(&double_elements); | 5995 __ SmiToInteger32(kScratchRegister, rcx); |
| 5996 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 5997 __ lea(rcx, FieldOperand(rbx, kScratchRegister, times_pointer_size, |
| 5998 FixedArrayBase::kHeaderSize)); |
| 5999 __ movq(Operand(rcx, 0), rax); |
| 6000 // Update the write barrier for the array store. |
| 6001 __ RecordWrite(rbx, rcx, rax, |
| 6002 kDontSaveFPRegs, |
| 6003 EMIT_REMEMBERED_SET, |
| 6004 OMIT_SMI_CHECK); |
| 6005 __ ret(0); |
| 5998 | 6006 |
| 5999 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset)); | 6007 // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or |
| 6000 __ SmiToInteger32(r11, rcx); | 6008 // FAST_ELEMENTS, and value is Smi. |
| 6001 __ StoreNumberToDoubleElements(rax, | 6009 __ bind(&smi_element); |
| 6002 r9, | 6010 __ SmiToInteger32(kScratchRegister, rcx); |
| 6003 r11, | 6011 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 6004 xmm0, | 6012 __ movq(FieldOperand(rbx, kScratchRegister, times_pointer_size, |
| 6005 &slow_elements); | 6013 FixedArrayBase::kHeaderSize), rax); |
| 6006 __ jmp(&element_done); | 6014 __ ret(0); |
| 6007 | 6015 |
| 6008 // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. | 6016 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |
| 6009 __ bind(&fast_elements); | 6017 __ bind(&double_elements); |
| 6010 __ SmiToInteger32(kScratchRegister, rcx); | |
| 6011 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); | |
| 6012 __ lea(rcx, FieldOperand(rbx, kScratchRegister, times_pointer_size, | |
| 6013 FixedArrayBase::kHeaderSize)); | |
| 6014 __ movq(Operand(rcx, 0), rax); | |
| 6015 // Update the write barrier for the array store. | |
| 6016 __ RecordWrite(rbx, rcx, rax, | |
| 6017 kDontSaveFPRegs, | |
| 6018 EMIT_REMEMBERED_SET, | |
| 6019 OMIT_SMI_CHECK); | |
| 6020 __ jmp(&element_done); | |
| 6021 | 6018 |
| 6022 // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or | 6019 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 6023 // FAST_ELEMENTS, and value is Smi. | 6020 __ SmiToInteger32(r11, rcx); |
| 6024 __ bind(&smi_element); | 6021 __ StoreNumberToDoubleElements(rax, |
| 6025 __ SmiToInteger32(kScratchRegister, rcx); | 6022 r9, |
| 6026 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); | 6023 r11, |
| 6027 __ movq(FieldOperand(rbx, kScratchRegister, times_pointer_size, | 6024 xmm0, |
| 6028 FixedArrayBase::kHeaderSize), rax); | 6025 &slow_elements); |
| 6029 // Fall through | 6026 __ ret(0); |
| 6030 __ bind(&element_done); | |
| 6031 __ ret(0); | |
| 6032 } | |
| 6033 } | 6027 } |
| 6034 | 6028 |
| 6035 #undef __ | 6029 #undef __ |
| 6036 | 6030 |
| 6037 } } // namespace v8::internal | 6031 } } // namespace v8::internal |
| 6038 | 6032 |
| 6039 #endif // V8_TARGET_ARCH_X64 | 6033 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |