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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 ASSERT(environment->HasBeenRegistered()); | 762 ASSERT(environment->HasBeenRegistered()); |
763 int id = environment->deoptimization_index(); | 763 int id = environment->deoptimization_index(); |
764 ASSERT(info()->IsOptimizing() || info()->IsStub()); | 764 ASSERT(info()->IsOptimizing() || info()->IsStub()); |
765 Address entry = | 765 Address entry = |
766 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | 766 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); |
767 if (entry == NULL) { | 767 if (entry == NULL) { |
768 Abort(kBailoutWasNotPrepared); | 768 Abort(kBailoutWasNotPrepared); |
769 return; | 769 return; |
770 } | 770 } |
771 | 771 |
772 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. | 772 if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) { |
773 if (FLAG_deopt_every_n_times == 1 && | 773 Register scratch = scratch0(); |
774 !info()->IsStub() && | 774 ExternalReference count = ExternalReference::stress_deopt_count(isolate()); |
775 info()->opt_count() == id) { | 775 |
776 ASSERT(frame_is_built_); | 776 // Store the condition on the stack if necessary |
777 __ Call(entry, RelocInfo::RUNTIME_ENTRY); | 777 if (condition != al) { |
778 return; | 778 __ mov(scratch, Operand::Zero(), LeaveCC, NegateCondition(condition)); |
| 779 __ mov(scratch, Operand(1), LeaveCC, condition); |
| 780 __ push(scratch); |
| 781 } |
| 782 |
| 783 __ push(r1); |
| 784 __ mov(scratch, Operand(count)); |
| 785 __ ldr(r1, MemOperand(scratch)); |
| 786 __ sub(r1, r1, Operand(1), SetCC); |
| 787 __ movw(r1, FLAG_deopt_every_n_times, eq); |
| 788 __ str(r1, MemOperand(scratch)); |
| 789 __ pop(r1); |
| 790 |
| 791 if (condition != al) { |
| 792 // Clean up the stack before the deoptimizer call |
| 793 __ pop(scratch); |
| 794 } |
| 795 |
| 796 __ Call(entry, RelocInfo::RUNTIME_ENTRY, eq); |
| 797 |
| 798 // 'Restore' the condition in a slightly hacky way. (It would be better |
| 799 // to use 'msr' and 'mrs' instructions here, but they are not supported by |
| 800 // our ARM simulator). |
| 801 if (condition != al) { |
| 802 condition = ne; |
| 803 __ cmp(scratch, Operand::Zero()); |
| 804 } |
779 } | 805 } |
780 | 806 |
781 if (info()->ShouldTrapOnDeopt()) { | 807 if (info()->ShouldTrapOnDeopt()) { |
782 __ stop("trap_on_deopt", condition); | 808 __ stop("trap_on_deopt", condition); |
783 } | 809 } |
784 | 810 |
785 ASSERT(info()->IsStub() || frame_is_built_); | 811 ASSERT(info()->IsStub() || frame_is_built_); |
786 if (condition == al && frame_is_built_) { | 812 if (condition == al && frame_is_built_) { |
787 __ Call(entry, RelocInfo::RUNTIME_ENTRY); | 813 __ Call(entry, RelocInfo::RUNTIME_ENTRY); |
788 } else { | 814 } else { |
(...skipping 5047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5836 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5862 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5837 __ ldr(result, FieldMemOperand(scratch, | 5863 __ ldr(result, FieldMemOperand(scratch, |
5838 FixedArray::kHeaderSize - kPointerSize)); | 5864 FixedArray::kHeaderSize - kPointerSize)); |
5839 __ bind(&done); | 5865 __ bind(&done); |
5840 } | 5866 } |
5841 | 5867 |
5842 | 5868 |
5843 #undef __ | 5869 #undef __ |
5844 | 5870 |
5845 } } // namespace v8::internal | 5871 } } // namespace v8::internal |
OLD | NEW |