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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 case STUB: | 596 case STUB: |
597 translation->BeginCompiledStubFrame(); | 597 translation->BeginCompiledStubFrame(); |
598 break; | 598 break; |
599 case ARGUMENTS_ADAPTOR: | 599 case ARGUMENTS_ADAPTOR: |
600 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 600 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
601 break; | 601 break; |
602 } | 602 } |
603 | 603 |
604 for (int i = 0; i < translation_size; ++i) { | 604 for (int i = 0; i < translation_size; ++i) { |
605 LOperand* value = environment->values()->at(i); | 605 LOperand* value = environment->values()->at(i); |
606 // spilled_registers_ and spilled_double_registers_ are either | |
607 // both NULL or both set. | |
608 if (environment->spilled_registers() != NULL && value != NULL) { | |
609 if (value->IsRegister() && | |
610 environment->spilled_registers()[value->index()] != NULL) { | |
611 translation->MarkDuplicate(); | |
612 AddToTranslation(translation, | |
613 environment->spilled_registers()[value->index()], | |
614 environment->HasTaggedValueAt(i), | |
615 environment->HasUint32ValueAt(i)); | |
616 } else if ( | |
617 value->IsDoubleRegister() && | |
618 environment->spilled_double_registers()[value->index()] != NULL) { | |
619 translation->MarkDuplicate(); | |
620 AddToTranslation( | |
621 translation, | |
622 environment->spilled_double_registers()[value->index()], | |
623 false, | |
624 false); | |
625 } | |
626 } | |
627 | 606 |
628 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 607 // TODO(mstarzinger): Introduce marker operands to indicate that this value |
629 // is not present and must be reconstructed from the deoptimizer. Currently | 608 // is not present and must be reconstructed from the deoptimizer. Currently |
630 // this is only used for the arguments object. | 609 // this is only used for the arguments object. |
631 if (value == NULL) { | 610 if (value == NULL) { |
632 int arguments_count = environment->values()->length() - translation_size; | 611 int arguments_count = environment->values()->length() - translation_size; |
633 translation->BeginArgumentsObject(arguments_count); | 612 translation->BeginArgumentsObject(arguments_count); |
634 for (int i = 0; i < arguments_count; ++i) { | 613 for (int i = 0; i < arguments_count; ++i) { |
635 LOperand* value = environment->values()->at(translation_size + i); | 614 LOperand* value = environment->values()->at(translation_size + i); |
636 ASSERT(environment->spilled_registers() == NULL || | |
637 !value->IsRegister() || | |
638 environment->spilled_registers()[value->index()] == NULL); | |
639 ASSERT(environment->spilled_registers() == NULL || | |
640 !value->IsDoubleRegister() || | |
641 environment->spilled_double_registers()[value->index()] == NULL); | |
642 AddToTranslation(translation, | 615 AddToTranslation(translation, |
643 value, | 616 value, |
644 environment->HasTaggedValueAt(translation_size + i), | 617 environment->HasTaggedValueAt(translation_size + i), |
645 environment->HasUint32ValueAt(translation_size + i)); | 618 environment->HasUint32ValueAt(translation_size + i)); |
646 } | 619 } |
647 continue; | 620 continue; |
648 } | 621 } |
649 | 622 |
650 AddToTranslation(translation, | 623 AddToTranslation(translation, |
651 value, | 624 value, |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 1067 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
1095 break; | 1068 break; |
1096 } | 1069 } |
1097 default: | 1070 default: |
1098 UNREACHABLE(); | 1071 UNREACHABLE(); |
1099 } | 1072 } |
1100 } | 1073 } |
1101 | 1074 |
1102 | 1075 |
1103 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 1076 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
1104 // Nothing to do. | 1077 // Record the address of the first unknown OSR value as the place to enter. |
| 1078 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
1105 } | 1079 } |
1106 | 1080 |
1107 | 1081 |
1108 void LCodeGen::DoModI(LModI* instr) { | 1082 void LCodeGen::DoModI(LModI* instr) { |
1109 HMod* hmod = instr->hydrogen(); | 1083 HMod* hmod = instr->hydrogen(); |
1110 HValue* left = hmod->left(); | 1084 HValue* left = hmod->left(); |
1111 HValue* right = hmod->right(); | 1085 HValue* right = hmod->right(); |
1112 if (hmod->HasPowerOf2Divisor()) { | 1086 if (hmod->HasPowerOf2Divisor()) { |
1113 const Register scratch = scratch0(); | 1087 const Register scratch = scratch0(); |
1114 const Register left_reg = ToRegister(instr->left()); | 1088 const Register left_reg = ToRegister(instr->left()); |
(...skipping 4694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5809 // the deferred code. | 5783 // the deferred code. |
5810 } | 5784 } |
5811 } | 5785 } |
5812 | 5786 |
5813 | 5787 |
5814 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 5788 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
5815 // This is a pseudo-instruction that ensures that the environment here is | 5789 // This is a pseudo-instruction that ensures that the environment here is |
5816 // properly registered for deoptimization and records the assembler's PC | 5790 // properly registered for deoptimization and records the assembler's PC |
5817 // offset. | 5791 // offset. |
5818 LEnvironment* environment = instr->environment(); | 5792 LEnvironment* environment = instr->environment(); |
5819 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | |
5820 instr->SpilledDoubleRegisterArray()); | |
5821 | 5793 |
5822 // If the environment were already registered, we would have no way of | 5794 // If the environment were already registered, we would have no way of |
5823 // backpatching it with the spill slot operands. | 5795 // backpatching it with the spill slot operands. |
5824 ASSERT(!environment->HasBeenRegistered()); | 5796 ASSERT(!environment->HasBeenRegistered()); |
5825 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 5797 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
5826 ASSERT(osr_pc_offset_ == -1); | 5798 |
5827 osr_pc_offset_ = masm()->pc_offset(); | 5799 // Normally we record the first unknown OSR value as the entrypoint to the OSR |
| 5800 // code, but if there were none, record the entrypoint here. |
| 5801 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
5828 } | 5802 } |
5829 | 5803 |
5830 | 5804 |
5831 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 5805 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
5832 Register result = ToRegister(instr->result()); | 5806 Register result = ToRegister(instr->result()); |
5833 Register object = ToRegister(instr->object()); | 5807 Register object = ToRegister(instr->object()); |
5834 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5808 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
5835 DeoptimizeIf(eq, instr->environment(), object, Operand(at)); | 5809 DeoptimizeIf(eq, instr->environment(), object, Operand(at)); |
5836 | 5810 |
5837 Register null_value = t1; | 5811 Register null_value = t1; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 __ Subu(scratch, result, scratch); | 5890 __ Subu(scratch, result, scratch); |
5917 __ lw(result, FieldMemOperand(scratch, | 5891 __ lw(result, FieldMemOperand(scratch, |
5918 FixedArray::kHeaderSize - kPointerSize)); | 5892 FixedArray::kHeaderSize - kPointerSize)); |
5919 __ bind(&done); | 5893 __ bind(&done); |
5920 } | 5894 } |
5921 | 5895 |
5922 | 5896 |
5923 #undef __ | 5897 #undef __ |
5924 | 5898 |
5925 } } // namespace v8::internal | 5899 } } // namespace v8::internal |
OLD | NEW |