OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 506 } |
507 | 507 |
508 | 508 |
509 #define __ masm()-> | 509 #define __ masm()-> |
510 | 510 |
511 | 511 |
512 // This code tries to be close to ia32 code so that any changes can be | 512 // This code tries to be close to ia32 code so that any changes can be |
513 // easily ported. | 513 // easily ported. |
514 void Deoptimizer::EntryGenerator::Generate() { | 514 void Deoptimizer::EntryGenerator::Generate() { |
515 GeneratePrologue(); | 515 GeneratePrologue(); |
| 516 |
| 517 Isolate* isolate = masm()->isolate(); |
| 518 |
516 CpuFeatures::Scope scope(VFP3); | 519 CpuFeatures::Scope scope(VFP3); |
517 // Save all general purpose registers before messing with them. | 520 // Save all general purpose registers before messing with them. |
518 const int kNumberOfRegisters = Register::kNumRegisters; | 521 const int kNumberOfRegisters = Register::kNumRegisters; |
519 | 522 |
520 // Everything but pc, lr and ip which will be saved but not restored. | 523 // Everything but pc, lr and ip which will be saved but not restored. |
521 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); | 524 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); |
522 | 525 |
523 const int kDoubleRegsSize = | 526 const int kDoubleRegsSize = |
524 kDoubleSize * DwVfpRegister::kNumAllocatableRegisters; | 527 kDoubleSize * DwVfpRegister::kNumAllocatableRegisters; |
525 | 528 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 563 |
561 // Allocate a new deoptimizer object. | 564 // Allocate a new deoptimizer object. |
562 // Pass four arguments in r0 to r3 and fifth argument on stack. | 565 // Pass four arguments in r0 to r3 and fifth argument on stack. |
563 __ PrepareCallCFunction(5, r5); | 566 __ PrepareCallCFunction(5, r5); |
564 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 567 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
565 __ mov(r1, Operand(type())); // bailout type, | 568 __ mov(r1, Operand(type())); // bailout type, |
566 // r2: bailout id already loaded. | 569 // r2: bailout id already loaded. |
567 // r3: code address or 0 already loaded. | 570 // r3: code address or 0 already loaded. |
568 __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. | 571 __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. |
569 // Call Deoptimizer::New(). | 572 // Call Deoptimizer::New(). |
570 __ CallCFunction(ExternalReference::new_deoptimizer_function(), 5); | 573 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 5); |
571 | 574 |
572 // Preserve "deoptimizer" object in register r0 and get the input | 575 // Preserve "deoptimizer" object in register r0 and get the input |
573 // frame descriptor pointer to r1 (deoptimizer->input_); | 576 // frame descriptor pointer to r1 (deoptimizer->input_); |
574 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); | 577 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); |
575 | 578 |
576 // Copy core registers into FrameDescription::registers_[kNumRegisters]. | 579 // Copy core registers into FrameDescription::registers_[kNumRegisters]. |
577 ASSERT(Register::kNumRegisters == kNumberOfRegisters); | 580 ASSERT(Register::kNumRegisters == kNumberOfRegisters); |
578 for (int i = 0; i < kNumberOfRegisters; i++) { | 581 for (int i = 0; i < kNumberOfRegisters; i++) { |
579 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 582 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
580 __ ldr(r2, MemOperand(sp, i * kPointerSize)); | 583 __ ldr(r2, MemOperand(sp, i * kPointerSize)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 __ str(r4, MemOperand(r3, 0)); | 617 __ str(r4, MemOperand(r3, 0)); |
615 __ add(r3, r3, Operand(sizeof(uint32_t))); | 618 __ add(r3, r3, Operand(sizeof(uint32_t))); |
616 __ cmp(r2, sp); | 619 __ cmp(r2, sp); |
617 __ b(ne, &pop_loop); | 620 __ b(ne, &pop_loop); |
618 | 621 |
619 // Compute the output frame in the deoptimizer. | 622 // Compute the output frame in the deoptimizer. |
620 __ push(r0); // Preserve deoptimizer object across call. | 623 __ push(r0); // Preserve deoptimizer object across call. |
621 // r0: deoptimizer object; r1: scratch. | 624 // r0: deoptimizer object; r1: scratch. |
622 __ PrepareCallCFunction(1, r1); | 625 __ PrepareCallCFunction(1, r1); |
623 // Call Deoptimizer::ComputeOutputFrames(). | 626 // Call Deoptimizer::ComputeOutputFrames(). |
624 __ CallCFunction(ExternalReference::compute_output_frames_function(), 1); | 627 __ CallCFunction( |
| 628 ExternalReference::compute_output_frames_function(isolate), 1); |
625 __ pop(r0); // Restore deoptimizer object (class Deoptimizer). | 629 __ pop(r0); // Restore deoptimizer object (class Deoptimizer). |
626 | 630 |
627 // Replace the current (input) frame with the output frames. | 631 // Replace the current (input) frame with the output frames. |
628 Label outer_push_loop, inner_push_loop; | 632 Label outer_push_loop, inner_push_loop; |
629 // Outer loop state: r0 = current "FrameDescription** output_", | 633 // Outer loop state: r0 = current "FrameDescription** output_", |
630 // r1 = one past the last FrameDescription**. | 634 // r1 = one past the last FrameDescription**. |
631 __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset())); | 635 __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset())); |
632 __ ldr(r0, MemOperand(r0, Deoptimizer::output_offset())); // r0 is output_. | 636 __ ldr(r0, MemOperand(r0, Deoptimizer::output_offset())); // r0 is output_. |
633 __ add(r1, r0, Operand(r1, LSL, 2)); | 637 __ add(r1, r0, Operand(r1, LSL, 2)); |
634 __ bind(&outer_push_loop); | 638 __ bind(&outer_push_loop); |
(...skipping 29 matching lines...) Expand all Loading... |
664 __ ldr(r6, MemOperand(r2, offset)); | 668 __ ldr(r6, MemOperand(r2, offset)); |
665 __ push(r6); | 669 __ push(r6); |
666 } | 670 } |
667 | 671 |
668 // Restore the registers from the stack. | 672 // Restore the registers from the stack. |
669 __ ldm(ia_w, sp, restored_regs); // all but pc registers. | 673 __ ldm(ia_w, sp, restored_regs); // all but pc registers. |
670 __ pop(ip); // remove sp | 674 __ pop(ip); // remove sp |
671 __ pop(ip); // remove lr | 675 __ pop(ip); // remove lr |
672 | 676 |
673 // Set up the roots register. | 677 // Set up the roots register. |
674 ExternalReference roots_address = ExternalReference::roots_address(); | 678 ExternalReference roots_address = ExternalReference::roots_address(isolate); |
675 __ mov(r10, Operand(roots_address)); | 679 __ mov(r10, Operand(roots_address)); |
676 | 680 |
677 __ pop(ip); // remove pc | 681 __ pop(ip); // remove pc |
678 __ pop(r7); // get continuation, leave pc on stack | 682 __ pop(r7); // get continuation, leave pc on stack |
679 __ pop(lr); | 683 __ pop(lr); |
680 __ Jump(r7); | 684 __ Jump(r7); |
681 __ stop("Unreachable."); | 685 __ stop("Unreachable."); |
682 } | 686 } |
683 | 687 |
684 | 688 |
(...skipping 14 matching lines...) Expand all Loading... |
699 __ push(ip); | 703 __ push(ip); |
700 __ b(&done); | 704 __ b(&done); |
701 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 705 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
702 } | 706 } |
703 __ bind(&done); | 707 __ bind(&done); |
704 } | 708 } |
705 | 709 |
706 #undef __ | 710 #undef __ |
707 | 711 |
708 } } // namespace v8::internal | 712 } } // namespace v8::internal |
OLD | NEW |