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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 case STUB: | 615 case STUB: |
616 translation->BeginCompiledStubFrame(); | 616 translation->BeginCompiledStubFrame(); |
617 break; | 617 break; |
618 case ARGUMENTS_ADAPTOR: | 618 case ARGUMENTS_ADAPTOR: |
619 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 619 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
620 break; | 620 break; |
621 } | 621 } |
622 | 622 |
623 for (int i = 0; i < translation_size; ++i) { | 623 for (int i = 0; i < translation_size; ++i) { |
624 LOperand* value = environment->values()->at(i); | 624 LOperand* value = environment->values()->at(i); |
625 // spilled_registers_ and spilled_double_registers_ are either | |
626 // both NULL or both set. | |
627 if (environment->spilled_registers() != NULL && value != NULL) { | |
628 if (value->IsRegister() && | |
629 environment->spilled_registers()[value->index()] != NULL) { | |
630 translation->MarkDuplicate(); | |
631 AddToTranslation(translation, | |
632 environment->spilled_registers()[value->index()], | |
633 environment->HasTaggedValueAt(i), | |
634 environment->HasUint32ValueAt(i)); | |
635 } else if ( | |
636 value->IsDoubleRegister() && | |
637 environment->spilled_double_registers()[value->index()] != NULL) { | |
638 translation->MarkDuplicate(); | |
639 AddToTranslation( | |
640 translation, | |
641 environment->spilled_double_registers()[value->index()], | |
642 false, | |
643 false); | |
644 } | |
645 } | |
646 | 625 |
647 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 626 // TODO(mstarzinger): Introduce marker operands to indicate that this value |
648 // is not present and must be reconstructed from the deoptimizer. Currently | 627 // is not present and must be reconstructed from the deoptimizer. Currently |
649 // this is only used for the arguments object. | 628 // this is only used for the arguments object. |
650 if (value == NULL) { | 629 if (value == NULL) { |
651 int arguments_count = environment->values()->length() - translation_size; | 630 int arguments_count = environment->values()->length() - translation_size; |
652 translation->BeginArgumentsObject(arguments_count); | 631 translation->BeginArgumentsObject(arguments_count); |
653 for (int i = 0; i < arguments_count; ++i) { | 632 for (int i = 0; i < arguments_count; ++i) { |
654 LOperand* value = environment->values()->at(translation_size + i); | 633 LOperand* value = environment->values()->at(translation_size + i); |
655 ASSERT(environment->spilled_registers() == NULL || | |
656 !value->IsRegister() || | |
657 environment->spilled_registers()[value->index()] == NULL); | |
658 ASSERT(environment->spilled_registers() == NULL || | |
659 !value->IsDoubleRegister() || | |
660 environment->spilled_double_registers()[value->index()] == NULL); | |
661 AddToTranslation(translation, | 634 AddToTranslation(translation, |
662 value, | 635 value, |
663 environment->HasTaggedValueAt(translation_size + i), | 636 environment->HasTaggedValueAt(translation_size + i), |
664 environment->HasUint32ValueAt(translation_size + i)); | 637 environment->HasUint32ValueAt(translation_size + i)); |
665 } | 638 } |
666 continue; | 639 continue; |
667 } | 640 } |
668 | 641 |
669 AddToTranslation(translation, | 642 AddToTranslation(translation, |
670 value, | 643 value, |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 1086 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
1114 break; | 1087 break; |
1115 } | 1088 } |
1116 default: | 1089 default: |
1117 UNREACHABLE(); | 1090 UNREACHABLE(); |
1118 } | 1091 } |
1119 } | 1092 } |
1120 | 1093 |
1121 | 1094 |
1122 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 1095 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
1123 // Nothing to do. | 1096 // Record the address of the first unknown OSR value as the place to enter. |
| 1097 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
1124 } | 1098 } |
1125 | 1099 |
1126 | 1100 |
1127 void LCodeGen::DoModI(LModI* instr) { | 1101 void LCodeGen::DoModI(LModI* instr) { |
1128 HMod* hmod = instr->hydrogen(); | 1102 HMod* hmod = instr->hydrogen(); |
1129 HValue* left = hmod->left(); | 1103 HValue* left = hmod->left(); |
1130 HValue* right = hmod->right(); | 1104 HValue* right = hmod->right(); |
1131 if (hmod->HasPowerOf2Divisor()) { | 1105 if (hmod->HasPowerOf2Divisor()) { |
1132 // TODO(svenpanne) We should really do the strength reduction on the | 1106 // TODO(svenpanne) We should really do the strength reduction on the |
1133 // Hydrogen level. | 1107 // Hydrogen level. |
(...skipping 4677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5811 // the deferred code. | 5785 // the deferred code. |
5812 } | 5786 } |
5813 } | 5787 } |
5814 | 5788 |
5815 | 5789 |
5816 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 5790 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
5817 // This is a pseudo-instruction that ensures that the environment here is | 5791 // This is a pseudo-instruction that ensures that the environment here is |
5818 // properly registered for deoptimization and records the assembler's PC | 5792 // properly registered for deoptimization and records the assembler's PC |
5819 // offset. | 5793 // offset. |
5820 LEnvironment* environment = instr->environment(); | 5794 LEnvironment* environment = instr->environment(); |
5821 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | |
5822 instr->SpilledDoubleRegisterArray()); | |
5823 | 5795 |
5824 // If the environment were already registered, we would have no way of | 5796 // If the environment were already registered, we would have no way of |
5825 // backpatching it with the spill slot operands. | 5797 // backpatching it with the spill slot operands. |
5826 ASSERT(!environment->HasBeenRegistered()); | 5798 ASSERT(!environment->HasBeenRegistered()); |
5827 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 5799 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
5828 ASSERT(osr_pc_offset_ == -1); | 5800 |
5829 osr_pc_offset_ = masm()->pc_offset(); | 5801 // Normally we record the first unknown OSR value as the entrypoint to the OSR |
| 5802 // code, but if there were none, record the entrypoint here. |
| 5803 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
5830 } | 5804 } |
5831 | 5805 |
5832 | 5806 |
5833 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 5807 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
5834 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 5808 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
5835 __ cmp(r0, ip); | 5809 __ cmp(r0, ip); |
5836 DeoptimizeIf(eq, instr->environment()); | 5810 DeoptimizeIf(eq, instr->environment()); |
5837 | 5811 |
5838 Register null_value = r5; | 5812 Register null_value = r5; |
5839 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 5813 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5920 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5894 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5921 __ ldr(result, FieldMemOperand(scratch, | 5895 __ ldr(result, FieldMemOperand(scratch, |
5922 FixedArray::kHeaderSize - kPointerSize)); | 5896 FixedArray::kHeaderSize - kPointerSize)); |
5923 __ bind(&done); | 5897 __ bind(&done); |
5924 } | 5898 } |
5925 | 5899 |
5926 | 5900 |
5927 #undef __ | 5901 #undef __ |
5928 | 5902 |
5929 } } // namespace v8::internal | 5903 } } // namespace v8::internal |
OLD | NEW |