| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 void Deoptimizer::EntryGenerator::Generate() { | 376 void Deoptimizer::EntryGenerator::Generate() { |
| 377 GeneratePrologue(); | 377 GeneratePrologue(); |
| 378 | 378 |
| 379 // TODO(all): This code needs to be revisited. We probably only need to save | 379 // TODO(all): This code needs to be revisited. We probably only need to save |
| 380 // caller-saved registers here. Callee-saved registers can be stored directly | 380 // caller-saved registers here. Callee-saved registers can be stored directly |
| 381 // in the input frame. | 381 // in the input frame. |
| 382 | 382 |
| 383 // Save all allocatable floating point registers. | 383 // Save all allocatable floating point registers. |
| 384 CPURegList saved_fp_registers(CPURegister::kFPRegister, kDRegSize, | 384 CPURegList saved_fp_registers(CPURegister::kFPRegister, kDRegSize, |
| 385 0, FPRegister::NumAllocatableRegisters()); | 385 0, FPRegister::NumAllocatableRegisters() - 1); |
| 386 __ PushCPURegList(saved_fp_registers); | 386 __ PushCPURegList(saved_fp_registers); |
| 387 | 387 |
| 388 // We save all the registers expcept jssp, sp and lr. | 388 // We save all the registers expcept jssp, sp and lr. |
| 389 CPURegList saved_registers(CPURegister::kRegister, kXRegSize, 0, 27); | 389 CPURegList saved_registers(CPURegister::kRegister, kXRegSize, 0, 27); |
| 390 saved_registers.Combine(fp); | 390 saved_registers.Combine(fp); |
| 391 __ PushCPURegList(saved_registers); | 391 __ PushCPURegList(saved_registers); |
| 392 | 392 |
| 393 const int kSavedRegistersAreaSize = | 393 const int kSavedRegistersAreaSize = |
| 394 (saved_registers.Count() * kXRegSizeInBytes) + | 394 (saved_registers.Count() * kXRegSizeInBytes) + |
| 395 (saved_fp_registers.Count() * kDRegSizeInBytes); | 395 (saved_fp_registers.Count() * kDRegSizeInBytes); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 478 |
| 479 // Compute the output frame in the deoptimizer. | 479 // Compute the output frame in the deoptimizer. |
| 480 __ Push(x0); // Preserve deoptimizer object across call. | 480 __ Push(x0); // Preserve deoptimizer object across call. |
| 481 | 481 |
| 482 { | 482 { |
| 483 // Call Deoptimizer::ComputeOutputFrames(). | 483 // Call Deoptimizer::ComputeOutputFrames(). |
| 484 AllowExternalCallThatCantCauseGC scope(masm()); | 484 AllowExternalCallThatCantCauseGC scope(masm()); |
| 485 __ CallCFunction( | 485 __ CallCFunction( |
| 486 ExternalReference::compute_output_frames_function(isolate()), 1); | 486 ExternalReference::compute_output_frames_function(isolate()), 1); |
| 487 } | 487 } |
| 488 __ Pop(x0); // Restore deoptimizer object (class Deoptimizer). | 488 __ Pop(x4); // Restore deoptimizer object (class Deoptimizer). |
| 489 | 489 |
| 490 // Replace the current (input) frame with the output frames. | 490 // Replace the current (input) frame with the output frames. |
| 491 Label outer_push_loop, inner_push_loop, | 491 Label outer_push_loop, inner_push_loop, |
| 492 outer_loop_header, inner_loop_header; | 492 outer_loop_header, inner_loop_header; |
| 493 __ Ldrsw(x1, MemOperand(x0, Deoptimizer::output_count_offset())); | 493 __ Ldrsw(x1, MemOperand(x4, Deoptimizer::output_count_offset())); |
| 494 __ Ldr(x0, MemOperand(x0, Deoptimizer::output_offset())); | 494 __ Ldr(x0, MemOperand(x4, Deoptimizer::output_offset())); |
| 495 __ Add(x1, x0, Operand(x1, LSL, kPointerSizeLog2)); | 495 __ Add(x1, x0, Operand(x1, LSL, kPointerSizeLog2)); |
| 496 __ B(&outer_loop_header); | 496 __ B(&outer_loop_header); |
| 497 | 497 |
| 498 __ Bind(&outer_push_loop); | 498 __ Bind(&outer_push_loop); |
| 499 Register current_frame = x2; | 499 Register current_frame = x2; |
| 500 __ Ldr(current_frame, MemOperand(x0, 0)); | 500 __ Ldr(current_frame, MemOperand(x0, 0)); |
| 501 __ Ldr(x3, MemOperand(current_frame, FrameDescription::frame_size_offset())); | 501 __ Ldr(x3, MemOperand(current_frame, FrameDescription::frame_size_offset())); |
| 502 __ B(&inner_loop_header); | 502 __ B(&inner_loop_header); |
| 503 | 503 |
| 504 __ Bind(&inner_push_loop); | 504 __ Bind(&inner_push_loop); |
| 505 __ Sub(x3, x3, kPointerSize); | 505 __ Sub(x3, x3, kPointerSize); |
| 506 __ Add(x6, current_frame, x3); | 506 __ Add(x6, current_frame, x3); |
| 507 __ Ldr(x7, MemOperand(x6, FrameDescription::frame_content_offset())); | 507 __ Ldr(x7, MemOperand(x6, FrameDescription::frame_content_offset())); |
| 508 __ Push(x7); | 508 __ Push(x7); |
| 509 __ Bind(&inner_loop_header); | 509 __ Bind(&inner_loop_header); |
| 510 __ Cbnz(x3, &inner_push_loop); | 510 __ Cbnz(x3, &inner_push_loop); |
| 511 | 511 |
| 512 __ Add(x0, x0, kPointerSize); | 512 __ Add(x0, x0, kPointerSize); |
| 513 __ Bind(&outer_loop_header); | 513 __ Bind(&outer_loop_header); |
| 514 __ Cmp(x0, x1); | 514 __ Cmp(x0, x1); |
| 515 __ B(lt, &outer_push_loop); | 515 __ B(lt, &outer_push_loop); |
| 516 | 516 |
| 517 // TODO(jbramley): The ARM code restores FP registers here. | 517 __ Ldr(x1, MemOperand(x4, Deoptimizer::input_offset())); |
| 518 TODO_UNIMPLEMENTED("EntryGenerator::Generate: Restore FP registers."); | 518 ASSERT(!saved_fp_registers.IncludesAliasOf(crankshaft_fp_scratch) && |
| 519 !saved_fp_registers.IncludesAliasOf(fp_zero) && |
| 520 !saved_fp_registers.IncludesAliasOf(fp_scratch)); |
| 521 int src_offset = FrameDescription::double_registers_offset(); |
| 522 while (!saved_fp_registers.IsEmpty()) { |
| 523 const CPURegister reg = saved_fp_registers.PopLowestIndex(); |
| 524 __ Ldr(reg, MemOperand(x1, src_offset)); |
| 525 src_offset += kDoubleSize; |
| 526 } |
| 519 | 527 |
| 520 // Push state, pc, and continuation from the last output frame. | 528 // Push state, pc, and continuation from the last output frame. |
| 521 if (type() != OSR) { | 529 if (type() != OSR) { |
| 522 __ Ldr(x6, MemOperand(current_frame, FrameDescription::state_offset())); | 530 __ Ldr(x6, MemOperand(current_frame, FrameDescription::state_offset())); |
| 523 __ Push(x6); | 531 __ Push(x6); |
| 524 } | 532 } |
| 525 | 533 |
| 526 // TODO(all): This code needs to be revisited, We probably don't need to | 534 // TODO(all): This code needs to be revisited, We probably don't need to |
| 527 // restore all the registers as fullcodegen does not keep live values in | 535 // restore all the registers as fullcodegen does not keep live values in |
| 528 // registers (note that at least fp must be restored though). | 536 // registers (note that at least fp must be restored though). |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 602 |
| 595 | 603 |
| 596 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 604 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
| 597 SetFrameSlot(offset, value); | 605 SetFrameSlot(offset, value); |
| 598 } | 606 } |
| 599 | 607 |
| 600 | 608 |
| 601 #undef __ | 609 #undef __ |
| 602 | 610 |
| 603 } } // namespace v8::internal | 611 } } // namespace v8::internal |
| OLD | NEW |