OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 void MacroAssembler::Check(Condition cc, const char* msg) { | 1541 void MacroAssembler::Check(Condition cc, const char* msg) { |
1542 Label L; | 1542 Label L; |
1543 b(cc, &L); | 1543 b(cc, &L); |
1544 Abort(msg); | 1544 Abort(msg); |
1545 // will not return here | 1545 // will not return here |
1546 bind(&L); | 1546 bind(&L); |
1547 } | 1547 } |
1548 | 1548 |
1549 | 1549 |
1550 void MacroAssembler::Abort(const char* msg) { | 1550 void MacroAssembler::Abort(const char* msg) { |
| 1551 Label abort_start; |
| 1552 bind(&abort_start); |
1551 // We want to pass the msg string like a smi to avoid GC | 1553 // We want to pass the msg string like a smi to avoid GC |
1552 // problems, however msg is not guaranteed to be aligned | 1554 // problems, however msg is not guaranteed to be aligned |
1553 // properly. Instead, we pass an aligned pointer that is | 1555 // properly. Instead, we pass an aligned pointer that is |
1554 // a proper v8 smi, but also pass the alignment difference | 1556 // a proper v8 smi, but also pass the alignment difference |
1555 // from the real pointer as a smi. | 1557 // from the real pointer as a smi. |
1556 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 1558 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
1557 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 1559 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
1558 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 1560 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
1559 #ifdef DEBUG | 1561 #ifdef DEBUG |
1560 if (msg != NULL) { | 1562 if (msg != NULL) { |
1561 RecordComment("Abort message: "); | 1563 RecordComment("Abort message: "); |
1562 RecordComment(msg); | 1564 RecordComment(msg); |
1563 } | 1565 } |
1564 #endif | 1566 #endif |
1565 // Disable stub call restrictions to always allow calls to abort. | 1567 // Disable stub call restrictions to always allow calls to abort. |
1566 set_allow_stub_calls(true); | 1568 set_allow_stub_calls(true); |
1567 | 1569 |
1568 mov(r0, Operand(p0)); | 1570 mov(r0, Operand(p0)); |
1569 push(r0); | 1571 push(r0); |
1570 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 1572 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
1571 push(r0); | 1573 push(r0); |
1572 CallRuntime(Runtime::kAbort, 2); | 1574 CallRuntime(Runtime::kAbort, 2); |
1573 // will not return here | 1575 // will not return here |
| 1576 if (is_const_pool_blocked()) { |
| 1577 // If the calling code cares about the exact number of |
| 1578 // instructions generated, we insert padding here to keep the size |
| 1579 // of the Abort macro constant. |
| 1580 static const int kExpectedAbortInstructions = 10; |
| 1581 int abort_instructions = InstructionsGeneratedSince(&abort_start); |
| 1582 ASSERT(abort_instructions <= kExpectedAbortInstructions); |
| 1583 while (abort_instructions++ < kExpectedAbortInstructions) { |
| 1584 nop(); |
| 1585 } |
| 1586 } |
1574 } | 1587 } |
1575 | 1588 |
1576 | 1589 |
1577 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { | 1590 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
1578 if (context_chain_length > 0) { | 1591 if (context_chain_length > 0) { |
1579 // Move up the chain of contexts to the context containing the slot. | 1592 // Move up the chain of contexts to the context containing the slot. |
1580 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::CLOSURE_INDEX))); | 1593 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::CLOSURE_INDEX))); |
1581 // Load the function context (which is the incoming, outer context). | 1594 // Load the function context (which is the incoming, outer context). |
1582 ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); | 1595 ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); |
1583 for (int i = 1; i < context_chain_length; i++) { | 1596 for (int i = 1; i < context_chain_length; i++) { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 | 1836 |
1824 void CodePatcher::Emit(Address addr) { | 1837 void CodePatcher::Emit(Address addr) { |
1825 masm()->emit(reinterpret_cast<Instr>(addr)); | 1838 masm()->emit(reinterpret_cast<Instr>(addr)); |
1826 } | 1839 } |
1827 #endif // ENABLE_DEBUGGER_SUPPORT | 1840 #endif // ENABLE_DEBUGGER_SUPPORT |
1828 | 1841 |
1829 | 1842 |
1830 } } // namespace v8::internal | 1843 } } // namespace v8::internal |
1831 | 1844 |
1832 #endif // V8_TARGET_ARCH_ARM | 1845 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |