Chromium Code Reviews| 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1618 __ bind(&push_false); | 1618 __ bind(&push_false); |
| 1619 __ push(Immediate(Factory::false_value())); | 1619 __ push(Immediate(Factory::false_value())); |
| 1620 __ jmp(saved_false); | 1620 __ jmp(saved_false); |
| 1621 break; | 1621 break; |
| 1622 } | 1622 } |
| 1623 true_label_ = saved_true; | 1623 true_label_ = saved_true; |
| 1624 false_label_ = saved_false; | 1624 false_label_ = saved_false; |
| 1625 // Convert current context to test context: End post-test code. | 1625 // Convert current context to test context: End post-test code. |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 Register FastCodeGenerator::result_register() { return eax; } | |
| 1629 | 1628 |
| 1630 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 1629 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
| 1631 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1630 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1632 Move(expr->context(), eax); | 1631 Move(expr->context(), eax); |
| 1633 } | 1632 } |
| 1634 | 1633 |
| 1634 | |
| 1635 Register FastCodeGenerator::result_register() { return eax; } | |
| 1636 | |
| 1637 // ---------------------------------------------------------------------------- | |
| 1638 // Non-local control flow support. | |
| 1639 | |
| 1640 void FastCodeGenerator::EnterFinallyBlock() { | |
| 1641 // Cook return address on top of stack (smi encoded Code* delta) | |
| 1642 __ mov(edx, Operand(esp, 0)); | |
|
Kevin Millikin (Chromium)
2009/12/10 13:51:12
Assert result_register is not edx?
Lasse Reichstein
2009/12/16 08:43:30
Good idea. Done.
| |
| 1643 __ sub(Operand(edx), Immediate(masm_->CodeObject())); | |
| 1644 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | |
| 1645 ASSERT_EQ(0, kSmiTag); | |
| 1646 __ add(edx, Operand(edx)); // Convert to smi. | |
| 1647 __ mov(Operand(esp, 0), edx); | |
| 1648 // Store result register while executing finally block. | |
| 1649 __ push(eax); | |
|
Kevin Millikin (Chromium)
2009/12/10 13:51:12
__ push(result_register())
Lasse Reichstein
2009/12/16 08:43:30
Indeed. Half an abstractions is ... useless.
| |
| 1650 } | |
| 1651 | |
| 1652 | |
| 1653 void FastCodeGenerator::ReturnFromFinallyBlock() { | |
| 1654 // Restore result register from stack. | |
| 1655 __ pop(eax); | |
| 1656 // Uncook return address. | |
| 1657 __ mov(edx, Operand(esp, 0)); | |
|
Kevin Millikin (Chromium)
2009/12/10 13:51:12
Is this really better than:
__ pop(edx);
__ sar(e
Lasse Reichstein
2009/12/16 08:43:30
The CPU has a call/return stack that expects calls
| |
| 1658 __ sar(edx, 1); // Convert smi to int. | |
| 1659 __ add(Operand(edx), Immediate(masm_->CodeObject())); | |
| 1660 __ mov(Operand(esp, 0), edx); | |
| 1661 // And return. | |
| 1662 __ ret(0); | |
| 1663 } | |
| 1664 | |
| 1665 | |
| 1666 void FastCodeGenerator::ThrowException() { | |
| 1667 __ push(eax); | |
| 1668 __ CallRuntime(Runtime::kThrow, 1); | |
| 1669 } | |
| 1670 | |
| 1635 #undef __ | 1671 #undef __ |
| 1636 | 1672 |
| 1637 | |
| 1638 } } // namespace v8::internal | 1673 } } // namespace v8::internal |
| OLD | NEW |