Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: src/x64/fast-codegen-x64.cc

Issue 492002: Fast-codegen: Implementing try/finally on top of nesting context. (Closed)
Patch Set: Updated to be based on latest release. Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 1631
1632 1632
1633 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { 1633 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
1634 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1634 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1635 Move(expr->context(), rax); 1635 Move(expr->context(), rax);
1636 } 1636 }
1637 1637
1638 1638
1639 Register FastCodeGenerator::result_register() { return rax; } 1639 Register FastCodeGenerator::result_register() { return rax; }
1640 1640
1641 // ----------------------------------------------------------------------------
1642 // Non-local control flow support.
1643
1644
1645 void FastCodeGenerator::EnterFinallyBlock() {
1646 // Cook return address on top of stack (smi encoded Code* delta)
1647 __ movq(rdx, Operand(rsp, 0));
1648 __ Move(rcx, masm_->CodeObject());
1649 __ subq(rdx, rcx);
1650 __ Integer32ToSmi(rdx, rdx);
1651 __ movq(Operand(rsp, 0), rdx);
1652 // Store result register while executing finally block.
1653 __ push(rax);
1654 }
1655
1656
1657 void FastCodeGenerator::ReturnFromFinallyBlock() {
1658 // Restore result register from stack.
1659 __ pop(rax);
1660 // Uncook return address.
1661 __ movq(rdx, Operand(rsp, 0));
1662 __ SmiToInteger32(rdx, rdx);
1663 __ Move(rcx, masm_->CodeObject());
1664 __ addq(rdx, rcx);
1665 __ movq(Operand(rsp, 0), rdx);
1666 // And return.
1667 __ ret(0);
1668 }
1669
1670
1671 void FastCodeGenerator::ThrowException() {
1672 __ push(rax);
1673 __ CallRuntime(Runtime::kThrow, 1);
1674 }
1675
1641 #undef __ 1676 #undef __
1642 1677
1643 1678
1644 } } // namespace v8::internal 1679 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698