| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
| 9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
| 10 #include "src/safepoint-table.h" | 10 #include "src/safepoint-table.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (deopt_data->Pc(i)->value() == -1) continue; | 58 if (deopt_data->Pc(i)->value() == -1) continue; |
| 59 Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 59 Address call_address = code_start_address + deopt_data->Pc(i)->value(); |
| 60 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); | 60 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); |
| 61 // We need calls to have a predictable size in the unoptimized code, but | 61 // We need calls to have a predictable size in the unoptimized code, but |
| 62 // this is optimized code, so we don't have to have a predictable size. | 62 // this is optimized code, so we don't have to have a predictable size. |
| 63 int call_size_in_bytes = | 63 int call_size_in_bytes = |
| 64 MacroAssembler::CallSizeNotPredictableCodeSize(isolate, | 64 MacroAssembler::CallSizeNotPredictableCodeSize(isolate, |
| 65 deopt_entry, | 65 deopt_entry, |
| 66 RelocInfo::NONE32); | 66 RelocInfo::NONE32); |
| 67 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; | 67 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; |
| 68 ASSERT(call_size_in_bytes % Assembler::kInstrSize == 0); | 68 DCHECK(call_size_in_bytes % Assembler::kInstrSize == 0); |
| 69 ASSERT(call_size_in_bytes <= patch_size()); | 69 DCHECK(call_size_in_bytes <= patch_size()); |
| 70 CodePatcher patcher(call_address, call_size_in_words); | 70 CodePatcher patcher(call_address, call_size_in_words); |
| 71 patcher.masm()->Call(deopt_entry, RelocInfo::NONE32); | 71 patcher.masm()->Call(deopt_entry, RelocInfo::NONE32); |
| 72 ASSERT(prev_call_address == NULL || | 72 DCHECK(prev_call_address == NULL || |
| 73 call_address >= prev_call_address + patch_size()); | 73 call_address >= prev_call_address + patch_size()); |
| 74 ASSERT(call_address + patch_size() <= code->instruction_end()); | 74 DCHECK(call_address + patch_size() <= code->instruction_end()); |
| 75 #ifdef DEBUG | 75 #ifdef DEBUG |
| 76 prev_call_address = call_address; | 76 prev_call_address = call_address; |
| 77 #endif | 77 #endif |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | 82 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { |
| 83 // Set the register values. The values are not important as there are no | 83 // Set the register values. The values are not important as there are no |
| 84 // callee saved registers in JavaScript frames, so all registers are | 84 // callee saved registers in JavaScript frames, so all registers are |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Save all general purpose registers before messing with them. | 135 // Save all general purpose registers before messing with them. |
| 136 const int kNumberOfRegisters = Register::kNumRegisters; | 136 const int kNumberOfRegisters = Register::kNumRegisters; |
| 137 | 137 |
| 138 // Everything but pc, lr and ip which will be saved but not restored. | 138 // Everything but pc, lr and ip which will be saved but not restored. |
| 139 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); | 139 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); |
| 140 | 140 |
| 141 const int kDoubleRegsSize = | 141 const int kDoubleRegsSize = |
| 142 kDoubleSize * DwVfpRegister::kMaxNumAllocatableRegisters; | 142 kDoubleSize * DwVfpRegister::kMaxNumAllocatableRegisters; |
| 143 | 143 |
| 144 // Save all allocatable VFP registers before messing with them. | 144 // Save all allocatable VFP registers before messing with them. |
| 145 ASSERT(kDoubleRegZero.code() == 14); | 145 DCHECK(kDoubleRegZero.code() == 14); |
| 146 ASSERT(kScratchDoubleReg.code() == 15); | 146 DCHECK(kScratchDoubleReg.code() == 15); |
| 147 | 147 |
| 148 // Check CPU flags for number of registers, setting the Z condition flag. | 148 // Check CPU flags for number of registers, setting the Z condition flag. |
| 149 __ CheckFor32DRegs(ip); | 149 __ CheckFor32DRegs(ip); |
| 150 | 150 |
| 151 // Push registers d0-d13, and possibly d16-d31, on the stack. | 151 // Push registers d0-d13, and possibly d16-d31, on the stack. |
| 152 // If d16-d31 are not pushed, decrease the stack pointer instead. | 152 // If d16-d31 are not pushed, decrease the stack pointer instead. |
| 153 __ vstm(db_w, sp, d16, d31, ne); | 153 __ vstm(db_w, sp, d16, d31, ne); |
| 154 __ sub(sp, sp, Operand(16 * kDoubleSize), LeaveCC, eq); | 154 __ sub(sp, sp, Operand(16 * kDoubleSize), LeaveCC, eq); |
| 155 __ vstm(db_w, sp, d0, d13); | 155 __ vstm(db_w, sp, d0, d13); |
| 156 | 156 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 187 { | 187 { |
| 188 AllowExternalCallThatCantCauseGC scope(masm()); | 188 AllowExternalCallThatCantCauseGC scope(masm()); |
| 189 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); | 189 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Preserve "deoptimizer" object in register r0 and get the input | 192 // Preserve "deoptimizer" object in register r0 and get the input |
| 193 // frame descriptor pointer to r1 (deoptimizer->input_); | 193 // frame descriptor pointer to r1 (deoptimizer->input_); |
| 194 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); | 194 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); |
| 195 | 195 |
| 196 // Copy core registers into FrameDescription::registers_[kNumRegisters]. | 196 // Copy core registers into FrameDescription::registers_[kNumRegisters]. |
| 197 ASSERT(Register::kNumRegisters == kNumberOfRegisters); | 197 DCHECK(Register::kNumRegisters == kNumberOfRegisters); |
| 198 for (int i = 0; i < kNumberOfRegisters; i++) { | 198 for (int i = 0; i < kNumberOfRegisters; i++) { |
| 199 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 199 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
| 200 __ ldr(r2, MemOperand(sp, i * kPointerSize)); | 200 __ ldr(r2, MemOperand(sp, i * kPointerSize)); |
| 201 __ str(r2, MemOperand(r1, offset)); | 201 __ str(r2, MemOperand(r1, offset)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Copy VFP registers to | 204 // Copy VFP registers to |
| 205 // double_registers_[DoubleRegister::kMaxNumAllocatableRegisters] | 205 // double_registers_[DoubleRegister::kMaxNumAllocatableRegisters] |
| 206 int double_regs_offset = FrameDescription::double_registers_offset(); | 206 int double_regs_offset = FrameDescription::double_registers_offset(); |
| 207 for (int i = 0; i < DwVfpRegister::kMaxNumAllocatableRegisters; ++i) { | 207 for (int i = 0; i < DwVfpRegister::kMaxNumAllocatableRegisters; ++i) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | 320 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { |
| 321 // Create a sequence of deoptimization entries. | 321 // Create a sequence of deoptimization entries. |
| 322 // Note that registers are still live when jumping to an entry. | 322 // Note that registers are still live when jumping to an entry. |
| 323 Label done; | 323 Label done; |
| 324 for (int i = 0; i < count(); i++) { | 324 for (int i = 0; i < count(); i++) { |
| 325 int start = masm()->pc_offset(); | 325 int start = masm()->pc_offset(); |
| 326 USE(start); | 326 USE(start); |
| 327 __ mov(ip, Operand(i)); | 327 __ mov(ip, Operand(i)); |
| 328 __ b(&done); | 328 __ b(&done); |
| 329 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 329 DCHECK(masm()->pc_offset() - start == table_entry_size_); |
| 330 } | 330 } |
| 331 __ bind(&done); | 331 __ bind(&done); |
| 332 __ push(ip); | 332 __ push(ip); |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { | 336 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { |
| 337 SetFrameSlot(offset, value); | 337 SetFrameSlot(offset, value); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 341 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
| 342 SetFrameSlot(offset, value); | 342 SetFrameSlot(offset, value); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 346 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
| 347 ASSERT(FLAG_enable_ool_constant_pool); | 347 DCHECK(FLAG_enable_ool_constant_pool); |
| 348 SetFrameSlot(offset, value); | 348 SetFrameSlot(offset, value); |
| 349 } | 349 } |
| 350 | 350 |
| 351 | 351 |
| 352 #undef __ | 352 #undef __ |
| 353 | 353 |
| 354 } } // namespace v8::internal | 354 } } // namespace v8::internal |
| OLD | NEW |