| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 // restore them. | 892 // restore them. |
| 893 for (int i = 0; i < kNumberOfSavedRegs; i++) { | 893 for (int i = 0; i < kNumberOfSavedRegs; i++) { |
| 894 Register reg = saved_regs[i]; | 894 Register reg = saved_regs[i]; |
| 895 if (!reg.is(exclusion1) && !reg.is(exclusion2) && !reg.is(exclusion3)) { | 895 if (!reg.is(exclusion1) && !reg.is(exclusion2) && !reg.is(exclusion3)) { |
| 896 push(reg); | 896 push(reg); |
| 897 } | 897 } |
| 898 } | 898 } |
| 899 // R12 to r15 are callee save on all platforms. | 899 // R12 to r15 are callee save on all platforms. |
| 900 if (fp_mode == kSaveFPRegs) { | 900 if (fp_mode == kSaveFPRegs) { |
| 901 CpuFeatures::Scope scope(SSE2); | 901 CpuFeatures::Scope scope(SSE2); |
| 902 subq(rsp, Immediate(kDoubleSize * XMMRegister::kNumRegisters)); | 902 subq(rsp, Immediate(kDoubleSize * XMMRegister::kMaxNumRegisters)); |
| 903 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { | 903 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) { |
| 904 XMMRegister reg = XMMRegister::from_code(i); | 904 XMMRegister reg = XMMRegister::from_code(i); |
| 905 movsd(Operand(rsp, i * kDoubleSize), reg); | 905 movsd(Operand(rsp, i * kDoubleSize), reg); |
| 906 } | 906 } |
| 907 } | 907 } |
| 908 } | 908 } |
| 909 | 909 |
| 910 | 910 |
| 911 void MacroAssembler::PopCallerSaved(SaveFPRegsMode fp_mode, | 911 void MacroAssembler::PopCallerSaved(SaveFPRegsMode fp_mode, |
| 912 Register exclusion1, | 912 Register exclusion1, |
| 913 Register exclusion2, | 913 Register exclusion2, |
| 914 Register exclusion3) { | 914 Register exclusion3) { |
| 915 if (fp_mode == kSaveFPRegs) { | 915 if (fp_mode == kSaveFPRegs) { |
| 916 CpuFeatures::Scope scope(SSE2); | 916 CpuFeatures::Scope scope(SSE2); |
| 917 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { | 917 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) { |
| 918 XMMRegister reg = XMMRegister::from_code(i); | 918 XMMRegister reg = XMMRegister::from_code(i); |
| 919 movsd(reg, Operand(rsp, i * kDoubleSize)); | 919 movsd(reg, Operand(rsp, i * kDoubleSize)); |
| 920 } | 920 } |
| 921 addq(rsp, Immediate(kDoubleSize * XMMRegister::kNumRegisters)); | 921 addq(rsp, Immediate(kDoubleSize * XMMRegister::kMaxNumRegisters)); |
| 922 } | 922 } |
| 923 for (int i = kNumberOfSavedRegs - 1; i >= 0; i--) { | 923 for (int i = kNumberOfSavedRegs - 1; i >= 0; i--) { |
| 924 Register reg = saved_regs[i]; | 924 Register reg = saved_regs[i]; |
| 925 if (!reg.is(exclusion1) && !reg.is(exclusion2) && !reg.is(exclusion3)) { | 925 if (!reg.is(exclusion1) && !reg.is(exclusion2) && !reg.is(exclusion3)) { |
| 926 pop(reg); | 926 pop(reg); |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 } | 929 } |
| 930 | 930 |
| 931 | 931 |
| (...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 | 3416 |
| 3417 | 3417 |
| 3418 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space, | 3418 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space, |
| 3419 bool save_doubles) { | 3419 bool save_doubles) { |
| 3420 #ifdef _WIN64 | 3420 #ifdef _WIN64 |
| 3421 const int kShadowSpace = 4; | 3421 const int kShadowSpace = 4; |
| 3422 arg_stack_space += kShadowSpace; | 3422 arg_stack_space += kShadowSpace; |
| 3423 #endif | 3423 #endif |
| 3424 // Optionally save all XMM registers. | 3424 // Optionally save all XMM registers. |
| 3425 if (save_doubles) { | 3425 if (save_doubles) { |
| 3426 int space = XMMRegister::kNumRegisters * kDoubleSize + | 3426 int space = XMMRegister::kMaxNumRegisters * kDoubleSize + |
| 3427 arg_stack_space * kPointerSize; | 3427 arg_stack_space * kPointerSize; |
| 3428 subq(rsp, Immediate(space)); | 3428 subq(rsp, Immediate(space)); |
| 3429 int offset = -2 * kPointerSize; | 3429 int offset = -2 * kPointerSize; |
| 3430 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { | 3430 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { |
| 3431 XMMRegister reg = XMMRegister::FromAllocationIndex(i); | 3431 XMMRegister reg = XMMRegister::FromAllocationIndex(i); |
| 3432 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); | 3432 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); |
| 3433 } | 3433 } |
| 3434 } else if (arg_stack_space > 0) { | 3434 } else if (arg_stack_space > 0) { |
| 3435 subq(rsp, Immediate(arg_stack_space * kPointerSize)); | 3435 subq(rsp, Immediate(arg_stack_space * kPointerSize)); |
| 3436 } | 3436 } |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3870 } | 3870 } |
| 3871 } | 3871 } |
| 3872 | 3872 |
| 3873 | 3873 |
| 3874 void MacroAssembler::AllocateInNewSpace(Register object_size, | 3874 void MacroAssembler::AllocateInNewSpace(Register object_size, |
| 3875 Register result, | 3875 Register result, |
| 3876 Register result_end, | 3876 Register result_end, |
| 3877 Register scratch, | 3877 Register scratch, |
| 3878 Label* gc_required, | 3878 Label* gc_required, |
| 3879 AllocationFlags flags) { | 3879 AllocationFlags flags) { |
| 3880 ASSERT((flags & (DOUBLE_ALIGNMENT | RESULT_CONTAINS_TOP | | 3880 ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); |
| 3881 SIZE_IN_WORDS)) == 0); | |
| 3882 if (!FLAG_inline_new) { | 3881 if (!FLAG_inline_new) { |
| 3883 if (emit_debug_code()) { | 3882 if (emit_debug_code()) { |
| 3884 // Trash the registers to simulate an allocation failure. | 3883 // Trash the registers to simulate an allocation failure. |
| 3885 movl(result, Immediate(0x7091)); | 3884 movl(result, Immediate(0x7091)); |
| 3886 movl(result_end, Immediate(0x7191)); | 3885 movl(result_end, Immediate(0x7191)); |
| 3887 if (scratch.is_valid()) { | 3886 if (scratch.is_valid()) { |
| 3888 movl(scratch, Immediate(0x7291)); | 3887 movl(scratch, Immediate(0x7291)); |
| 3889 } | 3888 } |
| 3890 // object_size is left unchanged by this function. | 3889 // object_size is left unchanged by this function. |
| 3891 } | 3890 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3905 } | 3904 } |
| 3906 addq(result_end, result); | 3905 addq(result_end, result); |
| 3907 j(carry, gc_required); | 3906 j(carry, gc_required); |
| 3908 Operand limit_operand = ExternalOperand(new_space_allocation_limit); | 3907 Operand limit_operand = ExternalOperand(new_space_allocation_limit); |
| 3909 cmpq(result_end, limit_operand); | 3908 cmpq(result_end, limit_operand); |
| 3910 j(above, gc_required); | 3909 j(above, gc_required); |
| 3911 | 3910 |
| 3912 // Update allocation top. | 3911 // Update allocation top. |
| 3913 UpdateAllocationTopHelper(result_end, scratch); | 3912 UpdateAllocationTopHelper(result_end, scratch); |
| 3914 | 3913 |
| 3914 // Align the next allocation. Storing the filler map without checking top is |
| 3915 // always safe because the limit of the heap is always aligned. |
| 3916 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { |
| 3917 testq(result, Immediate(kDoubleAlignmentMask)); |
| 3918 Check(zero, "Allocation is not double aligned"); |
| 3919 } |
| 3920 |
| 3915 // Tag the result if requested. | 3921 // Tag the result if requested. |
| 3916 if ((flags & TAG_OBJECT) != 0) { | 3922 if ((flags & TAG_OBJECT) != 0) { |
| 3917 addq(result, Immediate(kHeapObjectTag)); | 3923 addq(result, Immediate(kHeapObjectTag)); |
| 3918 } | 3924 } |
| 3919 } | 3925 } |
| 3920 | 3926 |
| 3921 | 3927 |
| 3922 void MacroAssembler::UndoAllocationInNewSpace(Register object) { | 3928 void MacroAssembler::UndoAllocationInNewSpace(Register object) { |
| 3923 ExternalReference new_space_allocation_top = | 3929 ExternalReference new_space_allocation_top = |
| 3924 ExternalReference::new_space_allocation_top_address(isolate()); | 3930 ExternalReference::new_space_allocation_top_address(isolate()); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4599 FieldOperand(rcx, JSObject::kElementsOffset)); | 4605 FieldOperand(rcx, JSObject::kElementsOffset)); |
| 4600 j(not_equal, call_runtime); | 4606 j(not_equal, call_runtime); |
| 4601 | 4607 |
| 4602 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4608 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
| 4603 cmpq(rcx, null_value); | 4609 cmpq(rcx, null_value); |
| 4604 j(not_equal, &next); | 4610 j(not_equal, &next); |
| 4605 } | 4611 } |
| 4606 | 4612 |
| 4607 void MacroAssembler::TestJSArrayForAllocationSiteInfo( | 4613 void MacroAssembler::TestJSArrayForAllocationSiteInfo( |
| 4608 Register receiver_reg, | 4614 Register receiver_reg, |
| 4609 Register scratch_reg, | 4615 Register scratch_reg) { |
| 4610 Label* allocation_info_present) { | |
| 4611 Label no_info_available; | 4616 Label no_info_available; |
| 4612 ExternalReference new_space_start = | 4617 ExternalReference new_space_start = |
| 4613 ExternalReference::new_space_start(isolate()); | 4618 ExternalReference::new_space_start(isolate()); |
| 4614 ExternalReference new_space_allocation_top = | 4619 ExternalReference new_space_allocation_top = |
| 4615 ExternalReference::new_space_allocation_top_address(isolate()); | 4620 ExternalReference::new_space_allocation_top_address(isolate()); |
| 4616 | 4621 |
| 4617 lea(scratch_reg, Operand(receiver_reg, | 4622 lea(scratch_reg, Operand(receiver_reg, |
| 4618 JSArray::kSize + AllocationSiteInfo::kSize - kHeapObjectTag)); | 4623 JSArray::kSize + AllocationSiteInfo::kSize - kHeapObjectTag)); |
| 4619 movq(kScratchRegister, new_space_start); | 4624 movq(kScratchRegister, new_space_start); |
| 4620 cmpq(scratch_reg, kScratchRegister); | 4625 cmpq(scratch_reg, kScratchRegister); |
| 4621 j(less, &no_info_available); | 4626 j(less, &no_info_available); |
| 4622 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); | 4627 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); |
| 4623 j(greater, &no_info_available); | 4628 j(greater, &no_info_available); |
| 4624 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), | 4629 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), |
| 4625 Heap::kAllocationSiteInfoMapRootIndex); | 4630 Heap::kAllocationSiteInfoMapRootIndex); |
| 4626 j(equal, allocation_info_present); | |
| 4627 bind(&no_info_available); | 4631 bind(&no_info_available); |
| 4628 } | 4632 } |
| 4629 | 4633 |
| 4630 | 4634 |
| 4631 } } // namespace v8::internal | 4635 } } // namespace v8::internal |
| 4632 | 4636 |
| 4633 #endif // V8_TARGET_ARCH_X64 | 4637 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |