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

Side by Side Diff: src/full-codegen/full-codegen.cc

Issue 2172583002: [interpreter] Add OSR nesting level to bytecode header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO. Created 4 years, 4 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
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap/heap.cc » ('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 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-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 #endif 217 #endif
218 BailoutEntry entry = { id, pc_and_state }; 218 BailoutEntry entry = { id, pc_and_state };
219 bailout_entries_.Add(entry, zone()); 219 bailout_entries_.Add(entry, zone());
220 } 220 }
221 221
222 222
223 void FullCodeGenerator::RecordBackEdge(BailoutId ast_id) { 223 void FullCodeGenerator::RecordBackEdge(BailoutId ast_id) {
224 // The pc offset does not need to be encoded and packed together with a state. 224 // The pc offset does not need to be encoded and packed together with a state.
225 DCHECK(masm_->pc_offset() > 0); 225 DCHECK(masm_->pc_offset() > 0);
226 DCHECK(loop_depth() > 0); 226 DCHECK(loop_depth() > 0);
227 uint8_t depth = Min(loop_depth(), Code::kMaxLoopNestingMarker); 227 uint8_t depth = Min(loop_depth(), AbstractCode::kMaxLoopNestingMarker);
228 BackEdgeEntry entry = 228 BackEdgeEntry entry =
229 { ast_id, static_cast<unsigned>(masm_->pc_offset()), depth }; 229 { ast_id, static_cast<unsigned>(masm_->pc_offset()), depth };
230 back_edges_.Add(entry, zone()); 230 back_edges_.Add(entry, zone());
231 } 231 }
232 232
233 233
234 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { 234 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) {
235 // Inline smi case inside loops, but not division and modulo which 235 // Inline smi case inside loops, but not division and modulo which
236 // are too complicated and take up too much space. 236 // are too complicated and take up too much space.
237 if (op == Token::DIV ||op == Token::MOD) return false; 237 if (op == Token::DIV ||op == Token::MOD) return false;
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 1764
1765 1765
1766 void BackEdgeTable::Patch(Isolate* isolate, Code* unoptimized) { 1766 void BackEdgeTable::Patch(Isolate* isolate, Code* unoptimized) {
1767 DisallowHeapAllocation no_gc; 1767 DisallowHeapAllocation no_gc;
1768 Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement); 1768 Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement);
1769 1769
1770 // Increment loop nesting level by one and iterate over the back edge table 1770 // Increment loop nesting level by one and iterate over the back edge table
1771 // to find the matching loops to patch the interrupt 1771 // to find the matching loops to patch the interrupt
1772 // call to an unconditional call to the replacement code. 1772 // call to an unconditional call to the replacement code.
1773 int loop_nesting_level = unoptimized->allow_osr_at_loop_nesting_level() + 1; 1773 int loop_nesting_level = unoptimized->allow_osr_at_loop_nesting_level() + 1;
1774 if (loop_nesting_level > Code::kMaxLoopNestingMarker) return; 1774 if (loop_nesting_level > AbstractCode::kMaxLoopNestingMarker) return;
1775 1775
1776 BackEdgeTable back_edges(unoptimized, &no_gc); 1776 BackEdgeTable back_edges(unoptimized, &no_gc);
1777 for (uint32_t i = 0; i < back_edges.length(); i++) { 1777 for (uint32_t i = 0; i < back_edges.length(); i++) {
1778 if (static_cast<int>(back_edges.loop_depth(i)) == loop_nesting_level) { 1778 if (static_cast<int>(back_edges.loop_depth(i)) == loop_nesting_level) {
1779 DCHECK_EQ(INTERRUPT, GetBackEdgeState(isolate, 1779 DCHECK_EQ(INTERRUPT, GetBackEdgeState(isolate,
1780 unoptimized, 1780 unoptimized,
1781 back_edges.pc(i))); 1781 back_edges.pc(i)));
1782 PatchAt(unoptimized, back_edges.pc(i), ON_STACK_REPLACEMENT, patch); 1782 PatchAt(unoptimized, back_edges.pc(i), ON_STACK_REPLACEMENT, patch);
1783 } 1783 }
1784 } 1784 }
(...skipping 26 matching lines...) Expand all
1811 } 1811 }
1812 1812
1813 1813
1814 #ifdef DEBUG 1814 #ifdef DEBUG
1815 bool BackEdgeTable::Verify(Isolate* isolate, Code* unoptimized) { 1815 bool BackEdgeTable::Verify(Isolate* isolate, Code* unoptimized) {
1816 DisallowHeapAllocation no_gc; 1816 DisallowHeapAllocation no_gc;
1817 int loop_nesting_level = unoptimized->allow_osr_at_loop_nesting_level(); 1817 int loop_nesting_level = unoptimized->allow_osr_at_loop_nesting_level();
1818 BackEdgeTable back_edges(unoptimized, &no_gc); 1818 BackEdgeTable back_edges(unoptimized, &no_gc);
1819 for (uint32_t i = 0; i < back_edges.length(); i++) { 1819 for (uint32_t i = 0; i < back_edges.length(); i++) {
1820 uint32_t loop_depth = back_edges.loop_depth(i); 1820 uint32_t loop_depth = back_edges.loop_depth(i);
1821 CHECK_LE(static_cast<int>(loop_depth), Code::kMaxLoopNestingMarker); 1821 CHECK_LE(static_cast<int>(loop_depth), AbstractCode::kMaxLoopNestingMarker);
1822 // Assert that all back edges for shallower loops (and only those) 1822 // Assert that all back edges for shallower loops (and only those)
1823 // have already been patched. 1823 // have already been patched.
1824 CHECK_EQ((static_cast<int>(loop_depth) <= loop_nesting_level), 1824 CHECK_EQ((static_cast<int>(loop_depth) <= loop_nesting_level),
1825 GetBackEdgeState(isolate, 1825 GetBackEdgeState(isolate,
1826 unoptimized, 1826 unoptimized,
1827 back_edges.pc(i)) != INTERRUPT); 1827 back_edges.pc(i)) != INTERRUPT);
1828 } 1828 }
1829 return true; 1829 return true;
1830 } 1830 }
1831 #endif // DEBUG 1831 #endif // DEBUG
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 return var->scope()->is_nonlinear() || 1937 return var->scope()->is_nonlinear() ||
1938 var->initializer_position() >= proxy->position(); 1938 var->initializer_position() >= proxy->position();
1939 } 1939 }
1940 1940
1941 1941
1942 #undef __ 1942 #undef __
1943 1943
1944 1944
1945 } // namespace internal 1945 } // namespace internal
1946 } // namespace v8 1946 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698