OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 PatchAt(unoptimized, back_edges.pc(i), INTERRUPT, patch); | 1776 PatchAt(unoptimized, back_edges.pc(i), INTERRUPT, patch); |
1777 } | 1777 } |
1778 } | 1778 } |
1779 | 1779 |
1780 unoptimized->set_allow_osr_at_loop_nesting_level(0); | 1780 unoptimized->set_allow_osr_at_loop_nesting_level(0); |
1781 // Assert that none of the back edges are patched anymore. | 1781 // Assert that none of the back edges are patched anymore. |
1782 DCHECK(Verify(isolate, unoptimized)); | 1782 DCHECK(Verify(isolate, unoptimized)); |
1783 } | 1783 } |
1784 | 1784 |
1785 | 1785 |
1786 void BackEdgeTable::AddStackCheck(Handle<Code> code, uint32_t pc_offset) { | |
1787 DisallowHeapAllocation no_gc; | |
1788 Isolate* isolate = code->GetIsolate(); | |
1789 Address pc = code->instruction_start() + pc_offset; | |
1790 Code* patch = isolate->builtins()->builtin(Builtins::kOsrAfterStackCheck); | |
1791 PatchAt(*code, pc, OSR_AFTER_STACK_CHECK, patch); | |
1792 } | |
1793 | |
1794 | |
1795 void BackEdgeTable::RemoveStackCheck(Handle<Code> code, uint32_t pc_offset) { | |
1796 DisallowHeapAllocation no_gc; | |
1797 Isolate* isolate = code->GetIsolate(); | |
1798 Address pc = code->instruction_start() + pc_offset; | |
1799 | |
1800 if (OSR_AFTER_STACK_CHECK == GetBackEdgeState(isolate, *code, pc)) { | |
1801 Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement); | |
1802 PatchAt(*code, pc, ON_STACK_REPLACEMENT, patch); | |
1803 } | |
1804 } | |
1805 | |
1806 | |
1807 #ifdef DEBUG | 1786 #ifdef DEBUG |
1808 bool BackEdgeTable::Verify(Isolate* isolate, Code* unoptimized) { | 1787 bool BackEdgeTable::Verify(Isolate* isolate, Code* unoptimized) { |
1809 DisallowHeapAllocation no_gc; | 1788 DisallowHeapAllocation no_gc; |
1810 int loop_nesting_level = unoptimized->allow_osr_at_loop_nesting_level(); | 1789 int loop_nesting_level = unoptimized->allow_osr_at_loop_nesting_level(); |
1811 BackEdgeTable back_edges(unoptimized, &no_gc); | 1790 BackEdgeTable back_edges(unoptimized, &no_gc); |
1812 for (uint32_t i = 0; i < back_edges.length(); i++) { | 1791 for (uint32_t i = 0; i < back_edges.length(); i++) { |
1813 uint32_t loop_depth = back_edges.loop_depth(i); | 1792 uint32_t loop_depth = back_edges.loop_depth(i); |
1814 CHECK_LE(static_cast<int>(loop_depth), Code::kMaxLoopNestingMarker); | 1793 CHECK_LE(static_cast<int>(loop_depth), Code::kMaxLoopNestingMarker); |
1815 // Assert that all back edges for shallower loops (and only those) | 1794 // Assert that all back edges for shallower loops (and only those) |
1816 // have already been patched. | 1795 // have already been patched. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1908 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1930 var->initializer_position() >= proxy->position(); | 1909 var->initializer_position() >= proxy->position(); |
1931 } | 1910 } |
1932 | 1911 |
1933 | 1912 |
1934 #undef __ | 1913 #undef __ |
1935 | 1914 |
1936 | 1915 |
1937 } // namespace internal | 1916 } // namespace internal |
1938 } // namespace v8 | 1917 } // namespace v8 |
OLD | NEW |