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 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2799 b(cond, &L); | 2799 b(cond, &L); |
2800 Abort(reason); | 2800 Abort(reason); |
2801 // will not return here | 2801 // will not return here |
2802 bind(&L); | 2802 bind(&L); |
2803 } | 2803 } |
2804 | 2804 |
2805 | 2805 |
2806 void MacroAssembler::Abort(BailoutReason reason) { | 2806 void MacroAssembler::Abort(BailoutReason reason) { |
2807 Label abort_start; | 2807 Label abort_start; |
2808 bind(&abort_start); | 2808 bind(&abort_start); |
2809 // We want to pass the msg string like a smi to avoid GC | 2809 #ifdef DEBUG |
2810 // problems, however msg is not guaranteed to be aligned | |
2811 // properly. Instead, we pass an aligned pointer that is | |
2812 // a proper v8 smi, but also pass the alignment difference | |
2813 // from the real pointer as a smi. | |
2814 const char* msg = GetBailoutReason(reason); | 2810 const char* msg = GetBailoutReason(reason); |
2815 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | |
2816 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | |
2817 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | |
2818 #ifdef DEBUG | |
2819 if (msg != NULL) { | 2811 if (msg != NULL) { |
2820 RecordComment("Abort message: "); | 2812 RecordComment("Abort message: "); |
2821 RecordComment(msg); | 2813 RecordComment(msg); |
2822 } | 2814 } |
2823 | 2815 |
2824 if (FLAG_trap_on_abort) { | 2816 if (FLAG_trap_on_abort) { |
2825 stop(msg); | 2817 stop(msg); |
2826 return; | 2818 return; |
2827 } | 2819 } |
2828 #endif | 2820 #endif |
2829 | 2821 |
2830 mov(r0, Operand(p0)); | 2822 mov(r0, Operand(Smi::FromInt(reason))); |
2831 push(r0); | 2823 push(r0); |
2832 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 2824 |
2833 push(r0); | |
2834 // Disable stub call restrictions to always allow calls to abort. | 2825 // Disable stub call restrictions to always allow calls to abort. |
2835 if (!has_frame_) { | 2826 if (!has_frame_) { |
2836 // We don't actually want to generate a pile of code for this, so just | 2827 // We don't actually want to generate a pile of code for this, so just |
2837 // claim there is a stack frame, without generating one. | 2828 // claim there is a stack frame, without generating one. |
2838 FrameScope scope(this, StackFrame::NONE); | 2829 FrameScope scope(this, StackFrame::NONE); |
2839 CallRuntime(Runtime::kAbort, 2); | 2830 CallRuntime(Runtime::kAbort, 1); |
2840 } else { | 2831 } else { |
2841 CallRuntime(Runtime::kAbort, 2); | 2832 CallRuntime(Runtime::kAbort, 1); |
2842 } | 2833 } |
2843 // will not return here | 2834 // will not return here |
2844 if (is_const_pool_blocked()) { | 2835 if (is_const_pool_blocked()) { |
2845 // If the calling code cares about the exact number of | 2836 // If the calling code cares about the exact number of |
2846 // instructions generated, we insert padding here to keep the size | 2837 // instructions generated, we insert padding here to keep the size |
2847 // of the Abort macro constant. | 2838 // of the Abort macro constant. |
2848 static const int kExpectedAbortInstructions = 10; | 2839 static const int kExpectedAbortInstructions = 7; |
2849 int abort_instructions = InstructionsGeneratedSince(&abort_start); | 2840 int abort_instructions = InstructionsGeneratedSince(&abort_start); |
2850 ASSERT(abort_instructions <= kExpectedAbortInstructions); | 2841 ASSERT(abort_instructions <= kExpectedAbortInstructions); |
2851 while (abort_instructions++ < kExpectedAbortInstructions) { | 2842 while (abort_instructions++ < kExpectedAbortInstructions) { |
2852 nop(); | 2843 nop(); |
2853 } | 2844 } |
2854 } | 2845 } |
2855 } | 2846 } |
2856 | 2847 |
2857 | 2848 |
2858 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { | 2849 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4075 void CodePatcher::EmitCondition(Condition cond) { | 4066 void CodePatcher::EmitCondition(Condition cond) { |
4076 Instr instr = Assembler::instr_at(masm_.pc_); | 4067 Instr instr = Assembler::instr_at(masm_.pc_); |
4077 instr = (instr & ~kCondMask) | cond; | 4068 instr = (instr & ~kCondMask) | cond; |
4078 masm_.emit(instr); | 4069 masm_.emit(instr); |
4079 } | 4070 } |
4080 | 4071 |
4081 | 4072 |
4082 } } // namespace v8::internal | 4073 } } // namespace v8::internal |
4083 | 4074 |
4084 #endif // V8_TARGET_ARCH_ARM | 4075 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |