Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/x64/deoptimizer-x64.cc

Issue 10855098: Deoptimization support for accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tiny test changes. Rebased. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
595 int frame_index) {
596 JSFunction* setter = JSFunction::cast(ComputeLiteral(iterator->Next()));
597 // The receiver and the implicit return value are expected in registers by the
598 // StoreIC, so they don't belong to the output stack frame. This means that we
599 // have to use a height of 0.
600 unsigned height = 0;
601 unsigned height_in_bytes = height * kPointerSize;
602 if (FLAG_trace_deopt) {
603 PrintF(" translating setter stub => height=%u\n", height_in_bytes);
604 }
605
606 // We need 1 stack entry for the return address + 4 stack entries from
607 // StackFrame::INTERNAL (FP, context, frame type, code object, see
608 // MacroAssembler::EnterFrame) + 1 stack entry from setter stub (implicit
609 // return value, see StoreStubCompiler::CompileStoreViaSetter).
610 unsigned fixed_frame_size = (1 + 4 + 1) * kPointerSize;
611 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
612
613 // Allocate and store the output frame description.
614 FrameDescription* output_frame =
615 new(output_frame_size) FrameDescription(output_frame_size, setter);
616 output_frame->SetFrameType(StackFrame::INTERNAL);
617
618 // A frame for a setter stub can not be the topmost or bottommost one.
619 ASSERT(frame_index > 0 && frame_index < output_count_ - 1);
620 ASSERT(output_[frame_index] == NULL);
621 output_[frame_index] = output_frame;
622
623 // The top address of the frame is computed from the previous frame's top and
624 // this frame's size.
625 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
626 output_frame->SetTop(top_address);
627
628 unsigned output_offset = output_frame_size;
629
630 // Read caller's PC from the previous frame.
631 output_offset -= kPointerSize;
632 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
633 output_frame->SetFrameSlot(output_offset, callers_pc);
634 if (FLAG_trace_deopt) {
635 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
636 " ; caller's pc\n",
637 top_address + output_offset, output_offset, callers_pc);
638 }
639
640 // Read caller's FP from the previous frame, and set this frame's FP.
641 output_offset -= kPointerSize;
642 intptr_t value = output_[frame_index - 1]->GetFp();
643 output_frame->SetFrameSlot(output_offset, value);
644 intptr_t fp_value = top_address + output_offset;
645 output_frame->SetFp(fp_value);
646 if (FLAG_trace_deopt) {
647 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
648 " ; caller's fp\n",
649 fp_value, output_offset, value);
650 }
651
652 // The context can be gotten from the previous frame.
653 output_offset -= kPointerSize;
654 value = output_[frame_index - 1]->GetContext();
655 output_frame->SetFrameSlot(output_offset, value);
656 if (FLAG_trace_deopt) {
657 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
658 " ; context\n",
659 top_address + output_offset, output_offset, value);
660 }
661
662 // A marker value is used in place of the function.
663 output_offset -= kPointerSize;
664 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
665 output_frame->SetFrameSlot(output_offset, value);
666 if (FLAG_trace_deopt) {
667 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
668 " ; function (setter sentinel)\n",
669 top_address + output_offset, output_offset, value);
670 }
671
672 // Get Code object from setter stub.
673 output_offset -= kPointerSize;
674 Code* setter_stub =
675 isolate_->builtins()->builtin(Builtins::kStoreIC_Setter_ForDeopt);
676 value = reinterpret_cast<intptr_t>(setter_stub);
677 output_frame->SetFrameSlot(output_offset, value);
678 if (FLAG_trace_deopt) {
679 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
680 " ; code object\n",
681 top_address + output_offset, output_offset, value);
682 }
683
684 // Skip receiver.
685 Translation::Opcode opcode =
686 static_cast<Translation::Opcode>(iterator->Next());
687 iterator->Skip(Translation::NumberOfOperandsFor(opcode));
688
689 // The implicit return value was part of the artificial setter stub
690 // environment.
691 output_offset -= kPointerSize;
692 DoTranslateCommand(iterator, frame_index, output_offset);
693
694 ASSERT(0 == output_offset);
695
696 intptr_t pc = reinterpret_cast<intptr_t>(
697 setter_stub->instruction_start() +
698 isolate_->heap()->setter_stub_deopt_pc_offset()->value());
699 output_frame->SetPc(pc);
700 }
701
702
594 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, 703 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
595 int frame_index) { 704 int frame_index) {
596 BailoutId node_id = BailoutId(iterator->Next()); 705 BailoutId node_id = BailoutId(iterator->Next());
597 JSFunction* function; 706 JSFunction* function;
598 if (frame_index != 0) { 707 if (frame_index != 0) {
599 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 708 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
600 } else { 709 } else {
601 int closure_id = iterator->Next(); 710 int closure_id = iterator->Next();
602 USE(closure_id); 711 USE(closure_id);
603 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); 712 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 1107 }
999 __ bind(&done); 1108 __ bind(&done);
1000 } 1109 }
1001 1110
1002 #undef __ 1111 #undef __
1003 1112
1004 1113
1005 } } // namespace v8::internal 1114 } } // namespace v8::internal
1006 1115
1007 #endif // V8_TARGET_ARCH_X64 1116 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698