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

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

Issue 10855098: Deoptimization support for accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed unit tests. 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
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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 687
688 ASSERT(0 == output_offset); 688 ASSERT(0 == output_offset);
689 689
690 uint32_t pc = reinterpret_cast<uint32_t>( 690 uint32_t pc = reinterpret_cast<uint32_t>(
691 construct_stub->instruction_start() + 691 construct_stub->instruction_start() +
692 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); 692 isolate_->heap()->construct_stub_deopt_pc_offset()->value());
693 output_frame->SetPc(pc); 693 output_frame->SetPc(pc);
694 } 694 }
695 695
696 696
697 void Deoptimizer::DoComputeSetterStubFrame(TranslationIterator* iterator,
698 int frame_index) {
699 JSFunction* setter = JSFunction::cast(ComputeLiteral(iterator->Next()));
700 // The receiver and RHS are expected in registers by the IC, so they don't
Michael Starzinger 2012/08/16 17:20:04 s/IC/StoreIC/
Sven Panne 2012/08/17 07:27:26 Done here and on other platforms.
701 // belong to the output stack frame. This means that we have to use a height
702 // of 0 instead of 2.
Michael Starzinger 2012/08/16 17:20:04 Drop the "instead of 2" part.
Sven Panne 2012/08/17 07:27:26 ... it's cleaner! ;-) Done here and on other platf
703 unsigned height = 0;
704 unsigned height_in_bytes = height * kPointerSize;
705 if (FLAG_trace_deopt) {
706 PrintF(" translating setter stub => height=%u\n", height_in_bytes);
707 }
708
709 // 1 stack entry for the return address + 4 stack entries from
Michael Starzinger 2012/08/16 17:20:04 Can we start this sentence with a word, not a numb
Sven Panne 2012/08/17 07:27:26 Done here and on other platforms.
710 // StackFrame::INTERNAL (FP, context, frame type, code object, see
711 // MacroAssembler::EnterFrame) + 1 stack entry from setter stub (RHS, see
712 // StoreStubCompiler::CompileStoreViaSetter).
713 unsigned fixed_frame_size = (1 + 4 + 1) * kPointerSize;
714 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
715
716 // Allocate and store the output frame description.
717 FrameDescription* output_frame =
718 new(output_frame_size) FrameDescription(output_frame_size, setter);
719 output_frame->SetFrameType(StackFrame::INTERNAL);
720
721 // A frame for a setter stub can not be the topmost or bottommost one.
722 ASSERT(frame_index > 0 && frame_index < output_count_ - 1);
723 ASSERT(output_[frame_index] == NULL);
724 output_[frame_index] = output_frame;
725
726 // The top address of the frame is computed from the previous frame's top and
727 // this frame's size.
728 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
729 output_frame->SetTop(top_address);
730
731 unsigned output_offset = output_frame_size;
732
733 // Read caller's PC from the previous frame.
734 output_offset -= kPointerSize;
735 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
736 output_frame->SetFrameSlot(output_offset, callers_pc);
737 if (FLAG_trace_deopt) {
738 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
739 " ; caller's pc\n",
740 top_address + output_offset, output_offset, callers_pc);
741 }
742
743 // Read caller's FP from the previous frame, and set this frame's FP.
744 output_offset -= kPointerSize;
745 intptr_t value = output_[frame_index - 1]->GetFp();
746 output_frame->SetFrameSlot(output_offset, value);
747 intptr_t fp_value = top_address + output_offset;
748 output_frame->SetFp(fp_value);
749 if (FLAG_trace_deopt) {
750 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
751 " ; caller's fp\n",
752 fp_value, output_offset, value);
753 }
754
755 // The context can be gotten from the previous frame.
756 output_offset -= kPointerSize;
757 value = output_[frame_index - 1]->GetContext();
758 output_frame->SetFrameSlot(output_offset, value);
759 if (FLAG_trace_deopt) {
760 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
761 " ; context\n",
762 top_address + output_offset, output_offset, value);
763 }
764
765 // A marker value is used in place of the function.
766 output_offset -= kPointerSize;
767 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
768 output_frame->SetFrameSlot(output_offset, value);
769 if (FLAG_trace_deopt) {
770 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
771 " ; function (setter sentinel)\n",
772 top_address + output_offset, output_offset, value);
773 }
774
775 // Get Code object from setter function.
776 output_offset -= kPointerSize;
777 value = reinterpret_cast<intptr_t>(setter->code());
Michael Starzinger 2012/08/16 17:20:04 I don't think this is quite right. What you want h
Sven Panne 2012/08/17 07:27:26 Good catch. Done here and on other platforms.
778 output_frame->SetFrameSlot(output_offset, value);
779 if (FLAG_trace_deopt) {
780 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
781 " ; code object\n",
782 top_address + output_offset, output_offset, value);
783 }
784
785 // Skip receiver.
786 Translation::Opcode opcode =
787 static_cast<Translation::Opcode>(iterator->Next());
788 iterator->Skip(Translation::NumberOfOperandsFor(opcode));
789
790 // The RHS was part of the artificial setter stub environment.
Michael Starzinger 2012/08/16 17:20:04 I would use "implicit return value" or "passed val
Sven Panne 2012/08/17 07:27:26 Done here and on other platforms.
791 output_offset -= kPointerSize;
792 DoTranslateCommand(iterator, frame_index, output_offset);
793
794 ASSERT(0 == output_offset);
795
796 Code* setter_stub =
Michael Starzinger 2012/08/16 17:20:04 Move this up, you already need if for the code obj
Sven Panne 2012/08/17 07:27:26 Done here and on other platforms.
797 isolate_->builtins()->builtin(Builtins::kSetterStubForDeopt);
798 intptr_t pc = reinterpret_cast<intptr_t>(
799 setter_stub->instruction_start() +
800 isolate_->heap()->setter_stub_deopt_pc_offset()->value());
801 output_frame->SetPc(pc);
802 }
803
804
697 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, 805 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
698 int frame_index) { 806 int frame_index) {
699 BailoutId node_id = BailoutId(iterator->Next()); 807 BailoutId node_id = BailoutId(iterator->Next());
700 JSFunction* function; 808 JSFunction* function;
701 if (frame_index != 0) { 809 if (frame_index != 0) {
702 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 810 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
703 } else { 811 } else {
704 int closure_id = iterator->Next(); 812 int closure_id = iterator->Next();
705 USE(closure_id); 813 USE(closure_id);
706 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); 814 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 } 1202 }
1095 __ bind(&done); 1203 __ bind(&done);
1096 } 1204 }
1097 1205
1098 #undef __ 1206 #undef __
1099 1207
1100 1208
1101 } } // namespace v8::internal 1209 } } // namespace v8::internal
1102 1210
1103 #endif // V8_TARGET_ARCH_IA32 1211 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698