OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 ASSERT(0 == output_offset); | 585 ASSERT(0 == output_offset); |
586 | 586 |
587 intptr_t pc = reinterpret_cast<intptr_t>( | 587 intptr_t pc = reinterpret_cast<intptr_t>( |
588 construct_stub->instruction_start() + | 588 construct_stub->instruction_start() + |
589 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 589 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
590 output_frame->SetPc(pc); | 590 output_frame->SetPc(pc); |
591 } | 591 } |
592 | 592 |
593 | 593 |
594 void Deoptimizer::DoComputeSetterStubFrame(TranslationIterator* iterator, | 594 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, |
595 int frame_index) { | 595 int frame_index, |
596 JSFunction* setter = JSFunction::cast(ComputeLiteral(iterator->Next())); | 596 bool is_setter_stub_frame) { |
597 // The receiver and the implicit return value are expected in registers by the | 597 JSFunction* accessor = JSFunction::cast(ComputeLiteral(iterator->Next())); |
598 // StoreIC, so they don't belong to the output stack frame. This means that we | 598 // The receiver (and the implicit return value, if any) are expected in |
599 // have to use a height of 0. | 599 // registers by the LoadIC/StoreIC, so they don't belong to the output stack |
| 600 // frame. This means that we have to use a height of 0. |
600 unsigned height = 0; | 601 unsigned height = 0; |
601 unsigned height_in_bytes = height * kPointerSize; | 602 unsigned height_in_bytes = height * kPointerSize; |
| 603 const char* kind = is_setter_stub_frame ? "setter" : "getter"; |
602 if (FLAG_trace_deopt) { | 604 if (FLAG_trace_deopt) { |
603 PrintF(" translating setter stub => height=%u\n", height_in_bytes); | 605 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes); |
604 } | 606 } |
605 | 607 |
606 // We need 1 stack entry for the return address + 4 stack entries from | 608 // We need 1 stack entry for the return address + 4 stack entries from |
607 // StackFrame::INTERNAL (FP, context, frame type, code object, see | 609 // StackFrame::INTERNAL (FP, context, frame type, code object, see |
608 // MacroAssembler::EnterFrame) + 1 stack entry from setter stub (implicit | 610 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional |
609 // return value, see StoreStubCompiler::CompileStoreViaSetter). | 611 // entry for the implicit return value, see |
610 unsigned fixed_frame_size = (1 + 4 + 1) * kPointerSize; | 612 // StoreStubCompiler::CompileStoreViaSetter. |
| 613 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0); |
| 614 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; |
611 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 615 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
612 | 616 |
613 // Allocate and store the output frame description. | 617 // Allocate and store the output frame description. |
614 FrameDescription* output_frame = | 618 FrameDescription* output_frame = |
615 new(output_frame_size) FrameDescription(output_frame_size, setter); | 619 new(output_frame_size) FrameDescription(output_frame_size, accessor); |
616 output_frame->SetFrameType(StackFrame::INTERNAL); | 620 output_frame->SetFrameType(StackFrame::INTERNAL); |
617 | 621 |
618 // A frame for a setter stub can not be the topmost or bottommost one. | 622 // A frame for an accessor stub can not be the topmost or bottommost one. |
619 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); | 623 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
620 ASSERT(output_[frame_index] == NULL); | 624 ASSERT(output_[frame_index] == NULL); |
621 output_[frame_index] = output_frame; | 625 output_[frame_index] = output_frame; |
622 | 626 |
623 // The top address of the frame is computed from the previous frame's top and | 627 // The top address of the frame is computed from the previous frame's top and |
624 // this frame's size. | 628 // this frame's size. |
625 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | 629 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
626 output_frame->SetTop(top_address); | 630 output_frame->SetTop(top_address); |
627 | 631 |
628 unsigned output_offset = output_frame_size; | 632 unsigned output_offset = output_frame_size; |
(...skipping 29 matching lines...) Expand all Loading... |
658 " ; context\n", | 662 " ; context\n", |
659 top_address + output_offset, output_offset, value); | 663 top_address + output_offset, output_offset, value); |
660 } | 664 } |
661 | 665 |
662 // A marker value is used in place of the function. | 666 // A marker value is used in place of the function. |
663 output_offset -= kPointerSize; | 667 output_offset -= kPointerSize; |
664 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); | 668 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); |
665 output_frame->SetFrameSlot(output_offset, value); | 669 output_frame->SetFrameSlot(output_offset, value); |
666 if (FLAG_trace_deopt) { | 670 if (FLAG_trace_deopt) { |
667 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 671 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
668 " ; function (setter sentinel)\n", | 672 " ; function (%s sentinel)\n", |
669 top_address + output_offset, output_offset, value); | 673 top_address + output_offset, output_offset, value, kind); |
670 } | 674 } |
671 | 675 |
672 // Get Code object from setter stub. | 676 // Get Code object from accessor stub. |
673 output_offset -= kPointerSize; | 677 output_offset -= kPointerSize; |
674 Code* setter_stub = | 678 Builtins::Name name = is_setter_stub_frame ? |
675 isolate_->builtins()->builtin(Builtins::kStoreIC_Setter_ForDeopt); | 679 Builtins::kStoreIC_Setter_ForDeopt : |
676 value = reinterpret_cast<intptr_t>(setter_stub); | 680 Builtins::kLoadIC_Getter_ForDeopt; |
| 681 Code* accessor_stub = isolate_->builtins()->builtin(name); |
| 682 value = reinterpret_cast<intptr_t>(accessor_stub); |
677 output_frame->SetFrameSlot(output_offset, value); | 683 output_frame->SetFrameSlot(output_offset, value); |
678 if (FLAG_trace_deopt) { | 684 if (FLAG_trace_deopt) { |
679 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 685 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
680 " ; code object\n", | 686 " ; code object\n", |
681 top_address + output_offset, output_offset, value); | 687 top_address + output_offset, output_offset, value); |
682 } | 688 } |
683 | 689 |
684 // Skip receiver. | 690 // Skip receiver. |
685 Translation::Opcode opcode = | 691 Translation::Opcode opcode = |
686 static_cast<Translation::Opcode>(iterator->Next()); | 692 static_cast<Translation::Opcode>(iterator->Next()); |
687 iterator->Skip(Translation::NumberOfOperandsFor(opcode)); | 693 iterator->Skip(Translation::NumberOfOperandsFor(opcode)); |
688 | 694 |
689 // The implicit return value was part of the artificial setter stub | 695 if (is_setter_stub_frame) { |
690 // environment. | 696 // The implicit return value was part of the artificial setter stub |
691 output_offset -= kPointerSize; | 697 // environment. |
692 DoTranslateCommand(iterator, frame_index, output_offset); | 698 output_offset -= kPointerSize; |
| 699 DoTranslateCommand(iterator, frame_index, output_offset); |
| 700 } |
693 | 701 |
694 ASSERT(0 == output_offset); | 702 ASSERT(0 == output_offset); |
695 | 703 |
| 704 Smi* offset = is_setter_stub_frame ? |
| 705 isolate_->heap()->setter_stub_deopt_pc_offset() : |
| 706 isolate_->heap()->getter_stub_deopt_pc_offset(); |
696 intptr_t pc = reinterpret_cast<intptr_t>( | 707 intptr_t pc = reinterpret_cast<intptr_t>( |
697 setter_stub->instruction_start() + | 708 accessor_stub->instruction_start() + offset->value()); |
698 isolate_->heap()->setter_stub_deopt_pc_offset()->value()); | |
699 output_frame->SetPc(pc); | 709 output_frame->SetPc(pc); |
700 } | 710 } |
701 | 711 |
702 | 712 |
703 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 713 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
704 int frame_index) { | 714 int frame_index) { |
705 BailoutId node_id = BailoutId(iterator->Next()); | 715 BailoutId node_id = BailoutId(iterator->Next()); |
706 JSFunction* function; | 716 JSFunction* function; |
707 if (frame_index != 0) { | 717 if (frame_index != 0) { |
708 function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 718 function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } | 1117 } |
1108 __ bind(&done); | 1118 __ bind(&done); |
1109 } | 1119 } |
1110 | 1120 |
1111 #undef __ | 1121 #undef __ |
1112 | 1122 |
1113 | 1123 |
1114 } } // namespace v8::internal | 1124 } } // namespace v8::internal |
1115 | 1125 |
1116 #endif // V8_TARGET_ARCH_X64 | 1126 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |