| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 int deoptimization_index = deoptimizations_.length(); | 706 int deoptimization_index = deoptimizations_.length(); |
| 707 int pc_offset = masm()->pc_offset(); | 707 int pc_offset = masm()->pc_offset(); |
| 708 environment->Register(deoptimization_index, | 708 environment->Register(deoptimization_index, |
| 709 translation.index(), | 709 translation.index(), |
| 710 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 710 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); |
| 711 deoptimizations_.Add(environment, environment->zone()); | 711 deoptimizations_.Add(environment, environment->zone()); |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 | 714 |
| 715 | 715 |
| 716 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) { | 716 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment, |
| 717 bool soft_deopt) { |
| 717 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 718 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 718 ASSERT(environment->HasBeenRegistered()); | 719 ASSERT(environment->HasBeenRegistered()); |
| 719 int id = environment->deoptimization_index(); | 720 int id = environment->deoptimization_index(); |
| 720 ASSERT(info()->IsOptimizing() || info()->IsStub()); | 721 ASSERT(info()->IsOptimizing() || info()->IsStub()); |
| 721 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 722 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
| 722 ? Deoptimizer::LAZY | 723 ? Deoptimizer::LAZY |
| 723 : Deoptimizer::EAGER; | 724 : Deoptimizer::EAGER; |
| 724 Address entry = | 725 Address entry = |
| 725 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | 726 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); |
| 726 if (entry == NULL) { | 727 if (entry == NULL) { |
| 727 Abort("bailout was not prepared"); | 728 Abort("bailout was not prepared"); |
| 728 return; | 729 return; |
| 729 } | 730 } |
| 730 | 731 |
| 732 if (soft_deopt) { |
| 733 // It's better soft deopt does not waste the opt count |
| 734 Handle<SharedFunctionInfo> shared(info()->shared_info()); |
| 735 __ pushfq(); |
| 736 __ push(rax); |
| 737 __ push(rbx); |
| 738 __ movq(rbx, shared, RelocInfo::EMBEDDED_OBJECT); |
| 739 __ movq(rax, |
| 740 FieldOperand(rbx, SharedFunctionInfo::kOptCountOffset)); |
| 741 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); |
| 742 __ movq(FieldOperand(rbx, SharedFunctionInfo::kOptCountOffset), |
| 743 rax); |
| 744 __ pop(rbx); |
| 745 __ pop(rax); |
| 746 __ popfq(); |
| 747 } |
| 748 |
| 731 ASSERT(FLAG_deopt_every_n_times == 0); // Not yet implemented on x64. | 749 ASSERT(FLAG_deopt_every_n_times == 0); // Not yet implemented on x64. |
| 732 | 750 |
| 733 if (FLAG_trap_on_deopt) { | 751 if (FLAG_trap_on_deopt) { |
| 734 Label done; | 752 Label done; |
| 735 if (cc != no_condition) { | 753 if (cc != no_condition) { |
| 736 __ j(NegateCondition(cc), &done, Label::kNear); | 754 __ j(NegateCondition(cc), &done, Label::kNear); |
| 737 } | 755 } |
| 738 __ int3(); | 756 __ int3(); |
| 739 __ bind(&done); | 757 __ bind(&done); |
| 740 } | 758 } |
| (...skipping 4747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5488 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5506 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| 5489 last_lazy_deopt_pc_ = masm()->pc_offset(); | 5507 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 5490 ASSERT(instr->HasEnvironment()); | 5508 ASSERT(instr->HasEnvironment()); |
| 5491 LEnvironment* env = instr->environment(); | 5509 LEnvironment* env = instr->environment(); |
| 5492 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5510 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 5493 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5511 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5494 } | 5512 } |
| 5495 | 5513 |
| 5496 | 5514 |
| 5497 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5515 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
| 5498 DeoptimizeIf(no_condition, instr->environment()); | 5516 DeoptimizeIf(no_condition, instr->environment(), instr->is_soft_deopt()); |
| 5499 } | 5517 } |
| 5500 | 5518 |
| 5501 | 5519 |
| 5502 void LCodeGen::DoDummyUse(LDummyUse* instr) { | 5520 void LCodeGen::DoDummyUse(LDummyUse* instr) { |
| 5503 // Nothing to see here, move on! | 5521 // Nothing to see here, move on! |
| 5504 } | 5522 } |
| 5505 | 5523 |
| 5506 | 5524 |
| 5507 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { | 5525 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
| 5508 LOperand* obj = instr->object(); | 5526 LOperand* obj = instr->object(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5697 FixedArray::kHeaderSize - kPointerSize)); | 5715 FixedArray::kHeaderSize - kPointerSize)); |
| 5698 __ bind(&done); | 5716 __ bind(&done); |
| 5699 } | 5717 } |
| 5700 | 5718 |
| 5701 | 5719 |
| 5702 #undef __ | 5720 #undef __ |
| 5703 | 5721 |
| 5704 } } // namespace v8::internal | 5722 } } // namespace v8::internal |
| 5705 | 5723 |
| 5706 #endif // V8_TARGET_ARCH_X64 | 5724 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |