| 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // deoptimization entry. | 65 // deoptimization entry. |
| 66 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 66 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
| 67 if (deopt_data->Pc(i)->value() == -1) continue; | 67 if (deopt_data->Pc(i)->value() == -1) continue; |
| 68 // Position where Call will be patched in. | 68 // Position where Call will be patched in. |
| 69 Address call_address = instruction_start + deopt_data->Pc(i)->value(); | 69 Address call_address = instruction_start + deopt_data->Pc(i)->value(); |
| 70 // There is room enough to write a long call instruction because we pad | 70 // There is room enough to write a long call instruction because we pad |
| 71 // LLazyBailout instructions with nops if necessary. | 71 // LLazyBailout instructions with nops if necessary. |
| 72 CodePatcher patcher(call_address, Assembler::kCallSequenceLength); | 72 CodePatcher patcher(call_address, Assembler::kCallSequenceLength); |
| 73 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY), | 73 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY), |
| 74 Assembler::RelocInfoNone()); | 74 Assembler::RelocInfoNone()); |
| 75 ASSERT(prev_call_address == NULL || | 75 DCHECK(prev_call_address == NULL || |
| 76 call_address >= prev_call_address + patch_size()); | 76 call_address >= prev_call_address + patch_size()); |
| 77 ASSERT(call_address + patch_size() <= code->instruction_end()); | 77 DCHECK(call_address + patch_size() <= code->instruction_end()); |
| 78 #ifdef DEBUG | 78 #ifdef DEBUG |
| 79 prev_call_address = call_address; | 79 prev_call_address = call_address; |
| 80 #endif | 80 #endif |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | 85 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { |
| 86 // Set the register values. The values are not important as there are no | 86 // Set the register values. The values are not important as there are no |
| 87 // callee saved registers in JavaScript frames, so all registers are | 87 // callee saved registers in JavaScript frames, so all registers are |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 284 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
| 285 __ PushQuad(Operand(rbx, offset)); | 285 __ PushQuad(Operand(rbx, offset)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 // Restore the registers from the stack. | 288 // Restore the registers from the stack. |
| 289 for (int i = kNumberOfRegisters - 1; i >= 0 ; i--) { | 289 for (int i = kNumberOfRegisters - 1; i >= 0 ; i--) { |
| 290 Register r = Register::from_code(i); | 290 Register r = Register::from_code(i); |
| 291 // Do not restore rsp, simply pop the value into the next register | 291 // Do not restore rsp, simply pop the value into the next register |
| 292 // and overwrite this afterwards. | 292 // and overwrite this afterwards. |
| 293 if (r.is(rsp)) { | 293 if (r.is(rsp)) { |
| 294 ASSERT(i > 0); | 294 DCHECK(i > 0); |
| 295 r = Register::from_code(i - 1); | 295 r = Register::from_code(i - 1); |
| 296 } | 296 } |
| 297 __ popq(r); | 297 __ popq(r); |
| 298 } | 298 } |
| 299 | 299 |
| 300 // Set up the roots register. | 300 // Set up the roots register. |
| 301 __ InitializeRootRegister(); | 301 __ InitializeRootRegister(); |
| 302 __ InitializeSmiConstantRegister(); | 302 __ InitializeSmiConstantRegister(); |
| 303 | 303 |
| 304 // Return to the continuation point. | 304 // Return to the continuation point. |
| 305 __ ret(0); | 305 __ ret(0); |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | 309 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { |
| 310 // Create a sequence of deoptimization entries. | 310 // Create a sequence of deoptimization entries. |
| 311 Label done; | 311 Label done; |
| 312 for (int i = 0; i < count(); i++) { | 312 for (int i = 0; i < count(); i++) { |
| 313 int start = masm()->pc_offset(); | 313 int start = masm()->pc_offset(); |
| 314 USE(start); | 314 USE(start); |
| 315 __ pushq_imm32(i); | 315 __ pushq_imm32(i); |
| 316 __ jmp(&done); | 316 __ jmp(&done); |
| 317 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 317 DCHECK(masm()->pc_offset() - start == table_entry_size_); |
| 318 } | 318 } |
| 319 __ bind(&done); | 319 __ bind(&done); |
| 320 } | 320 } |
| 321 | 321 |
| 322 | 322 |
| 323 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { | 323 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { |
| 324 if (kPCOnStackSize == 2 * kPointerSize) { | 324 if (kPCOnStackSize == 2 * kPointerSize) { |
| 325 // Zero out the high-32 bit of PC for x32 port. | 325 // Zero out the high-32 bit of PC for x32 port. |
| 326 SetFrameSlot(offset + kPointerSize, 0); | 326 SetFrameSlot(offset + kPointerSize, 0); |
| 327 } | 327 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 343 UNREACHABLE(); | 343 UNREACHABLE(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 | 346 |
| 347 #undef __ | 347 #undef __ |
| 348 | 348 |
| 349 | 349 |
| 350 } } // namespace v8::internal | 350 } } // namespace v8::internal |
| 351 | 351 |
| 352 #endif // V8_TARGET_ARCH_X64 | 352 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |