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 4328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4339 Branch(&L, cc, rs, rt); | 4339 Branch(&L, cc, rs, rt); |
4340 Abort(reason); | 4340 Abort(reason); |
4341 // Will not return here. | 4341 // Will not return here. |
4342 bind(&L); | 4342 bind(&L); |
4343 } | 4343 } |
4344 | 4344 |
4345 | 4345 |
4346 void MacroAssembler::Abort(BailoutReason reason) { | 4346 void MacroAssembler::Abort(BailoutReason reason) { |
4347 Label abort_start; | 4347 Label abort_start; |
4348 bind(&abort_start); | 4348 bind(&abort_start); |
4349 // We want to pass the msg string like a smi to avoid GC | 4349 #ifdef DEBUG |
4350 // problems, however msg is not guaranteed to be aligned | |
4351 // properly. Instead, we pass an aligned pointer that is | |
4352 // a proper v8 smi, but also pass the alignment difference | |
4353 // from the real pointer as a smi. | |
4354 const char* msg = GetBailoutReason(reason); | 4350 const char* msg = GetBailoutReason(reason); |
4355 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | |
4356 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | |
4357 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | |
4358 #ifdef DEBUG | |
4359 if (msg != NULL) { | 4351 if (msg != NULL) { |
4360 RecordComment("Abort message: "); | 4352 RecordComment("Abort message: "); |
4361 RecordComment(msg); | 4353 RecordComment(msg); |
4362 } | 4354 } |
4363 | 4355 |
4364 if (FLAG_trap_on_abort) { | 4356 if (FLAG_trap_on_abort) { |
4365 stop(msg); | 4357 stop(msg); |
4366 return; | 4358 return; |
4367 } | 4359 } |
4368 #endif | 4360 #endif |
4369 | 4361 |
4370 li(a0, Operand(p0)); | 4362 li(a0, Operand(Smi::FromInt(reason))); |
4371 push(a0); | |
4372 li(a0, Operand(Smi::FromInt(p1 - p0))); | |
4373 push(a0); | 4363 push(a0); |
4374 // Disable stub call restrictions to always allow calls to abort. | 4364 // Disable stub call restrictions to always allow calls to abort. |
4375 if (!has_frame_) { | 4365 if (!has_frame_) { |
4376 // We don't actually want to generate a pile of code for this, so just | 4366 // We don't actually want to generate a pile of code for this, so just |
4377 // claim there is a stack frame, without generating one. | 4367 // claim there is a stack frame, without generating one. |
4378 FrameScope scope(this, StackFrame::NONE); | 4368 FrameScope scope(this, StackFrame::NONE); |
4379 CallRuntime(Runtime::kAbort, 2); | 4369 CallRuntime(Runtime::kAbort, 1); |
4380 } else { | 4370 } else { |
4381 CallRuntime(Runtime::kAbort, 2); | 4371 CallRuntime(Runtime::kAbort, 1); |
4382 } | 4372 } |
4383 // Will not return here. | 4373 // Will not return here. |
4384 if (is_trampoline_pool_blocked()) { | 4374 if (is_trampoline_pool_blocked()) { |
4385 // If the calling code cares about the exact number of | 4375 // If the calling code cares about the exact number of |
4386 // instructions generated, we insert padding here to keep the size | 4376 // instructions generated, we insert padding here to keep the size |
4387 // of the Abort macro constant. | 4377 // of the Abort macro constant. |
4388 // Currently in debug mode with debug_code enabled the number of | 4378 // Currently in debug mode with debug_code enabled the number of |
4389 // generated instructions is 14, so we use this as a maximum value. | 4379 // generated instructions is 10, so we use this as a maximum value. |
4390 static const int kExpectedAbortInstructions = 14; | 4380 static const int kExpectedAbortInstructions = 10; |
4391 int abort_instructions = InstructionsGeneratedSince(&abort_start); | 4381 int abort_instructions = InstructionsGeneratedSince(&abort_start); |
4392 ASSERT(abort_instructions <= kExpectedAbortInstructions); | 4382 ASSERT(abort_instructions <= kExpectedAbortInstructions); |
4393 while (abort_instructions++ < kExpectedAbortInstructions) { | 4383 while (abort_instructions++ < kExpectedAbortInstructions) { |
4394 nop(); | 4384 nop(); |
4395 } | 4385 } |
4396 } | 4386 } |
4397 } | 4387 } |
4398 | 4388 |
4399 | 4389 |
4400 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { | 4390 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5750 opcode == BGTZL); | 5740 opcode == BGTZL); |
5751 opcode = (cond == eq) ? BEQ : BNE; | 5741 opcode = (cond == eq) ? BEQ : BNE; |
5752 instr = (instr & ~kOpcodeMask) | opcode; | 5742 instr = (instr & ~kOpcodeMask) | opcode; |
5753 masm_.emit(instr); | 5743 masm_.emit(instr); |
5754 } | 5744 } |
5755 | 5745 |
5756 | 5746 |
5757 } } // namespace v8::internal | 5747 } } // namespace v8::internal |
5758 | 5748 |
5759 #endif // V8_TARGET_ARCH_MIPS | 5749 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |