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

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

Issue 99013003: Fix incorrect patching for OSR. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comment Created 7 years 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/compiler.cc ('k') | src/ia32/builtins-ia32.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 // 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
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
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
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698