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

Unified Diff: src/runtime.cc

Issue 22424002: Wrap back edge table in an iterator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 17784181bdd3d37ee454a8cd6364597faeffc496..144f12fd1335e7a22a1b51f0c3359d8e6c75c6c7 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8547,23 +8547,20 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
// Use linear search of the unoptimized code's back edge table to find
// the AST id matching the PC.
- Address start = unoptimized->instruction_start();
- unsigned target_pc_offset = static_cast<unsigned>(frame->pc() - start);
- Address table_cursor = start + unoptimized->back_edge_table_offset();
- uint32_t table_length = Memory::uint32_at(table_cursor);
- table_cursor += kIntSize;
+ uint32_t target_pc_offset = frame->pc() - unoptimized->instruction_start();
uint32_t loop_depth = 0;
- for (unsigned i = 0; i < table_length; ++i) {
- // Table entries are (AST id, pc offset) pairs.
- uint32_t pc_offset = Memory::uint32_at(table_cursor + kIntSize);
- if (pc_offset == target_pc_offset) {
- ast_id = BailoutId(static_cast<int>(Memory::uint32_at(table_cursor)));
- loop_depth = Memory::uint32_at(table_cursor + 2 * kIntSize);
+
+ for (FullCodeGenerator::BackEdgeTableIterator back_edges(*unoptimized);
+ !back_edges.Done();
+ back_edges.Next()) {
+ if (back_edges.pc_offset() == target_pc_offset) {
+ ast_id = back_edges.ast_id();
+ loop_depth = back_edges.loop_depth();
break;
}
- table_cursor += FullCodeGenerator::kBackEdgeEntrySize;
}
ASSERT(!ast_id.IsNone());
+
if (FLAG_trace_osr) {
PrintF("[replacing on-stack at AST id %d, loop depth %d in ",
ast_id.ToInt(), loop_depth);
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698