OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 case Translation::REGISTER: | 780 case Translation::REGISTER: |
781 case Translation::INT32_REGISTER: | 781 case Translation::INT32_REGISTER: |
782 case Translation::UINT32_REGISTER: | 782 case Translation::UINT32_REGISTER: |
783 case Translation::DOUBLE_REGISTER: | 783 case Translation::DOUBLE_REGISTER: |
784 case Translation::STACK_SLOT: | 784 case Translation::STACK_SLOT: |
785 case Translation::INT32_STACK_SLOT: | 785 case Translation::INT32_STACK_SLOT: |
786 case Translation::UINT32_STACK_SLOT: | 786 case Translation::UINT32_STACK_SLOT: |
787 case Translation::DOUBLE_STACK_SLOT: | 787 case Translation::DOUBLE_STACK_SLOT: |
788 case Translation::LITERAL: | 788 case Translation::LITERAL: |
789 case Translation::ARGUMENTS_OBJECT: | 789 case Translation::ARGUMENTS_OBJECT: |
790 case Translation::DUPLICATE: | |
791 default: | 790 default: |
792 UNREACHABLE(); | 791 UNREACHABLE(); |
793 break; | 792 break; |
794 } | 793 } |
795 } | 794 } |
796 | 795 |
797 // Print some helpful diagnostic information. | 796 // Print some helpful diagnostic information. |
798 if (trace_) { | 797 if (trace_) { |
799 double ms = static_cast<double>(OS::Ticks() - start) / 1000; | 798 double ms = static_cast<double>(OS::Ticks() - start) / 1000; |
800 int index = output_count_ - 1; // Index of the topmost frame. | 799 int index = output_count_ - 1; // Index of the topmost frame. |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1708 | 1707 |
1709 void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, | 1708 void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, |
1710 int frame_index, | 1709 int frame_index, |
1711 unsigned output_offset, | 1710 unsigned output_offset, |
1712 DeoptimizerTranslatedValueType value_type) { | 1711 DeoptimizerTranslatedValueType value_type) { |
1713 disasm::NameConverter converter; | 1712 disasm::NameConverter converter; |
1714 // A GC-safe temporary placeholder that we can put in the output frame. | 1713 // A GC-safe temporary placeholder that we can put in the output frame. |
1715 const intptr_t kPlaceholder = reinterpret_cast<intptr_t>(Smi::FromInt(0)); | 1714 const intptr_t kPlaceholder = reinterpret_cast<intptr_t>(Smi::FromInt(0)); |
1716 bool is_native = value_type == TRANSLATED_VALUE_IS_NATIVE; | 1715 bool is_native = value_type == TRANSLATED_VALUE_IS_NATIVE; |
1717 | 1716 |
1718 // Ignore commands marked as duplicate and act on the first non-duplicate. | |
1719 Translation::Opcode opcode = | 1717 Translation::Opcode opcode = |
1720 static_cast<Translation::Opcode>(iterator->Next()); | 1718 static_cast<Translation::Opcode>(iterator->Next()); |
1721 while (opcode == Translation::DUPLICATE) { | |
1722 opcode = static_cast<Translation::Opcode>(iterator->Next()); | |
1723 iterator->Skip(Translation::NumberOfOperandsFor(opcode)); | |
1724 opcode = static_cast<Translation::Opcode>(iterator->Next()); | |
1725 } | |
1726 | 1719 |
1727 switch (opcode) { | 1720 switch (opcode) { |
1728 case Translation::BEGIN: | 1721 case Translation::BEGIN: |
1729 case Translation::JS_FRAME: | 1722 case Translation::JS_FRAME: |
1730 case Translation::ARGUMENTS_ADAPTOR_FRAME: | 1723 case Translation::ARGUMENTS_ADAPTOR_FRAME: |
1731 case Translation::CONSTRUCT_STUB_FRAME: | 1724 case Translation::CONSTRUCT_STUB_FRAME: |
1732 case Translation::GETTER_STUB_FRAME: | 1725 case Translation::GETTER_STUB_FRAME: |
1733 case Translation::SETTER_STUB_FRAME: | 1726 case Translation::SETTER_STUB_FRAME: |
1734 case Translation::COMPILED_STUB_FRAME: | 1727 case Translation::COMPILED_STUB_FRAME: |
1735 case Translation::DUPLICATE: | |
1736 UNREACHABLE(); | |
Michael Starzinger
2013/06/11 17:24:07
Don't remove the unreachable assertion, other case
titzer
2013/06/12 09:30:04
Done.
| |
1737 return; | |
1738 | 1728 |
1739 case Translation::REGISTER: { | 1729 case Translation::REGISTER: { |
1740 int input_reg = iterator->Next(); | 1730 int input_reg = iterator->Next(); |
1741 intptr_t input_value = input_->GetRegister(input_reg); | 1731 intptr_t input_value = input_->GetRegister(input_reg); |
1742 if (trace_) { | 1732 if (trace_) { |
1743 PrintF( | 1733 PrintF( |
1744 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s ", | 1734 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s ", |
1745 output_[frame_index]->GetTop() + output_offset, | 1735 output_[frame_index]->GetTop() + output_offset, |
1746 output_offset, | 1736 output_offset, |
1747 input_value, | 1737 input_value, |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1991 disasm::NameConverter converter; | 1981 disasm::NameConverter converter; |
1992 FrameDescription* output = output_[0]; | 1982 FrameDescription* output = output_[0]; |
1993 | 1983 |
1994 // The input values are all part of the unoptimized frame so they | 1984 // The input values are all part of the unoptimized frame so they |
1995 // are all tagged pointers. | 1985 // are all tagged pointers. |
1996 uintptr_t input_value = input_->GetFrameSlot(*input_offset); | 1986 uintptr_t input_value = input_->GetFrameSlot(*input_offset); |
1997 Object* input_object = reinterpret_cast<Object*>(input_value); | 1987 Object* input_object = reinterpret_cast<Object*>(input_value); |
1998 | 1988 |
1999 Translation::Opcode opcode = | 1989 Translation::Opcode opcode = |
2000 static_cast<Translation::Opcode>(iterator->Next()); | 1990 static_cast<Translation::Opcode>(iterator->Next()); |
2001 bool duplicate = (opcode == Translation::DUPLICATE); | |
2002 if (duplicate) { | |
2003 opcode = static_cast<Translation::Opcode>(iterator->Next()); | |
2004 } | |
2005 | 1991 |
2006 switch (opcode) { | 1992 switch (opcode) { |
2007 case Translation::BEGIN: | 1993 case Translation::BEGIN: |
2008 case Translation::JS_FRAME: | 1994 case Translation::JS_FRAME: |
2009 case Translation::ARGUMENTS_ADAPTOR_FRAME: | 1995 case Translation::ARGUMENTS_ADAPTOR_FRAME: |
2010 case Translation::CONSTRUCT_STUB_FRAME: | 1996 case Translation::CONSTRUCT_STUB_FRAME: |
2011 case Translation::GETTER_STUB_FRAME: | 1997 case Translation::GETTER_STUB_FRAME: |
2012 case Translation::SETTER_STUB_FRAME: | 1998 case Translation::SETTER_STUB_FRAME: |
2013 case Translation::COMPILED_STUB_FRAME: | 1999 case Translation::COMPILED_STUB_FRAME: |
2014 case Translation::DUPLICATE: | |
2015 UNREACHABLE(); // Malformed input. | |
Michael Starzinger
2013/06/11 17:24:07
Don't remove the unreachable assertion, other case
titzer
2013/06/12 09:30:04
Done.
| |
2016 return false; | |
2017 | 2000 |
2018 case Translation::REGISTER: { | 2001 case Translation::REGISTER: { |
2019 int output_reg = iterator->Next(); | 2002 int output_reg = iterator->Next(); |
2020 if (FLAG_trace_osr) { | 2003 if (FLAG_trace_osr) { |
2021 PrintF(" %s <- 0x%08" V8PRIxPTR " ; [sp + %d]\n", | 2004 PrintF(" %s <- 0x%08" V8PRIxPTR " ; [sp + %d]\n", |
2022 converter.NameOfCPURegister(output_reg), | 2005 converter.NameOfCPURegister(output_reg), |
2023 input_value, | 2006 input_value, |
2024 *input_offset); | 2007 *input_offset); |
2025 } | 2008 } |
2026 output->SetRegister(output_reg, input_value); | 2009 output->SetRegister(output_reg, input_value); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2163 case Translation::ARGUMENTS_OBJECT: { | 2146 case Translation::ARGUMENTS_OBJECT: { |
2164 // Optimized code assumes that the argument object has not been | 2147 // Optimized code assumes that the argument object has not been |
2165 // materialized and so bypasses it when doing arguments access. | 2148 // materialized and so bypasses it when doing arguments access. |
2166 // We should have bailed out before starting the frame | 2149 // We should have bailed out before starting the frame |
2167 // translation. | 2150 // translation. |
2168 UNREACHABLE(); | 2151 UNREACHABLE(); |
2169 return false; | 2152 return false; |
2170 } | 2153 } |
2171 } | 2154 } |
2172 | 2155 |
2173 if (!duplicate) *input_offset -= kPointerSize; | 2156 *input_offset -= kPointerSize; |
2174 return true; | 2157 return true; |
2175 } | 2158 } |
2176 | 2159 |
2177 | 2160 |
2178 void Deoptimizer::PatchInterruptCode(Code* unoptimized_code, | 2161 void Deoptimizer::PatchInterruptCode(Code* unoptimized_code, |
2179 Code* interrupt_code, | 2162 Code* interrupt_code, |
2180 Code* replacement_code) { | 2163 Code* replacement_code) { |
2181 // Iterate over the back edge table and patch every interrupt | 2164 // Iterate over the back edge table and patch every interrupt |
2182 // call to an unconditional call to the replacement code. | 2165 // call to an unconditional call to the replacement code. |
2183 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 2166 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 void Translation::StoreArgumentsObject(bool args_known, | 2596 void Translation::StoreArgumentsObject(bool args_known, |
2614 int args_index, | 2597 int args_index, |
2615 int args_length) { | 2598 int args_length) { |
2616 buffer_->Add(ARGUMENTS_OBJECT, zone()); | 2599 buffer_->Add(ARGUMENTS_OBJECT, zone()); |
2617 buffer_->Add(args_known, zone()); | 2600 buffer_->Add(args_known, zone()); |
2618 buffer_->Add(args_index, zone()); | 2601 buffer_->Add(args_index, zone()); |
2619 buffer_->Add(args_length, zone()); | 2602 buffer_->Add(args_length, zone()); |
2620 } | 2603 } |
2621 | 2604 |
2622 | 2605 |
2623 void Translation::MarkDuplicate() { | |
2624 buffer_->Add(DUPLICATE, zone()); | |
2625 } | |
2626 | |
2627 | |
2628 int Translation::NumberOfOperandsFor(Opcode opcode) { | 2606 int Translation::NumberOfOperandsFor(Opcode opcode) { |
2629 switch (opcode) { | 2607 switch (opcode) { |
2630 case DUPLICATE: | |
2631 return 0; | |
2632 case GETTER_STUB_FRAME: | 2608 case GETTER_STUB_FRAME: |
2633 case SETTER_STUB_FRAME: | 2609 case SETTER_STUB_FRAME: |
2634 case REGISTER: | 2610 case REGISTER: |
2635 case INT32_REGISTER: | 2611 case INT32_REGISTER: |
2636 case UINT32_REGISTER: | 2612 case UINT32_REGISTER: |
2637 case DOUBLE_REGISTER: | 2613 case DOUBLE_REGISTER: |
2638 case STACK_SLOT: | 2614 case STACK_SLOT: |
2639 case INT32_STACK_SLOT: | 2615 case INT32_STACK_SLOT: |
2640 case UINT32_STACK_SLOT: | 2616 case UINT32_STACK_SLOT: |
2641 case DOUBLE_STACK_SLOT: | 2617 case DOUBLE_STACK_SLOT: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2686 case INT32_STACK_SLOT: | 2662 case INT32_STACK_SLOT: |
2687 return "INT32_STACK_SLOT"; | 2663 return "INT32_STACK_SLOT"; |
2688 case UINT32_STACK_SLOT: | 2664 case UINT32_STACK_SLOT: |
2689 return "UINT32_STACK_SLOT"; | 2665 return "UINT32_STACK_SLOT"; |
2690 case DOUBLE_STACK_SLOT: | 2666 case DOUBLE_STACK_SLOT: |
2691 return "DOUBLE_STACK_SLOT"; | 2667 return "DOUBLE_STACK_SLOT"; |
2692 case LITERAL: | 2668 case LITERAL: |
2693 return "LITERAL"; | 2669 return "LITERAL"; |
2694 case ARGUMENTS_OBJECT: | 2670 case ARGUMENTS_OBJECT: |
2695 return "ARGUMENTS_OBJECT"; | 2671 return "ARGUMENTS_OBJECT"; |
2696 case DUPLICATE: | |
2697 return "DUPLICATE"; | |
2698 } | 2672 } |
2699 UNREACHABLE(); | 2673 UNREACHABLE(); |
2700 return ""; | 2674 return ""; |
2701 } | 2675 } |
2702 | 2676 |
2703 #endif | 2677 #endif |
2704 | 2678 |
2705 | 2679 |
2706 DeoptimizingCodeListNode::DeoptimizingCodeListNode(Code* code): next_(NULL) { | 2680 DeoptimizingCodeListNode::DeoptimizingCodeListNode(Code* code): next_(NULL) { |
2707 GlobalHandles* global_handles = code->GetIsolate()->global_handles(); | 2681 GlobalHandles* global_handles = code->GetIsolate()->global_handles(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2739 break; | 2713 break; |
2740 | 2714 |
2741 case Translation::ARGUMENTS_OBJECT: | 2715 case Translation::ARGUMENTS_OBJECT: |
2742 // This can be only emitted for local slots not for argument slots. | 2716 // This can be only emitted for local slots not for argument slots. |
2743 break; | 2717 break; |
2744 | 2718 |
2745 case Translation::REGISTER: | 2719 case Translation::REGISTER: |
2746 case Translation::INT32_REGISTER: | 2720 case Translation::INT32_REGISTER: |
2747 case Translation::UINT32_REGISTER: | 2721 case Translation::UINT32_REGISTER: |
2748 case Translation::DOUBLE_REGISTER: | 2722 case Translation::DOUBLE_REGISTER: |
2749 case Translation::DUPLICATE: | |
2750 // We are at safepoint which corresponds to call. All registers are | 2723 // We are at safepoint which corresponds to call. All registers are |
2751 // saved by caller so there would be no live registers at this | 2724 // saved by caller so there would be no live registers at this |
2752 // point. Thus these translation commands should not be used. | 2725 // point. Thus these translation commands should not be used. |
2753 break; | 2726 break; |
2754 | 2727 |
2755 case Translation::STACK_SLOT: { | 2728 case Translation::STACK_SLOT: { |
2756 int slot_index = iterator->Next(); | 2729 int slot_index = iterator->Next(); |
2757 Address slot_addr = SlotAddress(frame, slot_index); | 2730 Address slot_addr = SlotAddress(frame, slot_index); |
2758 return SlotRef(slot_addr, SlotRef::TAGGED); | 2731 return SlotRef(slot_addr, SlotRef::TAGGED); |
2759 } | 2732 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2908 | 2881 |
2909 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 2882 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
2910 v->VisitPointer(BitCast<Object**>(&function_)); | 2883 v->VisitPointer(BitCast<Object**>(&function_)); |
2911 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 2884 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
2912 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 2885 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
2913 } | 2886 } |
2914 | 2887 |
2915 #endif // ENABLE_DEBUGGER_SUPPORT | 2888 #endif // ENABLE_DEBUGGER_SUPPORT |
2916 | 2889 |
2917 } } // namespace v8::internal | 2890 } } // namespace v8::internal |
OLD | NEW |