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

Side by Side Diff: src/arm/deoptimizer-arm.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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 588
589 ASSERT(0 == output_offset); 589 ASSERT(0 == output_offset);
590 590
591 uint32_t pc = reinterpret_cast<uint32_t>( 591 uint32_t pc = reinterpret_cast<uint32_t>(
592 construct_stub->instruction_start() + 592 construct_stub->instruction_start() +
593 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); 593 isolate_->heap()->construct_stub_deopt_pc_offset()->value());
594 output_frame->SetPc(pc); 594 output_frame->SetPc(pc);
595 } 595 }
596 596
597 597
598 void Deoptimizer::DoComputeSetterStubFrame(TranslationIterator* iterator,
599 int frame_index) {
600 JSFunction* setter = JSFunction::cast(ComputeLiteral(iterator->Next()));
601 // The receiver and RHS are expected in registers by the IC, so they don't
602 // belong to the output stack frame. This means that we have to use a height
603 // of 0 instead of 2.
604 unsigned height = 0;
605 unsigned height_in_bytes = height * kPointerSize;
606 if (FLAG_trace_deopt) {
607 PrintF(" translating setter stub => height=%u\n", height_in_bytes);
608 }
609
610 // 1 stack entry for the return address + 5 stack entries from
611 // StackFrame::INTERNAL (cp, fp, lr, frame type, code object, see
612 // MacroAssembler::EnterFrame) + 1 stack entry from setter stub (RHS, see
613 // StoreStubCompiler::CompileStoreViaSetter).
614 unsigned fixed_frame_size = (1 + 5 + 1) * kPointerSize;
615 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
616
617 // Allocate and store the output frame description.
618 FrameDescription* output_frame =
619 new(output_frame_size) FrameDescription(output_frame_size, setter);
620 output_frame->SetFrameType(StackFrame::INTERNAL);
621
622 // A frame for a setter stub can not be the topmost or bottommost one.
623 ASSERT(frame_index > 0 && frame_index < output_count_ - 1);
624 ASSERT(output_[frame_index] == NULL);
625 output_[frame_index] = output_frame;
626
627 // The top address of the frame is computed from the previous frame's top and
628 // this frame's size.
629 uint32_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
630 output_frame->SetTop(top_address);
631
632 unsigned output_offset = output_frame_size;
633
634 // Read caller's PC from the previous frame.
635 output_offset -= kPointerSize;
636 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
637 output_frame->SetFrameSlot(output_offset, callers_pc);
638 if (FLAG_trace_deopt) {
639 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
640 " ; caller's pc\n",
641 top_address + output_offset, output_offset, callers_pc);
642 }
643
644 // The context can be gotten from the previous frame.
645 output_offset -= kPointerSize;
646 intptr_t value = output_[frame_index - 1]->GetContext();
647 output_frame->SetFrameSlot(output_offset, value);
648 if (FLAG_trace_deopt) {
649 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
650 " ; context\n",
651 top_address + output_offset, output_offset, value);
652 }
653
654 // Read caller's FP from the previous frame, and set this frame's FP.
655 output_offset -= kPointerSize;
656 value = output_[frame_index - 1]->GetFp();
657 output_frame->SetFrameSlot(output_offset, value);
658 intptr_t fp_value = top_address + output_offset;
659 output_frame->SetFp(fp_value);
660 if (FLAG_trace_deopt) {
661 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
662 " ; caller's fp\n",
663 fp_value, output_offset, value);
664 }
665
666 // lr
667 output_offset -= kPointerSize;
668 value = 0x87654321; // TODO(svenpanne) Get lr
669 output_frame->SetFrameSlot(output_offset, value);
670 if (FLAG_trace_deopt) {
671 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR " ; lr\n",
672 top_address + output_offset, output_offset, value);
673 }
674
675 // A marker value is used in place of the function.
676 output_offset -= kPointerSize;
677 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
678 output_frame->SetFrameSlot(output_offset, value);
679 if (FLAG_trace_deopt) {
680 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
681 " ; function (setter sentinel)\n",
682 top_address + output_offset, output_offset, value);
683 }
684
685 // Get Code object from setter function.
686 output_offset -= kPointerSize;
687 value = reinterpret_cast<intptr_t>(setter->code());
688 output_frame->SetFrameSlot(output_offset, value);
689 if (FLAG_trace_deopt) {
690 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
691 " ; code object\n",
692 top_address + output_offset, output_offset, value);
693 }
694
695 // Skip receiver.
696 Translation::Opcode opcode =
697 static_cast<Translation::Opcode>(iterator->Next());
698 iterator->Skip(Translation::NumberOfOperandsFor(opcode));
699
700 // The RHS was part of the artificial setter stub environment.
701 output_offset -= kPointerSize;
702 DoTranslateCommand(iterator, frame_index, output_offset);
703
704 ASSERT(0 == output_offset);
705
706 Code* setter_stub =
707 isolate_->builtins()->builtin(Builtins::kSetterStubForDeopt);
708 intptr_t pc = reinterpret_cast<intptr_t>(
709 setter_stub->instruction_start() +
710 isolate_->heap()->setter_stub_deopt_pc_offset()->value());
711 output_frame->SetPc(pc);
712 }
713
714
598 // This code is very similar to ia32 code, but relies on register names (fp, sp) 715 // This code is very similar to ia32 code, but relies on register names (fp, sp)
599 // and how the frame is laid out. 716 // and how the frame is laid out.
600 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, 717 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
601 int frame_index) { 718 int frame_index) {
602 // Read the ast node id, function, and frame height for this output frame. 719 // Read the ast node id, function, and frame height for this output frame.
603 BailoutId node_id = BailoutId(iterator->Next()); 720 BailoutId node_id = BailoutId(iterator->Next());
604 JSFunction* function; 721 JSFunction* function;
605 if (frame_index != 0) { 722 if (frame_index != 0) {
606 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 723 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
607 } else { 724 } else {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 __ push(ip); 1121 __ push(ip);
1005 __ b(&done); 1122 __ b(&done);
1006 ASSERT(masm()->pc_offset() - start == table_entry_size_); 1123 ASSERT(masm()->pc_offset() - start == table_entry_size_);
1007 } 1124 }
1008 __ bind(&done); 1125 __ bind(&done);
1009 } 1126 }
1010 1127
1011 #undef __ 1128 #undef __
1012 1129
1013 } } // namespace v8::internal 1130 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/arm/lithium-codegen-arm.cc » ('j') | src/builtins.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698