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 5684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5695 { rdi, rdx, rcx, EMIT_REMEMBERED_SET}, | 5695 { rdi, rdx, rcx, EMIT_REMEMBERED_SET}, |
5696 // ElementsTransitionGenerator::GenerateSmiOnlyToObject | 5696 // ElementsTransitionGenerator::GenerateSmiOnlyToObject |
5697 // and ElementsTransitionGenerator::GenerateSmiOnlyToObject | 5697 // and ElementsTransitionGenerator::GenerateSmiOnlyToObject |
5698 // and ElementsTransitionGenerator::GenerateDoubleToObject | 5698 // and ElementsTransitionGenerator::GenerateDoubleToObject |
5699 { rdx, rbx, rdi, EMIT_REMEMBERED_SET}, | 5699 { rdx, rbx, rdi, EMIT_REMEMBERED_SET}, |
5700 // ElementsTransitionGenerator::GenerateSmiOnlyToDouble | 5700 // ElementsTransitionGenerator::GenerateSmiOnlyToDouble |
5701 // and ElementsTransitionGenerator::GenerateDoubleToObject | 5701 // and ElementsTransitionGenerator::GenerateDoubleToObject |
5702 { rdx, r11, r15, EMIT_REMEMBERED_SET}, | 5702 { rdx, r11, r15, EMIT_REMEMBERED_SET}, |
5703 // ElementsTransitionGenerator::GenerateDoubleToObject | 5703 // ElementsTransitionGenerator::GenerateDoubleToObject |
5704 { r11, rax, r15, EMIT_REMEMBERED_SET}, | 5704 { r11, rax, r15, EMIT_REMEMBERED_SET}, |
| 5705 // StoreArrayLiteralElementStub::Generate |
| 5706 { rbx, rax, rcx, EMIT_REMEMBERED_SET}, |
5705 // Null termination. | 5707 // Null termination. |
5706 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} | 5708 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} |
5707 }; | 5709 }; |
5708 | 5710 |
5709 | 5711 |
5710 bool RecordWriteStub::IsPregenerated() { | 5712 bool RecordWriteStub::IsPregenerated() { |
5711 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | 5713 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; |
5712 !entry->object.is(no_reg); | 5714 !entry->object.is(no_reg); |
5713 entry++) { | 5715 entry++) { |
5714 if (object_.is(entry->object) && | 5716 if (object_.is(entry->object) && |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5942 } | 5944 } |
5943 | 5945 |
5944 __ bind(&need_incremental_pop_object); | 5946 __ bind(&need_incremental_pop_object); |
5945 __ pop(regs_.object()); | 5947 __ pop(regs_.object()); |
5946 | 5948 |
5947 __ bind(&need_incremental); | 5949 __ bind(&need_incremental); |
5948 | 5950 |
5949 // Fall through when we need to inform the incremental marker. | 5951 // Fall through when we need to inform the incremental marker. |
5950 } | 5952 } |
5951 | 5953 |
| 5954 |
| 5955 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
| 5956 // ----------- S t a t e ------------- |
| 5957 // -- rax : element value to store |
| 5958 // -- rbx : array literal |
| 5959 // -- rdi : map of array literal |
| 5960 // -- rcx : element index as smi |
| 5961 // -- rdx : array literal index in function |
| 5962 // -- rsp[0] : return address |
| 5963 // ----------------------------------- |
| 5964 |
| 5965 Label element_done; |
| 5966 Label double_elements; |
| 5967 Label smi_element; |
| 5968 Label slow_elements; |
| 5969 Label fast_elements; |
| 5970 |
| 5971 if (!FLAG_trace_elements_transitions) { |
| 5972 __ CheckFastElements(rdi, &double_elements); |
| 5973 |
| 5974 // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS |
| 5975 __ JumpIfSmi(rax, &smi_element); |
| 5976 __ CheckFastSmiOnlyElements(rdi, &fast_elements); |
| 5977 |
| 5978 // Store into the array literal requires a elements transition. Call into |
| 5979 // the runtime. |
| 5980 } |
| 5981 |
| 5982 __ bind(&slow_elements); |
| 5983 __ pop(rdi); // Pop return address and remember to put back later for tail |
| 5984 // call. |
| 5985 __ push(rbx); |
| 5986 __ push(rcx); |
| 5987 __ push(rax); |
| 5988 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 5989 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
| 5990 __ push(rdx); |
| 5991 __ push(rdi); // Return return address so that tail call returns to right |
| 5992 // place. |
| 5993 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); |
| 5994 |
| 5995 if (!FLAG_trace_elements_transitions) { |
| 5996 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |
| 5997 __ bind(&double_elements); |
| 5998 |
| 5999 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 6000 __ SmiToInteger32(r10, rcx); |
| 6001 __ StoreNumberToDoubleElements(rax, |
| 6002 r9, |
| 6003 r10, |
| 6004 xmm0, |
| 6005 &slow_elements); |
| 6006 __ jmp(&element_done); |
| 6007 |
| 6008 // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. |
| 6009 __ bind(&fast_elements); |
| 6010 __ SmiToInteger32(r10, rcx); |
| 6011 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 6012 __ lea(rcx, FieldOperand(rbx, r10, 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 |
| 6022 // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or |
| 6023 // FAST_ELEMENTS, and value is Smi. |
| 6024 __ bind(&smi_element); |
| 6025 __ SmiToInteger32(r10, rcx); |
| 6026 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 6027 __ movq(FieldOperand(rbx, r10, times_pointer_size, |
| 6028 FixedArrayBase::kHeaderSize), rax); |
| 6029 // Fall through |
| 6030 __ bind(&element_done); |
| 6031 __ ret(0); |
| 6032 } |
| 6033 } |
| 6034 |
5952 #undef __ | 6035 #undef __ |
5953 | 6036 |
5954 } } // namespace v8::internal | 6037 } } // namespace v8::internal |
5955 | 6038 |
5956 #endif // V8_TARGET_ARCH_X64 | 6039 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |