| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 635 |
| 636 | 636 |
| 637 void MacroAssembler::PopSafepointRegisters() { | 637 void MacroAssembler::PopSafepointRegisters() { |
| 638 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; | 638 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; |
| 639 ldm(ia_w, sp, kSafepointSavedRegisters); | 639 ldm(ia_w, sp, kSafepointSavedRegisters); |
| 640 add(sp, sp, Operand(num_unsaved * kPointerSize)); | 640 add(sp, sp, Operand(num_unsaved * kPointerSize)); |
| 641 } | 641 } |
| 642 | 642 |
| 643 | 643 |
| 644 void MacroAssembler::PushSafepointRegistersAndDoubles() { | 644 void MacroAssembler::PushSafepointRegistersAndDoubles() { |
| 645 // Number of d-regs not known at snapshot time. |
| 646 ASSERT(!Serializer::enabled()); |
| 645 PushSafepointRegisters(); | 647 PushSafepointRegisters(); |
| 646 sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * | 648 sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
| 647 kDoubleSize)); | 649 kDoubleSize)); |
| 648 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { | 650 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
| 649 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 651 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
| 650 } | 652 } |
| 651 } | 653 } |
| 652 | 654 |
| 653 | 655 |
| 654 void MacroAssembler::PopSafepointRegistersAndDoubles() { | 656 void MacroAssembler::PopSafepointRegistersAndDoubles() { |
| 657 // Number of d-regs not known at snapshot time. |
| 658 ASSERT(!Serializer::enabled()); |
| 655 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { | 659 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
| 656 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 660 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
| 657 } | 661 } |
| 658 add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * | 662 add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
| 659 kDoubleSize)); | 663 kDoubleSize)); |
| 660 PopSafepointRegisters(); | 664 PopSafepointRegisters(); |
| 661 } | 665 } |
| 662 | 666 |
| 663 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, | 667 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, |
| 664 Register dst) { | 668 Register dst) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 683 return reg_code; | 687 return reg_code; |
| 684 } | 688 } |
| 685 | 689 |
| 686 | 690 |
| 687 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 691 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
| 688 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 692 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
| 689 } | 693 } |
| 690 | 694 |
| 691 | 695 |
| 692 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 696 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
| 697 // Number of d-regs not known at snapshot time. |
| 698 ASSERT(!Serializer::enabled()); |
| 693 // General purpose registers are pushed last on the stack. | 699 // General purpose registers are pushed last on the stack. |
| 694 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; | 700 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; |
| 695 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 701 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
| 696 return MemOperand(sp, doubles_size + register_offset); | 702 return MemOperand(sp, doubles_size + register_offset); |
| 697 } | 703 } |
| 698 | 704 |
| 699 | 705 |
| 700 void MacroAssembler::Ldrd(Register dst1, Register dst2, | 706 void MacroAssembler::Ldrd(Register dst1, Register dst2, |
| 701 const MemOperand& src, Condition cond) { | 707 const MemOperand& src, Condition cond) { |
| 702 ASSERT(src.rm().is(no_reg)); | 708 ASSERT(src.rm().is(no_reg)); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 877 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
| 872 | 878 |
| 873 // Save the frame pointer and the context in top. | 879 // Save the frame pointer and the context in top. |
| 874 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 880 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 875 str(fp, MemOperand(ip)); | 881 str(fp, MemOperand(ip)); |
| 876 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 882 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 877 str(cp, MemOperand(ip)); | 883 str(cp, MemOperand(ip)); |
| 878 | 884 |
| 879 // Optionally save all double registers. | 885 // Optionally save all double registers. |
| 880 if (save_doubles) { | 886 if (save_doubles) { |
| 881 DwVfpRegister first = d0; | 887 // Check CPU flags for number of registers, setting the Z condition flag. |
| 882 DwVfpRegister last = | 888 CheckFor32DRegs(ip); |
| 883 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 889 |
| 884 vstm(db_w, sp, first, last); | 890 vstm(db_w, sp, d16, d31, ne); |
| 891 sub(sp, sp, Operand(16 * kDoubleSize), LeaveCC, eq); |
| 892 vstm(db_w, sp, d0, d15); |
| 885 // Note that d0 will be accessible at | 893 // Note that d0 will be accessible at |
| 886 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, | 894 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, |
| 887 // since the sp slot and code slot were pushed after the fp. | 895 // since the sp slot and code slot were pushed after the fp. |
| 888 } | 896 } |
| 889 | 897 |
| 890 // Reserve place for the return address and stack space and align the frame | 898 // Reserve place for the return address and stack space and align the frame |
| 891 // preparing for calling the runtime function. | 899 // preparing for calling the runtime function. |
| 892 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 900 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |
| 893 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); | 901 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); |
| 894 if (frame_alignment > 0) { | 902 if (frame_alignment > 0) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 } | 942 } |
| 935 | 943 |
| 936 | 944 |
| 937 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 945 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
| 938 Register argument_count) { | 946 Register argument_count) { |
| 939 // Optionally restore all double registers. | 947 // Optionally restore all double registers. |
| 940 if (save_doubles) { | 948 if (save_doubles) { |
| 941 // Calculate the stack location of the saved doubles and restore them. | 949 // Calculate the stack location of the saved doubles and restore them. |
| 942 const int offset = 2 * kPointerSize; | 950 const int offset = 2 * kPointerSize; |
| 943 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); | 951 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); |
| 944 DwVfpRegister first = d0; | 952 |
| 945 DwVfpRegister last = | 953 // Check CPU flags for number of registers, setting the Z condition flag. |
| 946 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 954 CheckFor32DRegs(ip); |
| 947 vldm(ia, r3, first, last); | 955 |
| 956 vldm(ia_w, r3, d0, d15); |
| 957 vldm(ia_w, r3, d16, d31, ne); |
| 958 add(r3, r3, Operand(16 * kDoubleSize), LeaveCC, eq); |
| 948 } | 959 } |
| 949 | 960 |
| 950 // Clear top frame. | 961 // Clear top frame. |
| 951 mov(r3, Operand::Zero()); | 962 mov(r3, Operand::Zero()); |
| 952 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 963 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 953 str(r3, MemOperand(ip)); | 964 str(r3, MemOperand(ip)); |
| 954 | 965 |
| 955 // Restore current context from top and clear it in debug mode. | 966 // Restore current context from top and clear it in debug mode. |
| 956 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 967 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 957 ldr(cp, MemOperand(ip)); | 968 ldr(cp, MemOperand(ip)); |
| (...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 tst(scratch, Operand(0xc0000000)); | 3396 tst(scratch, Operand(0xc0000000)); |
| 3386 add(zeros, zeros, Operand(2), LeaveCC, eq); | 3397 add(zeros, zeros, Operand(2), LeaveCC, eq); |
| 3387 mov(scratch, Operand(scratch, LSL, 2), LeaveCC, eq); | 3398 mov(scratch, Operand(scratch, LSL, 2), LeaveCC, eq); |
| 3388 // Top bit. | 3399 // Top bit. |
| 3389 tst(scratch, Operand(0x80000000u)); | 3400 tst(scratch, Operand(0x80000000u)); |
| 3390 add(zeros, zeros, Operand(1), LeaveCC, eq); | 3401 add(zeros, zeros, Operand(1), LeaveCC, eq); |
| 3391 #endif | 3402 #endif |
| 3392 } | 3403 } |
| 3393 | 3404 |
| 3394 | 3405 |
| 3406 void MacroAssembler::CheckFor32DRegs(Register scratch) { |
| 3407 mov(scratch, Operand(ExternalReference::cpu_features())); |
| 3408 ldr(scratch, MemOperand(scratch)); |
| 3409 tst(scratch, Operand(1u << VFP32DREGS)); |
| 3410 } |
| 3411 |
| 3412 |
| 3395 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii( | 3413 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii( |
| 3396 Register first, | 3414 Register first, |
| 3397 Register second, | 3415 Register second, |
| 3398 Register scratch1, | 3416 Register scratch1, |
| 3399 Register scratch2, | 3417 Register scratch2, |
| 3400 Label* failure) { | 3418 Label* failure) { |
| 3401 int kFlatAsciiStringMask = | 3419 int kFlatAsciiStringMask = |
| 3402 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 3420 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 3403 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 3421 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 3404 and_(scratch1, first, Operand(kFlatAsciiStringMask)); | 3422 and_(scratch1, first, Operand(kFlatAsciiStringMask)); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3963 void CodePatcher::EmitCondition(Condition cond) { | 3981 void CodePatcher::EmitCondition(Condition cond) { |
| 3964 Instr instr = Assembler::instr_at(masm_.pc_); | 3982 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3965 instr = (instr & ~kCondMask) | cond; | 3983 instr = (instr & ~kCondMask) | cond; |
| 3966 masm_.emit(instr); | 3984 masm_.emit(instr); |
| 3967 } | 3985 } |
| 3968 | 3986 |
| 3969 | 3987 |
| 3970 } } // namespace v8::internal | 3988 } } // namespace v8::internal |
| 3971 | 3989 |
| 3972 #endif // V8_TARGET_ARCH_ARM | 3990 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |