| 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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 unoptimized->set_back_edges_patched_for_osr(false); | 1690 unoptimized->set_back_edges_patched_for_osr(false); |
| 1691 unoptimized->set_allow_osr_at_loop_nesting_level(0); | 1691 unoptimized->set_allow_osr_at_loop_nesting_level(0); |
| 1692 // Assert that none of the back edges are patched anymore. | 1692 // Assert that none of the back edges are patched anymore. |
| 1693 ASSERT(Verify(isolate, unoptimized, -1)); | 1693 ASSERT(Verify(isolate, unoptimized, -1)); |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 | 1696 |
| 1697 void BackEdgeTable::AddStackCheck(CompilationInfo* info) { | 1697 void BackEdgeTable::AddStackCheck(CompilationInfo* info) { |
| 1698 DisallowHeapAllocation no_gc; | 1698 DisallowHeapAllocation no_gc; |
| 1699 Isolate* isolate = info->isolate(); | 1699 Isolate* isolate = info->isolate(); |
| 1700 Code* code = info->shared_info()->code(); | 1700 Code* code = *info->osr_patched_code(); |
| 1701 Address pc = code->instruction_start() + info->osr_pc_offset(); | 1701 Address pc = code->instruction_start() + info->osr_pc_offset(); |
| 1702 ASSERT_EQ(info->osr_ast_id().ToInt(), |
| 1703 code->TranslatePcOffsetToAstId(info->osr_pc_offset()).ToInt()); |
| 1702 ASSERT_EQ(ON_STACK_REPLACEMENT, GetBackEdgeState(isolate, code, pc)); | 1704 ASSERT_EQ(ON_STACK_REPLACEMENT, GetBackEdgeState(isolate, code, pc)); |
| 1703 Code* patch = isolate->builtins()->builtin(Builtins::kOsrAfterStackCheck); | 1705 Code* patch = isolate->builtins()->builtin(Builtins::kOsrAfterStackCheck); |
| 1704 PatchAt(code, pc, OSR_AFTER_STACK_CHECK, patch); | 1706 PatchAt(code, pc, OSR_AFTER_STACK_CHECK, patch); |
| 1705 } | 1707 } |
| 1706 | 1708 |
| 1707 | 1709 |
| 1708 void BackEdgeTable::RemoveStackCheck(CompilationInfo* info) { | 1710 void BackEdgeTable::RemoveStackCheck(CompilationInfo* info) { |
| 1709 DisallowHeapAllocation no_gc; | 1711 DisallowHeapAllocation no_gc; |
| 1710 Isolate* isolate = info->isolate(); | 1712 Isolate* isolate = info->isolate(); |
| 1711 Code* code = info->shared_info()->code(); | 1713 Code* code = *info->osr_patched_code(); |
| 1712 Address pc = code->instruction_start() + info->osr_pc_offset(); | 1714 Address pc = code->instruction_start() + info->osr_pc_offset(); |
| 1715 ASSERT_EQ(info->osr_ast_id().ToInt(), |
| 1716 code->TranslatePcOffsetToAstId(info->osr_pc_offset()).ToInt()); |
| 1713 if (GetBackEdgeState(isolate, code, pc) == OSR_AFTER_STACK_CHECK) { | 1717 if (GetBackEdgeState(isolate, code, pc) == OSR_AFTER_STACK_CHECK) { |
| 1714 Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement); | 1718 Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement); |
| 1715 PatchAt(code, pc, ON_STACK_REPLACEMENT, patch); | 1719 PatchAt(code, pc, ON_STACK_REPLACEMENT, patch); |
| 1716 } | 1720 } |
| 1717 } | 1721 } |
| 1718 | 1722 |
| 1719 | 1723 |
| 1720 #ifdef DEBUG | 1724 #ifdef DEBUG |
| 1721 bool BackEdgeTable::Verify(Isolate* isolate, | 1725 bool BackEdgeTable::Verify(Isolate* isolate, |
| 1722 Code* unoptimized, | 1726 Code* unoptimized, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1735 } | 1739 } |
| 1736 return true; | 1740 return true; |
| 1737 } | 1741 } |
| 1738 #endif // DEBUG | 1742 #endif // DEBUG |
| 1739 | 1743 |
| 1740 | 1744 |
| 1741 #undef __ | 1745 #undef __ |
| 1742 | 1746 |
| 1743 | 1747 |
| 1744 } } // namespace v8::internal | 1748 } } // namespace v8::internal |
| OLD | NEW |