OLD | NEW |
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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 ? GetStackSlotCount() : arguments_index + arguments_count; | 657 ? GetStackSlotCount() : arguments_index + arguments_count; |
658 arguments_count = environment->entry()->arguments_count() + 1; | 658 arguments_count = environment->entry()->arguments_count() + 1; |
659 if (environment->entry()->arguments_pushed()) { | 659 if (environment->entry()->arguments_pushed()) { |
660 *pushed_arguments_index = arguments_index; | 660 *pushed_arguments_index = arguments_index; |
661 *pushed_arguments_count = arguments_count; | 661 *pushed_arguments_count = arguments_count; |
662 } | 662 } |
663 } | 663 } |
664 | 664 |
665 for (int i = 0; i < translation_size; ++i) { | 665 for (int i = 0; i < translation_size; ++i) { |
666 LOperand* value = environment->values()->at(i); | 666 LOperand* value = environment->values()->at(i); |
667 // spilled_registers_ and spilled_double_registers_ are either | |
668 // both NULL or both set. | |
669 if (environment->spilled_registers() != NULL && value != NULL) { | |
670 if (value->IsRegister() && | |
671 environment->spilled_registers()[value->index()] != NULL) { | |
672 translation->MarkDuplicate(); | |
673 AddToTranslation(translation, | |
674 environment->spilled_registers()[value->index()], | |
675 environment->HasTaggedValueAt(i), | |
676 environment->HasUint32ValueAt(i), | |
677 arguments_known, | |
678 arguments_index, | |
679 arguments_count); | |
680 } else if ( | |
681 value->IsDoubleRegister() && | |
682 environment->spilled_double_registers()[value->index()] != NULL) { | |
683 translation->MarkDuplicate(); | |
684 AddToTranslation( | |
685 translation, | |
686 environment->spilled_double_registers()[value->index()], | |
687 false, | |
688 false, | |
689 arguments_known, | |
690 arguments_index, | |
691 arguments_count); | |
692 } | |
693 } | |
694 | 667 |
695 AddToTranslation(translation, | 668 AddToTranslation(translation, |
696 value, | 669 value, |
697 environment->HasTaggedValueAt(i), | 670 environment->HasTaggedValueAt(i), |
698 environment->HasUint32ValueAt(i), | 671 environment->HasUint32ValueAt(i), |
699 arguments_known, | 672 arguments_known, |
700 arguments_index, | 673 arguments_index, |
701 arguments_count); | 674 arguments_count); |
702 } | 675 } |
703 } | 676 } |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 1126 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
1154 break; | 1127 break; |
1155 } | 1128 } |
1156 default: | 1129 default: |
1157 UNREACHABLE(); | 1130 UNREACHABLE(); |
1158 } | 1131 } |
1159 } | 1132 } |
1160 | 1133 |
1161 | 1134 |
1162 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 1135 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
1163 // Nothing to do. | 1136 // Record the address of the first unknown OSR value as the place to enter. |
| 1137 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
1164 } | 1138 } |
1165 | 1139 |
1166 | 1140 |
1167 void LCodeGen::DoModI(LModI* instr) { | 1141 void LCodeGen::DoModI(LModI* instr) { |
1168 HMod* hmod = instr->hydrogen(); | 1142 HMod* hmod = instr->hydrogen(); |
1169 HValue* left = hmod->left(); | 1143 HValue* left = hmod->left(); |
1170 HValue* right = hmod->right(); | 1144 HValue* right = hmod->right(); |
1171 if (hmod->HasPowerOf2Divisor()) { | 1145 if (hmod->HasPowerOf2Divisor()) { |
1172 // TODO(svenpanne) We should really do the strength reduction on the | 1146 // TODO(svenpanne) We should really do the strength reduction on the |
1173 // Hydrogen level. | 1147 // Hydrogen level. |
(...skipping 4628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5802 // the deferred code. | 5776 // the deferred code. |
5803 } | 5777 } |
5804 } | 5778 } |
5805 | 5779 |
5806 | 5780 |
5807 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 5781 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
5808 // This is a pseudo-instruction that ensures that the environment here is | 5782 // This is a pseudo-instruction that ensures that the environment here is |
5809 // properly registered for deoptimization and records the assembler's PC | 5783 // properly registered for deoptimization and records the assembler's PC |
5810 // offset. | 5784 // offset. |
5811 LEnvironment* environment = instr->environment(); | 5785 LEnvironment* environment = instr->environment(); |
5812 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | |
5813 instr->SpilledDoubleRegisterArray()); | |
5814 | 5786 |
5815 // If the environment were already registered, we would have no way of | 5787 // If the environment were already registered, we would have no way of |
5816 // backpatching it with the spill slot operands. | 5788 // backpatching it with the spill slot operands. |
5817 ASSERT(!environment->HasBeenRegistered()); | 5789 ASSERT(!environment->HasBeenRegistered()); |
5818 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 5790 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
5819 ASSERT(osr_pc_offset_ == -1); | 5791 |
5820 osr_pc_offset_ = masm()->pc_offset(); | 5792 // Normally we record the first unknown OSR value as the entrypoint to the OSR |
| 5793 // code, but if there were none, record the entrypoint here. |
| 5794 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
5821 } | 5795 } |
5822 | 5796 |
5823 | 5797 |
5824 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 5798 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
5825 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 5799 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
5826 __ cmp(r0, ip); | 5800 __ cmp(r0, ip); |
5827 DeoptimizeIf(eq, instr->environment()); | 5801 DeoptimizeIf(eq, instr->environment()); |
5828 | 5802 |
5829 Register null_value = r5; | 5803 Register null_value = r5; |
5830 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 5804 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5911 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5885 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5912 __ ldr(result, FieldMemOperand(scratch, | 5886 __ ldr(result, FieldMemOperand(scratch, |
5913 FixedArray::kHeaderSize - kPointerSize)); | 5887 FixedArray::kHeaderSize - kPointerSize)); |
5914 __ bind(&done); | 5888 __ bind(&done); |
5915 } | 5889 } |
5916 | 5890 |
5917 | 5891 |
5918 #undef __ | 5892 #undef __ |
5919 | 5893 |
5920 } } // namespace v8::internal | 5894 } } // namespace v8::internal |
OLD | NEW |