OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 | 1683 |
1684 | 1684 |
1685 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 1685 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
1686 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1686 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1687 Move(expr->context(), r0); | 1687 Move(expr->context(), r0); |
1688 } | 1688 } |
1689 | 1689 |
1690 | 1690 |
1691 Register FastCodeGenerator::result_register() { return r0; } | 1691 Register FastCodeGenerator::result_register() { return r0; } |
1692 | 1692 |
| 1693 |
| 1694 Register FastCodeGenerator::context_register() { return cp; } |
| 1695 |
| 1696 |
| 1697 void FastCodeGenerator::StoreFrameField(int frame_offset, Register value) { |
| 1698 ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); |
| 1699 __ str(value, MemOperand(fp, frame_offset)); |
| 1700 } |
| 1701 |
| 1702 |
| 1703 void FastCodeGenerator::LoadContextField(Register dst, int context_index) { |
| 1704 __ ldr(dst, |
| 1705 MemOperand(context_register(), Context::SlotOffset(context_index))); |
| 1706 } |
| 1707 |
| 1708 |
1693 // ---------------------------------------------------------------------------- | 1709 // ---------------------------------------------------------------------------- |
1694 // Non-local control flow support. | 1710 // Non-local control flow support. |
1695 | 1711 |
1696 void FastCodeGenerator::EnterFinallyBlock() { | 1712 void FastCodeGenerator::EnterFinallyBlock() { |
1697 ASSERT(!result_register().is(r1)); | 1713 ASSERT(!result_register().is(r1)); |
| 1714 // Store result register while executing finally block. |
| 1715 __ push(result_register()); |
1698 // Cook return address in link register to stack (smi encoded Code* delta) | 1716 // Cook return address in link register to stack (smi encoded Code* delta) |
1699 __ sub(r1, lr, Operand(masm_->CodeObject())); | 1717 __ sub(r1, lr, Operand(masm_->CodeObject())); |
1700 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1718 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
1701 ASSERT_EQ(0, kSmiTag); | 1719 ASSERT_EQ(0, kSmiTag); |
1702 __ add(r1, r1, Operand(r1)); // Convert to smi. | 1720 __ add(r1, r1, Operand(r1)); // Convert to smi. |
1703 __ push(r1); | 1721 __ push(r1); |
1704 // Store result register while executing finally block. | |
1705 __ push(result_register()); | |
1706 } | 1722 } |
1707 | 1723 |
1708 | 1724 |
1709 void FastCodeGenerator::ExitFinallyBlock() { | 1725 void FastCodeGenerator::ExitFinallyBlock() { |
1710 ASSERT(!result_register().is(r1)); | 1726 ASSERT(!result_register().is(r1)); |
1711 // Restore result register from stack. | 1727 // Restore result register from stack. |
| 1728 __ pop(r1); |
| 1729 // Uncook return address and return. |
1712 __ pop(result_register()); | 1730 __ pop(result_register()); |
1713 // Uncook return address and return. | |
1714 __ pop(r1); | |
1715 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1731 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
1716 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1732 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
1717 __ add(pc, r1, Operand(masm_->CodeObject())); | 1733 __ add(pc, r1, Operand(masm_->CodeObject())); |
1718 } | 1734 } |
1719 | 1735 |
1720 | 1736 |
1721 void FastCodeGenerator::ThrowException() { | 1737 void FastCodeGenerator::ThrowException() { |
1722 __ push(result_register()); | 1738 __ push(result_register()); |
1723 __ CallRuntime(Runtime::kThrow, 1); | 1739 __ CallRuntime(Runtime::kThrow, 1); |
1724 } | 1740 } |
1725 | 1741 |
1726 | 1742 |
1727 #undef __ | 1743 #undef __ |
1728 | 1744 |
1729 } } // namespace v8::internal | 1745 } } // namespace v8::internal |
OLD | NEW |