| 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::kNumAllocatableRegisters * |   648   sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * | 
|   647                       kDoubleSize)); |   649                       kDoubleSize)); | 
|   648   for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; 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() { | 
|   655   for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { |   657   // Number of d-regs not known at snapshot time. | 
 |   658   ASSERT(!Serializer::enabled()); | 
 |   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::kNumAllocatableRegisters * |   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) { | 
|   665   str(src, SafepointRegistersAndDoublesSlot(dst)); |   669   str(src, SafepointRegistersAndDoublesSlot(dst)); | 
|   666 } |   670 } | 
|   667  |   671  | 
|   668  |   672  | 
| (...skipping 14 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::kNumAllocatableRegisters * 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)); | 
|   703   ASSERT(!dst1.is(lr));  // r14. |   709   ASSERT(!dst1.is(lr));  // r14. | 
|   704   ASSERT_EQ(0, dst1.code() % 2); |   710   ASSERT_EQ(0, dst1.code() % 2); | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   824   if (value.bits == zero.bits) { |   830   if (value.bits == zero.bits) { | 
|   825     vmov(dst, kDoubleRegZero, cond); |   831     vmov(dst, kDoubleRegZero, cond); | 
|   826   } else if (value.bits == minus_zero.bits) { |   832   } else if (value.bits == minus_zero.bits) { | 
|   827     vneg(dst, kDoubleRegZero, cond); |   833     vneg(dst, kDoubleRegZero, cond); | 
|   828   } else { |   834   } else { | 
|   829     vmov(dst, imm, scratch, cond); |   835     vmov(dst, imm, scratch, cond); | 
|   830   } |   836   } | 
|   831 } |   837 } | 
|   832  |   838  | 
|   833  |   839  | 
 |   840 void MacroAssembler::Vpop(Register base, | 
 |   841                           const DwVfpRegister first, | 
 |   842                           const DwVfpRegister last, | 
 |   843                           Condition cond) { | 
 |   844   ASSERT(CpuFeatures::IsEnabled(VFP2)); | 
 |   845   ASSERT_LE(first.code(), last.code()); | 
 |   846  | 
 |   847   const int first_code = first.code(); | 
 |   848   const int last_code = last.code(); | 
 |   849   const int count = last_code - first_code + 1; | 
 |   850  | 
 |   851   if (count <= 16) { | 
 |   852     vldm(ia_w, base, first, last, cond); | 
 |   853   } else { | 
 |   854     // Since we are increasing the address, load the first registers first. | 
 |   855     ASSERT(first_code < 16 && last_code >= 16); | 
 |   856     vldm(ia_w, base, first, d15, cond); | 
 |   857     vldm(ia_w, base, d16, last, cond); | 
 |   858   } | 
 |   859 } | 
 |   860  | 
 |   861  | 
 |   862 void MacroAssembler::Vpush(Register base, | 
 |   863                            const DwVfpRegister first, | 
 |   864                            const DwVfpRegister last, | 
 |   865                            Condition cond) { | 
 |   866   ASSERT(CpuFeatures::IsEnabled(VFP2)); | 
 |   867   ASSERT_LE(first.code(), last.code()); | 
 |   868  | 
 |   869   const int first_code = first.code(); | 
 |   870   const int last_code = last.code(); | 
 |   871   const int count = last_code - first_code + 1; | 
 |   872  | 
 |   873   if (count <= 16) { | 
 |   874     vstm(db_w, base, first, last, cond); | 
 |   875   } else { | 
 |   876     // Since we are decreasing the address, write the last registers first. | 
 |   877     ASSERT(first_code < 16 && last_code >= 16); | 
 |   878     vstm(db_w, base, d16, last, cond); | 
 |   879     vstm(db_w, base, first, d15, cond); | 
 |   880   } | 
 |   881 } | 
 |   882  | 
 |   883  | 
|   834 void MacroAssembler::EnterFrame(StackFrame::Type type) { |   884 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 
|   835   // r0-r3: preserved |   885   // r0-r3: preserved | 
|   836   stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |   886   stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 
|   837   mov(ip, Operand(Smi::FromInt(type))); |   887   mov(ip, Operand(Smi::FromInt(type))); | 
|   838   push(ip); |   888   push(ip); | 
|   839   mov(ip, Operand(CodeObject())); |   889   mov(ip, Operand(CodeObject())); | 
|   840   push(ip); |   890   push(ip); | 
|   841   add(fp, sp, Operand(3 * kPointerSize));  // Adjust FP to point to saved FP. |   891   add(fp, sp, Operand(3 * kPointerSize));  // Adjust FP to point to saved FP. | 
|   842 } |   892 } | 
|   843  |   893  | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|   871   str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |   921   str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 
|   872  |   922  | 
|   873   // Save the frame pointer and the context in top. |   923   // Save the frame pointer and the context in top. | 
|   874   mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |   924   mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 
|   875   str(fp, MemOperand(ip)); |   925   str(fp, MemOperand(ip)); | 
|   876   mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |   926   mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 
|   877   str(cp, MemOperand(ip)); |   927   str(cp, MemOperand(ip)); | 
|   878  |   928  | 
|   879   // Optionally save all double registers. |   929   // Optionally save all double registers. | 
|   880   if (save_doubles) { |   930   if (save_doubles) { | 
 |   931     // Number of d-regs not known at snapshot time. | 
 |   932     ASSERT(!Serializer::enabled()); | 
|   881     DwVfpRegister first = d0; |   933     DwVfpRegister first = d0; | 
|   882     DwVfpRegister last = |   934     DwVfpRegister last = | 
|   883         DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); |   935         DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1); | 
|   884     vstm(db_w, sp, first, last); |   936     Vpush(sp, first, last); | 
|   885     // Note that d0 will be accessible at |   937     // Note that d0 will be accessible at | 
|   886     //   fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, |   938     //   fp - 2 * kPointerSize - | 
 |   939     //   DwVfpRegister::NumAvailableRegisters() * kDoubleSize, | 
|   887     // since the sp slot and code slot were pushed after the fp. |   940     // since the sp slot and code slot were pushed after the fp. | 
|   888   } |   941   } | 
|   889  |   942  | 
|   890   // Reserve place for the return address and stack space and align the frame |   943   // Reserve place for the return address and stack space and align the frame | 
|   891   // preparing for calling the runtime function. |   944   // preparing for calling the runtime function. | 
|   892   const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |   945   const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 
|   893   sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); |   946   sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); | 
|   894   if (frame_alignment > 0) { |   947   if (frame_alignment > 0) { | 
|   895     ASSERT(IsPowerOf2(frame_alignment)); |   948     ASSERT(IsPowerOf2(frame_alignment)); | 
|   896     and_(sp, sp, Operand(-frame_alignment)); |   949     and_(sp, sp, Operand(-frame_alignment)); | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   931   // flag. |   984   // flag. | 
|   932   return FLAG_sim_stack_alignment; |   985   return FLAG_sim_stack_alignment; | 
|   933 #endif  // defined(V8_HOST_ARCH_ARM) |   986 #endif  // defined(V8_HOST_ARCH_ARM) | 
|   934 } |   987 } | 
|   935  |   988  | 
|   936  |   989  | 
|   937 void MacroAssembler::LeaveExitFrame(bool save_doubles, |   990 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 
|   938                                     Register argument_count) { |   991                                     Register argument_count) { | 
|   939   // Optionally restore all double registers. |   992   // Optionally restore all double registers. | 
|   940   if (save_doubles) { |   993   if (save_doubles) { | 
 |   994     // Number of d-regs not known at snapshot time. | 
 |   995     ASSERT(!Serializer::enabled()); | 
|   941     // Calculate the stack location of the saved doubles and restore them. |   996     // Calculate the stack location of the saved doubles and restore them. | 
|   942     const int offset = 2 * kPointerSize; |   997     const int offset = 2 * kPointerSize; | 
|   943     sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); |   998     sub(r3, fp, Operand(offset + DwVfpRegister::NumAvailableRegisters() * | 
 |   999                         kDoubleSize)); | 
|   944     DwVfpRegister first = d0; |  1000     DwVfpRegister first = d0; | 
|   945     DwVfpRegister last = |  1001     DwVfpRegister last = | 
|   946         DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); |  1002         DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1); | 
|   947     vldm(ia, r3, first, last); |  1003     Vpop(r3, first, last); | 
|   948   } |  1004   } | 
|   949  |  1005  | 
|   950   // Clear top frame. |  1006   // Clear top frame. | 
|   951   mov(r3, Operand(0, RelocInfo::NONE)); |  1007   mov(r3, Operand(0, RelocInfo::NONE)); | 
|   952   mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |  1008   mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 
|   953   str(r3, MemOperand(ip)); |  1009   str(r3, MemOperand(ip)); | 
|   954  |  1010  | 
|   955   // Restore current context from top and clear it in debug mode. |  1011   // Restore current context from top and clear it in debug mode. | 
|   956   mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |  1012   mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 
|   957   ldr(cp, MemOperand(ip)); |  1013   ldr(cp, MemOperand(ip)); | 
| (...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3913 void CodePatcher::EmitCondition(Condition cond) { |  3969 void CodePatcher::EmitCondition(Condition cond) { | 
|  3914   Instr instr = Assembler::instr_at(masm_.pc_); |  3970   Instr instr = Assembler::instr_at(masm_.pc_); | 
|  3915   instr = (instr & ~kCondMask) | cond; |  3971   instr = (instr & ~kCondMask) | cond; | 
|  3916   masm_.emit(instr); |  3972   masm_.emit(instr); | 
|  3917 } |  3973 } | 
|  3918  |  3974  | 
|  3919  |  3975  | 
|  3920 } }  // namespace v8::internal |  3976 } }  // namespace v8::internal | 
|  3921  |  3977  | 
|  3922 #endif  // V8_TARGET_ARCH_ARM |  3978 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW |