OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1653 } | 1653 } |
1654 | 1654 |
1655 // If the result was -1 it means that we couldn't optimize the | 1655 // If the result was -1 it means that we couldn't optimize the |
1656 // function. Just return and continue in the unoptimized version. | 1656 // function. Just return and continue in the unoptimized version. |
1657 Label skip; | 1657 Label skip; |
1658 __ cmp(eax, Immediate(Smi::FromInt(-1))); | 1658 __ cmp(eax, Immediate(Smi::FromInt(-1))); |
1659 __ j(not_equal, &skip, Label::kNear); | 1659 __ j(not_equal, &skip, Label::kNear); |
1660 __ ret(0); | 1660 __ ret(0); |
1661 | 1661 |
1662 // If we decide not to perform on-stack replacement we perform a | 1662 // If we decide not to perform on-stack replacement we perform a |
1663 // stack guard check to enable interrupts. | 1663 // stack guard check to enable interrupts. |
Erik Corry
2012/02/10 13:01:42
This should read "to trigger any pending interrupt
Jakob Kummerow
2012/02/10 13:59:20
Done.
| |
1664 __ bind(&stack_check); | 1664 __ bind(&stack_check); |
1665 Label ok; | 1665 Label ok; |
1666 ExternalReference stack_limit = | 1666 if (FLAG_count_based_interrupts) { |
Erik Corry
2012/02/10 13:01:42
Don't think we need this complexity.
Jakob Kummerow
2012/02/10 13:59:20
Done.
| |
1667 ExternalReference::address_of_stack_limit(masm->isolate()); | 1667 // Fetch the function's profiling counter cell from the code surrounding |
1668 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 1668 // the call site. |
1669 __ j(above_equal, &ok, Label::kNear); | 1669 __ mov(ebx, Operand(esp, 0)); // return address |
1670 StackCheckStub stub; | 1670 // These offsets are only correct if the 'weight' immediate in the |
1671 __ TailCallStub(&stub); | 1671 // 'sub' instruction fits into a single byte. |
1672 static const int kCellOffset = -12; | |
1673 static const int kWeightOffset = -8; | |
1674 if (FLAG_debug_code) { | |
1675 static const uint8_t kSubImm8Byte = 0x83; // "sub ..., <imm8>" | |
1676 __ cmpb(Operand(ebx, kCellOffset - 2), kSubImm8Byte); | |
1677 __ Assert(equal, "sub <imm8> instruction not found before cell offset"); | |
1678 STATIC_ASSERT(kCellOffset - 2 == kWeightOffset - 6); | |
1679 } | |
1680 __ movsx_b(ecx, Operand(ebx, kWeightOffset)); | |
1681 __ mov(ebx, Operand(ebx, kCellOffset)); | |
1682 __ sub(Operand(ebx, 0), ecx); | |
1683 __ j(positive, &ok, Label::kNear); | |
1684 InterruptStub stub; | |
1685 __ TailCallStub(&stub); | |
1686 } else { | |
1687 ExternalReference stack_limit = | |
1688 ExternalReference::address_of_stack_limit(masm->isolate()); | |
1689 __ cmp(esp, Operand::StaticVariable(stack_limit)); | |
1690 __ j(above_equal, &ok, Label::kNear); | |
1691 StackCheckStub stub; | |
1692 __ TailCallStub(&stub); | |
1693 } | |
1672 if (FLAG_debug_code) { | 1694 if (FLAG_debug_code) { |
1673 __ Abort("Unreachable code: returned from tail call."); | 1695 __ Abort("Unreachable code: returned from tail call."); |
1674 } | 1696 } |
1675 __ bind(&ok); | 1697 __ bind(&ok); |
1676 __ ret(0); | 1698 __ ret(0); |
1677 | 1699 |
1678 __ bind(&skip); | 1700 __ bind(&skip); |
1679 // Untag the AST id and push it on the stack. | 1701 // Untag the AST id and push it on the stack. |
1680 __ SmiUntag(eax); | 1702 __ SmiUntag(eax); |
1681 __ push(eax); | 1703 __ push(eax); |
1682 | 1704 |
1683 // Generate the code for doing the frame-to-frame translation using | 1705 // Generate the code for doing the frame-to-frame translation using |
1684 // the deoptimizer infrastructure. | 1706 // the deoptimizer infrastructure. |
1685 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1707 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1686 generator.Generate(); | 1708 generator.Generate(); |
1687 } | 1709 } |
1688 | 1710 |
1689 | 1711 |
1690 #undef __ | 1712 #undef __ |
1691 } | 1713 } |
1692 } // namespace v8::internal | 1714 } // namespace v8::internal |
1693 | 1715 |
1694 #endif // V8_TARGET_ARCH_IA32 | 1716 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |