| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 
| 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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 814     environment->Register(deoptimization_index, | 814     environment->Register(deoptimization_index, | 
| 815                           translation.index(), | 815                           translation.index(), | 
| 816                           (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 816                           (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 
| 817     deoptimizations_.Add(environment, zone()); | 817     deoptimizations_.Add(environment, zone()); | 
| 818   } | 818   } | 
| 819 } | 819 } | 
| 820 | 820 | 
| 821 | 821 | 
| 822 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 822 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 
| 823                             Deoptimizer::BailoutType bailout_type, | 823                             Deoptimizer::BailoutType bailout_type, | 
| 824                             Register src1, const Operand& src2) { | 824                             Register src1, const Operand& src2, | 
|  | 825                             const char* reason) { | 
| 825   LEnvironment* environment = instr->environment(); | 826   LEnvironment* environment = instr->environment(); | 
| 826   RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 827   RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 
| 827   DCHECK(environment->HasBeenRegistered()); | 828   DCHECK(environment->HasBeenRegistered()); | 
| 828   int id = environment->deoptimization_index(); | 829   int id = environment->deoptimization_index(); | 
| 829   DCHECK(info()->IsOptimizing() || info()->IsStub()); | 830   DCHECK(info()->IsOptimizing() || info()->IsStub()); | 
| 830   Address entry = | 831   Address entry = | 
| 831       Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | 832       Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | 
| 832   if (entry == NULL) { | 833   if (entry == NULL) { | 
| 833     Abort(kBailoutWasNotPrepared); | 834     Abort(kBailoutWasNotPrepared); | 
| 834     return; | 835     return; | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 860     } | 861     } | 
| 861     __ stop("trap_on_deopt"); | 862     __ stop("trap_on_deopt"); | 
| 862     __ bind(&skip); | 863     __ bind(&skip); | 
| 863   } | 864   } | 
| 864 | 865 | 
| 865   DCHECK(info()->IsStub() || frame_is_built_); | 866   DCHECK(info()->IsStub() || frame_is_built_); | 
| 866   // Go through jump table if we need to handle condition, build frame, or | 867   // Go through jump table if we need to handle condition, build frame, or | 
| 867   // restore caller doubles. | 868   // restore caller doubles. | 
| 868   if (condition == al && frame_is_built_ && | 869   if (condition == al && frame_is_built_ && | 
| 869       !info()->saves_caller_doubles()) { | 870       !info()->saves_caller_doubles()) { | 
|  | 871     DeoptComment(instr->Mnemonic(), reason); | 
| 870     __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); | 872     __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); | 
| 871   } else { | 873   } else { | 
| 872     // We often have several deopts to the same entry, reuse the last | 874     // We often have several deopts to the same entry, reuse the last | 
| 873     // jump entry if this is the case. | 875     // jump entry if this is the case. | 
| 874     if (deopt_jump_table_.is_empty() || | 876     if (deopt_jump_table_.is_empty() || | 
| 875         (deopt_jump_table_.last().address != entry) || | 877         (deopt_jump_table_.last().address != entry) || | 
| 876         (deopt_jump_table_.last().bailout_type != bailout_type) || | 878         (deopt_jump_table_.last().bailout_type != bailout_type) || | 
| 877         (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | 879         (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | 
| 878       Deoptimizer::JumpTableEntry table_entry(entry, | 880       Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, | 
| 879                                               bailout_type, | 881                                               bailout_type, !frame_is_built_); | 
| 880                                               !frame_is_built_); |  | 
| 881       deopt_jump_table_.Add(table_entry, zone()); | 882       deopt_jump_table_.Add(table_entry, zone()); | 
| 882     } | 883     } | 
| 883     __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); | 884     __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); | 
| 884   } | 885   } | 
| 885 } | 886 } | 
| 886 | 887 | 
| 887 | 888 | 
| 888 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 889 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 
| 889                             Register src1, const Operand& src2) { | 890                             Register src1, const Operand& src2, | 
|  | 891                             const char* reason) { | 
| 890   Deoptimizer::BailoutType bailout_type = info()->IsStub() | 892   Deoptimizer::BailoutType bailout_type = info()->IsStub() | 
| 891       ? Deoptimizer::LAZY | 893       ? Deoptimizer::LAZY | 
| 892       : Deoptimizer::EAGER; | 894       : Deoptimizer::EAGER; | 
| 893   DeoptimizeIf(condition, instr, bailout_type, src1, src2); | 895   DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason); | 
| 894 } | 896 } | 
| 895 | 897 | 
| 896 | 898 | 
| 897 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 899 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 
| 898   int length = deoptimizations_.length(); | 900   int length = deoptimizations_.length(); | 
| 899   if (length == 0) return; | 901   if (length == 0) return; | 
| 900   Handle<DeoptimizationInputData> data = | 902   Handle<DeoptimizationInputData> data = | 
| 901       DeoptimizationInputData::New(isolate(), length, TENURED); | 903       DeoptimizationInputData::New(isolate(), length, TENURED); | 
| 902 | 904 | 
| 903   Handle<ByteArray> translations = | 905   Handle<ByteArray> translations = | 
| (...skipping 4765 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5669 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5671 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 
| 5670   Deoptimizer::BailoutType type = instr->hydrogen()->type(); | 5672   Deoptimizer::BailoutType type = instr->hydrogen()->type(); | 
| 5671   // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the | 5673   // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the | 
| 5672   // needed return address), even though the implementation of LAZY and EAGER is | 5674   // needed return address), even though the implementation of LAZY and EAGER is | 
| 5673   // now identical. When LAZY is eventually completely folded into EAGER, remove | 5675   // now identical. When LAZY is eventually completely folded into EAGER, remove | 
| 5674   // the special case below. | 5676   // the special case below. | 
| 5675   if (info()->IsStub() && type == Deoptimizer::EAGER) { | 5677   if (info()->IsStub() && type == Deoptimizer::EAGER) { | 
| 5676     type = Deoptimizer::LAZY; | 5678     type = Deoptimizer::LAZY; | 
| 5677   } | 5679   } | 
| 5678 | 5680 | 
| 5679   Comment(";;; deoptimize: %s", instr->hydrogen()->reason()); | 5681   DeoptimizeIf(al, instr, type, zero_reg, Operand(zero_reg), | 
| 5680   DeoptimizeIf(al, instr, type, zero_reg, Operand(zero_reg)); | 5682                instr->hydrogen()->reason()); | 
| 5681 } | 5683 } | 
| 5682 | 5684 | 
| 5683 | 5685 | 
| 5684 void LCodeGen::DoDummy(LDummy* instr) { | 5686 void LCodeGen::DoDummy(LDummy* instr) { | 
| 5685   // Nothing to see here, move on! | 5687   // Nothing to see here, move on! | 
| 5686 } | 5688 } | 
| 5687 | 5689 | 
| 5688 | 5690 | 
| 5689 void LCodeGen::DoDummyUse(LDummyUse* instr) { | 5691 void LCodeGen::DoDummyUse(LDummyUse* instr) { | 
| 5690   // Nothing to see here, move on! | 5692   // Nothing to see here, move on! | 
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5915   __ li(at, scope_info); | 5917   __ li(at, scope_info); | 
| 5916   __ Push(at, ToRegister(instr->function())); | 5918   __ Push(at, ToRegister(instr->function())); | 
| 5917   CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5919   CallRuntime(Runtime::kPushBlockContext, 2, instr); | 
| 5918   RecordSafepoint(Safepoint::kNoLazyDeopt); | 5920   RecordSafepoint(Safepoint::kNoLazyDeopt); | 
| 5919 } | 5921 } | 
| 5920 | 5922 | 
| 5921 | 5923 | 
| 5922 #undef __ | 5924 #undef __ | 
| 5923 | 5925 | 
| 5924 } }  // namespace v8::internal | 5926 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|