| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #define __ masm()-> | 141 #define __ masm()-> |
| 142 | 142 |
| 143 void Deoptimizer::EntryGenerator::Generate() { | 143 void Deoptimizer::EntryGenerator::Generate() { |
| 144 GeneratePrologue(); | 144 GeneratePrologue(); |
| 145 | 145 |
| 146 // TODO(all): This code needs to be revisited. We probably only need to save | 146 // TODO(all): This code needs to be revisited. We probably only need to save |
| 147 // caller-saved registers here. Callee-saved registers can be stored directly | 147 // caller-saved registers here. Callee-saved registers can be stored directly |
| 148 // in the input frame. | 148 // in the input frame. |
| 149 | 149 |
| 150 // Save all allocatable floating point registers. | 150 // Save all allocatable floating point registers. |
| 151 CPURegList saved_fp_registers(CPURegister::kFPRegister, kDRegSize, | 151 CPURegList saved_fp_registers(CPURegister::kFPRegister, kDRegSizeInBits, |
| 152 0, FPRegister::NumAllocatableRegisters() - 1); | 152 0, FPRegister::NumAllocatableRegisters() - 1); |
| 153 __ PushCPURegList(saved_fp_registers); | 153 __ PushCPURegList(saved_fp_registers); |
| 154 | 154 |
| 155 // We save all the registers expcept jssp, sp and lr. | 155 // We save all the registers expcept jssp, sp and lr. |
| 156 CPURegList saved_registers(CPURegister::kRegister, kXRegSize, 0, 27); | 156 CPURegList saved_registers(CPURegister::kRegister, kXRegSizeInBits, 0, 27); |
| 157 saved_registers.Combine(fp); | 157 saved_registers.Combine(fp); |
| 158 __ PushCPURegList(saved_registers); | 158 __ PushCPURegList(saved_registers); |
| 159 | 159 |
| 160 const int kSavedRegistersAreaSize = | 160 const int kSavedRegistersAreaSize = |
| 161 (saved_registers.Count() * kXRegSizeInBytes) + | 161 (saved_registers.Count() * kXRegSize) + |
| 162 (saved_fp_registers.Count() * kDRegSizeInBytes); | 162 (saved_fp_registers.Count() * kDRegSize); |
| 163 | 163 |
| 164 // Floating point registers are saved on the stack above core registers. | 164 // Floating point registers are saved on the stack above core registers. |
| 165 const int kFPRegistersOffset = saved_registers.Count() * kXRegSizeInBytes; | 165 const int kFPRegistersOffset = saved_registers.Count() * kXRegSize; |
| 166 | 166 |
| 167 // Get the bailout id from the stack. | 167 // Get the bailout id from the stack. |
| 168 Register bailout_id = x2; | 168 Register bailout_id = x2; |
| 169 __ Peek(bailout_id, kSavedRegistersAreaSize); | 169 __ Peek(bailout_id, kSavedRegistersAreaSize); |
| 170 | 170 |
| 171 Register code_object = x3; | 171 Register code_object = x3; |
| 172 Register fp_to_sp = x4; | 172 Register fp_to_sp = x4; |
| 173 // Get the address of the location in the code object. This is the return | 173 // Get the address of the location in the code object. This is the return |
| 174 // address for lazy deoptimization. | 174 // address for lazy deoptimization. |
| 175 __ Mov(code_object, lr); | 175 __ Mov(code_object, lr); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 for (int i = 0; i < saved_fp_registers.Count(); i++) { | 214 for (int i = 0; i < saved_fp_registers.Count(); i++) { |
| 215 // TODO(all): Look for opportunities to optimize this by using ldp/stp. | 215 // TODO(all): Look for opportunities to optimize this by using ldp/stp. |
| 216 int dst_offset = FrameDescription::double_registers_offset() + | 216 int dst_offset = FrameDescription::double_registers_offset() + |
| 217 (i * kDoubleSize); | 217 (i * kDoubleSize); |
| 218 int src_offset = kFPRegistersOffset + (i * kDoubleSize); | 218 int src_offset = kFPRegistersOffset + (i * kDoubleSize); |
| 219 __ Peek(x2, src_offset); | 219 __ Peek(x2, src_offset); |
| 220 __ Str(x2, MemOperand(x1, dst_offset)); | 220 __ Str(x2, MemOperand(x1, dst_offset)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Remove the bailout id and the saved registers from the stack. | 223 // Remove the bailout id and the saved registers from the stack. |
| 224 __ Drop(1 + (kSavedRegistersAreaSize / kXRegSizeInBytes)); | 224 __ Drop(1 + (kSavedRegistersAreaSize / kXRegSize)); |
| 225 | 225 |
| 226 // Compute a pointer to the unwinding limit in register x2; that is | 226 // Compute a pointer to the unwinding limit in register x2; that is |
| 227 // the first stack slot not part of the input frame. | 227 // the first stack slot not part of the input frame. |
| 228 Register unwind_limit = x2; | 228 Register unwind_limit = x2; |
| 229 __ Ldr(unwind_limit, MemOperand(x1, FrameDescription::frame_size_offset())); | 229 __ Ldr(unwind_limit, MemOperand(x1, FrameDescription::frame_size_offset())); |
| 230 __ Add(unwind_limit, unwind_limit, __ StackPointer()); | 230 __ Add(unwind_limit, unwind_limit, __ StackPointer()); |
| 231 | 231 |
| 232 // Unwind the stack down to - but not including - the unwinding | 232 // Unwind the stack down to - but not including - the unwinding |
| 233 // limit and copy the contents of the activation frame to the input | 233 // limit and copy the contents of the activation frame to the input |
| 234 // frame description. | 234 // frame description. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 373 |
| 374 | 374 |
| 375 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 375 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
| 376 SetFrameSlot(offset, value); | 376 SetFrameSlot(offset, value); |
| 377 } | 377 } |
| 378 | 378 |
| 379 | 379 |
| 380 #undef __ | 380 #undef __ |
| 381 | 381 |
| 382 } } // namespace v8::internal | 382 } } // namespace v8::internal |
| OLD | NEW |