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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 6538019: Porting of revisions 6639, 6794 and 6805 to the 3.0 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.0
Patch Set: Created 9 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/simulator-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 void MacroAssembler::PopTryHandler() { 1527 void MacroAssembler::PopTryHandler() {
1528 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); 1528 ASSERT_EQ(0, StackHandlerConstants::kNextOffset);
1529 // Unlink this handler. 1529 // Unlink this handler.
1530 movq(kScratchRegister, ExternalReference(Top::k_handler_address)); 1530 movq(kScratchRegister, ExternalReference(Top::k_handler_address));
1531 pop(Operand(kScratchRegister, 0)); 1531 pop(Operand(kScratchRegister, 0));
1532 // Remove the remaining fields. 1532 // Remove the remaining fields.
1533 addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); 1533 addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize));
1534 } 1534 }
1535 1535
1536 1536
1537 void MacroAssembler::Throw(Register value) {
1538 // Check that stack should contain next handler, frame pointer, state and
1539 // return address in that order.
1540 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize ==
1541 StackHandlerConstants::kStateOffset);
1542 STATIC_ASSERT(StackHandlerConstants::kStateOffset + kPointerSize ==
1543 StackHandlerConstants::kPCOffset);
1544 // Keep thrown value in rax.
1545 if (!value.is(rax)) {
1546 movq(rax, value);
1547 }
1548
1549 ExternalReference handler_address(Top::k_handler_address);
1550 movq(kScratchRegister, handler_address);
1551 movq(rsp, Operand(kScratchRegister, 0));
1552 // get next in chain
1553 pop(rcx);
1554 movq(Operand(kScratchRegister, 0), rcx);
1555 pop(rbp); // pop frame pointer
1556 pop(rdx); // remove state
1557
1558 // Before returning we restore the context from the frame pointer if not NULL.
1559 // The frame pointer is NULL in the exception handler of a JS entry frame.
1560 Set(rsi, 0); // Tentatively set context pointer to NULL
1561 NearLabel skip;
1562 cmpq(rbp, Immediate(0));
1563 j(equal, &skip);
1564 movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1565 bind(&skip);
1566 ret(0);
1567 }
1568
1569
1570 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
1571 Register value) {
1572 // Keep thrown value in rax.
1573 if (!value.is(rax)) {
1574 movq(rax, value);
1575 }
1576 // Fetch top stack handler.
1577 ExternalReference handler_address(Top::k_handler_address);
1578 movq(kScratchRegister, handler_address);
1579 movq(rsp, Operand(kScratchRegister, 0));
1580
1581 // Unwind the handlers until the ENTRY handler is found.
1582 NearLabel loop, done;
1583 bind(&loop);
1584 // Load the type of the current stack handler.
1585 const int kStateOffset = StackHandlerConstants::kStateOffset;
1586 cmpq(Operand(rsp, kStateOffset), Immediate(StackHandler::ENTRY));
1587 j(equal, &done);
1588 // Fetch the next handler in the list.
1589 const int kNextOffset = StackHandlerConstants::kNextOffset;
1590 movq(rsp, Operand(rsp, kNextOffset));
1591 jmp(&loop);
1592 bind(&done);
1593
1594 // Set the top handler address to next handler past the current ENTRY handler.
1595 movq(kScratchRegister, handler_address);
1596 pop(Operand(kScratchRegister, 0));
1597
1598 if (type == OUT_OF_MEMORY) {
1599 // Set external caught exception to false.
1600 ExternalReference external_caught(Top::k_external_caught_exception_address);
1601 movq(rax, Immediate(false));
1602 store_rax(external_caught);
1603
1604 // Set pending exception and rax to out of memory exception.
1605 ExternalReference pending_exception(Top::k_pending_exception_address);
1606 movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE);
1607 store_rax(pending_exception);
1608 }
1609
1610 // Clear the context pointer.
1611 Set(rsi, 0);
1612
1613 // Restore registers from handler.
1614 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize ==
1615 StackHandlerConstants::kFPOffset);
1616 pop(rbp); // FP
1617 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize ==
1618 StackHandlerConstants::kStateOffset);
1619 pop(rdx); // State
1620
1621 STATIC_ASSERT(StackHandlerConstants::kStateOffset + kPointerSize ==
1622 StackHandlerConstants::kPCOffset);
1623 ret(0);
1624 }
1625
1626
1537 void MacroAssembler::Ret() { 1627 void MacroAssembler::Ret() {
1538 ret(0); 1628 ret(0);
1539 } 1629 }
1540 1630
1541 1631
1542 void MacroAssembler::Ret(int bytes_dropped, Register scratch) { 1632 void MacroAssembler::Ret(int bytes_dropped, Register scratch) {
1543 if (is_uint16(bytes_dropped)) { 1633 if (is_uint16(bytes_dropped)) {
1544 ret(bytes_dropped); 1634 ret(bytes_dropped);
1545 } else { 1635 } else {
1546 pop(scratch); 1636 pop(scratch);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 CPU::FlushICache(address_, size_); 2578 CPU::FlushICache(address_, size_);
2489 2579
2490 // Check that the code was patched as expected. 2580 // Check that the code was patched as expected.
2491 ASSERT(masm_.pc_ == address_ + size_); 2581 ASSERT(masm_.pc_ == address_ + size_);
2492 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2582 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2493 } 2583 }
2494 2584
2495 } } // namespace v8::internal 2585 } } // namespace v8::internal
2496 2586
2497 #endif // V8_TARGET_ARCH_X64 2587 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/simulator-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698