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

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

Issue 10910110: Fixed deoptimization of inlined getters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/ia32/stub-cache-ia32.cc ('k') | src/mips/lithium-codegen-mips.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 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 575
576 ASSERT(0 == output_offset); 576 ASSERT(0 == output_offset);
577 577
578 uint32_t pc = reinterpret_cast<uint32_t>( 578 uint32_t pc = reinterpret_cast<uint32_t>(
579 construct_stub->instruction_start() + 579 construct_stub->instruction_start() +
580 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); 580 isolate_->heap()->construct_stub_deopt_pc_offset()->value());
581 output_frame->SetPc(pc); 581 output_frame->SetPc(pc);
582 } 582 }
583 583
584 584
585 void Deoptimizer::DoComputeSetterStubFrame(TranslationIterator* iterator, 585 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
586 int frame_index) { 586 int frame_index,
587 JSFunction* setter = JSFunction::cast(ComputeLiteral(iterator->Next())); 587 bool is_setter_stub_frame) {
588 // The receiver and the implicit return value are expected in registers by the 588 JSFunction* accessor = JSFunction::cast(ComputeLiteral(iterator->Next()));
589 // StoreIC, so they don't belong to the output stack frame. This means that we 589 // The receiver (and the implicit return value, if any) are expected in
590 // have to use a height of 0. 590 // registers by the LoadIC/StoreIC, so they don't belong to the output stack
591 // frame. This means that we have to use a height of 0.
591 unsigned height = 0; 592 unsigned height = 0;
592 unsigned height_in_bytes = height * kPointerSize; 593 unsigned height_in_bytes = height * kPointerSize;
594 const char* kind = is_setter_stub_frame ? "setter" : "getter";
593 if (FLAG_trace_deopt) { 595 if (FLAG_trace_deopt) {
594 PrintF(" translating setter stub => height=%u\n", height_in_bytes); 596 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes);
595 } 597 }
596 598
597 // We need 5 stack entries from StackFrame::INTERNAL (ra, fp, cp, frame type, 599 // We need 5 stack entries from StackFrame::INTERNAL (ra, fp, cp, frame type,
598 // code object, see MacroAssembler::EnterFrame) + 1 stack entry from setter 600 // code object, see MacroAssembler::EnterFrame). For a setter stub frame we
599 // stub (implicit return value, see StoreStubCompiler::CompileStoreViaSetter). 601 // need one additional entry for the implicit return value, see
600 unsigned fixed_frame_size = (5 + 1) * kPointerSize; 602 // StoreStubCompiler::CompileStoreViaSetter.
603 unsigned fixed_frame_entries = 5 + (is_setter_stub_frame ? 1 : 0);
604 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize;
601 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 605 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
602 606
603 // Allocate and store the output frame description. 607 // Allocate and store the output frame description.
604 FrameDescription* output_frame = 608 FrameDescription* output_frame =
605 new(output_frame_size) FrameDescription(output_frame_size, setter); 609 new(output_frame_size) FrameDescription(output_frame_size, accessor);
606 output_frame->SetFrameType(StackFrame::INTERNAL); 610 output_frame->SetFrameType(StackFrame::INTERNAL);
607 611
608 // A frame for a setter stub can not be the topmost or bottommost one. 612 // A frame for an accessor stub can not be the topmost or bottommost one.
609 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); 613 ASSERT(frame_index > 0 && frame_index < output_count_ - 1);
610 ASSERT(output_[frame_index] == NULL); 614 ASSERT(output_[frame_index] == NULL);
611 output_[frame_index] = output_frame; 615 output_[frame_index] = output_frame;
612 616
613 // The top address of the frame is computed from the previous frame's top and 617 // The top address of the frame is computed from the previous frame's top and
614 // this frame's size. 618 // this frame's size.
615 uint32_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; 619 uint32_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
616 output_frame->SetTop(top_address); 620 output_frame->SetTop(top_address);
617 621
618 unsigned output_offset = output_frame_size; 622 unsigned output_offset = output_frame_size;
(...skipping 29 matching lines...) Expand all
648 " ; context\n", 652 " ; context\n",
649 top_address + output_offset, output_offset, value); 653 top_address + output_offset, output_offset, value);
650 } 654 }
651 655
652 // A marker value is used in place of the function. 656 // A marker value is used in place of the function.
653 output_offset -= kPointerSize; 657 output_offset -= kPointerSize;
654 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); 658 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
655 output_frame->SetFrameSlot(output_offset, value); 659 output_frame->SetFrameSlot(output_offset, value);
656 if (FLAG_trace_deopt) { 660 if (FLAG_trace_deopt) {
657 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 661 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
658 " ; function (setter sentinel)\n", 662 " ; function (%s sentinel)\n",
659 top_address + output_offset, output_offset, value); 663 top_address + output_offset, output_offset, value, kind);
660 } 664 }
661 665
662 // Get Code object from setter stub. 666 // Get Code object from accessor stub.
663 output_offset -= kPointerSize; 667 output_offset -= kPointerSize;
664 Code* setter_stub = 668 Builtins::Name name = is_setter_stub_frame ?
665 isolate_->builtins()->builtin(Builtins::kStoreIC_Setter_ForDeopt); 669 Builtins::kStoreIC_Setter_ForDeopt :
666 value = reinterpret_cast<intptr_t>(setter_stub); 670 Builtins::kLoadIC_Getter_ForDeopt;
671 Code* accessor_stub = isolate_->builtins()->builtin(name);
672 value = reinterpret_cast<intptr_t>(accessor_stub);
667 output_frame->SetFrameSlot(output_offset, value); 673 output_frame->SetFrameSlot(output_offset, value);
668 if (FLAG_trace_deopt) { 674 if (FLAG_trace_deopt) {
669 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 675 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
670 " ; code object\n", 676 " ; code object\n",
671 top_address + output_offset, output_offset, value); 677 top_address + output_offset, output_offset, value);
672 } 678 }
673 679
674 // Skip receiver. 680 // Skip receiver.
675 Translation::Opcode opcode = 681 Translation::Opcode opcode =
676 static_cast<Translation::Opcode>(iterator->Next()); 682 static_cast<Translation::Opcode>(iterator->Next());
677 iterator->Skip(Translation::NumberOfOperandsFor(opcode)); 683 iterator->Skip(Translation::NumberOfOperandsFor(opcode));
678 684
679 // The implicit return value was part of the artificial setter stub 685 if (is_setter_stub_frame) {
680 // environment. 686 // The implicit return value was part of the artificial setter stub
681 output_offset -= kPointerSize; 687 // environment.
682 DoTranslateCommand(iterator, frame_index, output_offset); 688 output_offset -= kPointerSize;
689 DoTranslateCommand(iterator, frame_index, output_offset);
690 }
683 691
684 ASSERT(0 == output_offset); 692 ASSERT(0 == output_offset);
685 693
694 Smi* offset = is_setter_stub_frame ?
695 isolate_->heap()->setter_stub_deopt_pc_offset() :
696 isolate_->heap()->getter_stub_deopt_pc_offset();
686 intptr_t pc = reinterpret_cast<intptr_t>( 697 intptr_t pc = reinterpret_cast<intptr_t>(
687 setter_stub->instruction_start() + 698 accessor_stub->instruction_start() + offset->value());
688 isolate_->heap()->setter_stub_deopt_pc_offset()->value());
689 output_frame->SetPc(pc); 699 output_frame->SetPc(pc);
690 } 700 }
691 701
692 702
693 // This code is very similar to ia32/arm code, but relies on register names 703 // This code is very similar to ia32/arm code, but relies on register names
694 // (fp, sp) and how the frame is laid out. 704 // (fp, sp) and how the frame is laid out.
695 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, 705 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
696 int frame_index) { 706 int frame_index) {
697 // Read the ast node id, function, and frame height for this output frame. 707 // Read the ast node id, function, and frame height for this output frame.
698 BailoutId node_id = BailoutId(iterator->Next()); 708 BailoutId node_id = BailoutId(iterator->Next());
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 } 1133 }
1124 1134
1125 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), 1135 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
1126 count() * table_entry_size_); 1136 count() * table_entry_size_);
1127 } 1137 }
1128 1138
1129 #undef __ 1139 #undef __
1130 1140
1131 1141
1132 } } // namespace v8::internal 1142 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698