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 8007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8018 ASSERT(frame->LookupCode() == *unoptimized); | 8018 ASSERT(frame->LookupCode() == *unoptimized); |
8019 ASSERT(unoptimized->contains(frame->pc())); | 8019 ASSERT(unoptimized->contains(frame->pc())); |
8020 | 8020 |
8021 // Use linear search of the unoptimized code's back edge table to find | 8021 // Use linear search of the unoptimized code's back edge table to find |
8022 // the AST id matching the PC. | 8022 // the AST id matching the PC. |
8023 Address start = unoptimized->instruction_start(); | 8023 Address start = unoptimized->instruction_start(); |
8024 unsigned target_pc_offset = static_cast<unsigned>(frame->pc() - start); | 8024 unsigned target_pc_offset = static_cast<unsigned>(frame->pc() - start); |
8025 Address table_cursor = start + unoptimized->back_edge_table_offset(); | 8025 Address table_cursor = start + unoptimized->back_edge_table_offset(); |
8026 uint32_t table_length = Memory::uint32_at(table_cursor); | 8026 uint32_t table_length = Memory::uint32_at(table_cursor); |
8027 table_cursor += kIntSize; | 8027 table_cursor += kIntSize; |
8028 uint8_t loop_depth = 0; | 8028 uint32_t loop_depth = 0; |
8029 for (unsigned i = 0; i < table_length; ++i) { | 8029 for (unsigned i = 0; i < table_length; ++i) { |
8030 // Table entries are (AST id, pc offset) pairs. | 8030 // Table entries are (AST id, pc offset) pairs. |
8031 uint32_t pc_offset = Memory::uint32_at(table_cursor + kIntSize); | 8031 uint32_t pc_offset = Memory::uint32_at(table_cursor + kIntSize); |
8032 if (pc_offset == target_pc_offset) { | 8032 if (pc_offset == target_pc_offset) { |
8033 ast_id = BailoutId(static_cast<int>(Memory::uint32_at(table_cursor))); | 8033 ast_id = BailoutId(static_cast<int>(Memory::uint32_at(table_cursor))); |
8034 loop_depth = Memory::uint8_at(table_cursor + 2 * kIntSize); | 8034 loop_depth = Memory::uint32_at(table_cursor + 2 * kIntSize); |
8035 break; | 8035 break; |
8036 } | 8036 } |
8037 table_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 8037 table_cursor += FullCodeGenerator::kBackEdgeEntrySize; |
8038 } | 8038 } |
8039 ASSERT(!ast_id.IsNone()); | 8039 ASSERT(!ast_id.IsNone()); |
8040 if (FLAG_trace_osr) { | 8040 if (FLAG_trace_osr) { |
8041 PrintF("[replacing on-stack at AST id %d, loop depth %d in ", | 8041 PrintF("[replacing on-stack at AST id %d, loop depth %d in ", |
8042 ast_id.ToInt(), loop_depth); | 8042 ast_id.ToInt(), loop_depth); |
8043 function->PrintName(); | 8043 function->PrintName(); |
8044 PrintF("]\n"); | 8044 PrintF("]\n"); |
(...skipping 5324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13369 // Handle last resort GC and make sure to allow future allocations | 13369 // Handle last resort GC and make sure to allow future allocations |
13370 // to grow the heap without causing GCs (if possible). | 13370 // to grow the heap without causing GCs (if possible). |
13371 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13371 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13372 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13372 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13373 "Runtime::PerformGC"); | 13373 "Runtime::PerformGC"); |
13374 } | 13374 } |
13375 } | 13375 } |
13376 | 13376 |
13377 | 13377 |
13378 } } // namespace v8::internal | 13378 } } // namespace v8::internal |
OLD | NEW |