| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 Code* replacement_code) { | 2378 Code* replacement_code) { |
| 2379 // Iterate over the back edge table and patch every interrupt | 2379 // Iterate over the back edge table and patch every interrupt |
| 2380 // call to an unconditional call to the replacement code. | 2380 // call to an unconditional call to the replacement code. |
| 2381 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 2381 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
| 2382 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); | 2382 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); |
| 2383 Address back_edge_cursor = unoptimized_code->instruction_start() + | 2383 Address back_edge_cursor = unoptimized_code->instruction_start() + |
| 2384 unoptimized_code->back_edge_table_offset(); | 2384 unoptimized_code->back_edge_table_offset(); |
| 2385 uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 2385 uint32_t table_length = Memory::uint32_at(back_edge_cursor); |
| 2386 back_edge_cursor += kIntSize; | 2386 back_edge_cursor += kIntSize; |
| 2387 for (uint32_t i = 0; i < table_length; ++i) { | 2387 for (uint32_t i = 0; i < table_length; ++i) { |
| 2388 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); | 2388 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize); |
| 2389 if (loop_depth == loop_nesting_level) { | 2389 if (static_cast<int>(loop_depth) == loop_nesting_level) { |
| 2390 // Loop back edge has the loop depth that we want to patch. | 2390 // Loop back edge has the loop depth that we want to patch. |
| 2391 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 2391 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); |
| 2392 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 2392 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 2393 PatchInterruptCodeAt(unoptimized_code, | 2393 PatchInterruptCodeAt(unoptimized_code, |
| 2394 pc_after, | 2394 pc_after, |
| 2395 interrupt_code, | 2395 interrupt_code, |
| 2396 replacement_code); | 2396 replacement_code); |
| 2397 } | 2397 } |
| 2398 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 2398 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; |
| 2399 } | 2399 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2410 Code* replacement_code) { | 2410 Code* replacement_code) { |
| 2411 // Iterate over the back edge table and revert the patched interrupt calls. | 2411 // Iterate over the back edge table and revert the patched interrupt calls. |
| 2412 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 2412 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
| 2413 ASSERT(unoptimized_code->back_edges_patched_for_osr()); | 2413 ASSERT(unoptimized_code->back_edges_patched_for_osr()); |
| 2414 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); | 2414 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); |
| 2415 Address back_edge_cursor = unoptimized_code->instruction_start() + | 2415 Address back_edge_cursor = unoptimized_code->instruction_start() + |
| 2416 unoptimized_code->back_edge_table_offset(); | 2416 unoptimized_code->back_edge_table_offset(); |
| 2417 uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 2417 uint32_t table_length = Memory::uint32_at(back_edge_cursor); |
| 2418 back_edge_cursor += kIntSize; | 2418 back_edge_cursor += kIntSize; |
| 2419 for (uint32_t i = 0; i < table_length; ++i) { | 2419 for (uint32_t i = 0; i < table_length; ++i) { |
| 2420 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); | 2420 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize); |
| 2421 if (loop_depth <= loop_nesting_level) { | 2421 if (static_cast<int>(loop_depth) <= loop_nesting_level) { |
| 2422 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 2422 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); |
| 2423 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 2423 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 2424 RevertInterruptCodeAt(unoptimized_code, | 2424 RevertInterruptCodeAt(unoptimized_code, |
| 2425 pc_after, | 2425 pc_after, |
| 2426 interrupt_code, | 2426 interrupt_code, |
| 2427 replacement_code); | 2427 replacement_code); |
| 2428 } | 2428 } |
| 2429 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 2429 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; |
| 2430 } | 2430 } |
| 2431 unoptimized_code->set_back_edges_patched_for_osr(false); | 2431 unoptimized_code->set_back_edges_patched_for_osr(false); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2442 void Deoptimizer::VerifyInterruptCode(Code* unoptimized_code, | 2442 void Deoptimizer::VerifyInterruptCode(Code* unoptimized_code, |
| 2443 Code* interrupt_code, | 2443 Code* interrupt_code, |
| 2444 Code* replacement_code, | 2444 Code* replacement_code, |
| 2445 int loop_nesting_level) { | 2445 int loop_nesting_level) { |
| 2446 CHECK(unoptimized_code->kind() == Code::FUNCTION); | 2446 CHECK(unoptimized_code->kind() == Code::FUNCTION); |
| 2447 Address back_edge_cursor = unoptimized_code->instruction_start() + | 2447 Address back_edge_cursor = unoptimized_code->instruction_start() + |
| 2448 unoptimized_code->back_edge_table_offset(); | 2448 unoptimized_code->back_edge_table_offset(); |
| 2449 uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 2449 uint32_t table_length = Memory::uint32_at(back_edge_cursor); |
| 2450 back_edge_cursor += kIntSize; | 2450 back_edge_cursor += kIntSize; |
| 2451 for (uint32_t i = 0; i < table_length; ++i) { | 2451 for (uint32_t i = 0; i < table_length; ++i) { |
| 2452 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); | 2452 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize); |
| 2453 CHECK_LE(loop_depth, Code::kMaxLoopNestingMarker); | 2453 CHECK_LE(static_cast<int>(loop_depth), Code::kMaxLoopNestingMarker); |
| 2454 // Assert that all back edges for shallower loops (and only those) | 2454 // Assert that all back edges for shallower loops (and only those) |
| 2455 // have already been patched. | 2455 // have already been patched. |
| 2456 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 2456 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); |
| 2457 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 2457 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 2458 CHECK_EQ((loop_depth <= loop_nesting_level), | 2458 CHECK_EQ((static_cast<int>(loop_depth) <= loop_nesting_level), |
| 2459 InterruptCodeIsPatched(unoptimized_code, | 2459 InterruptCodeIsPatched(unoptimized_code, |
| 2460 pc_after, | 2460 pc_after, |
| 2461 interrupt_code, | 2461 interrupt_code, |
| 2462 replacement_code)); | 2462 replacement_code)); |
| 2463 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 2463 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; |
| 2464 } | 2464 } |
| 2465 } | 2465 } |
| 2466 #endif // DEBUG | 2466 #endif // DEBUG |
| 2467 | 2467 |
| 2468 | 2468 |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3110 | 3110 |
| 3111 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3111 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 3112 v->VisitPointer(BitCast<Object**>(&function_)); | 3112 v->VisitPointer(BitCast<Object**>(&function_)); |
| 3113 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3113 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 3114 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3114 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 3115 } | 3115 } |
| 3116 | 3116 |
| 3117 #endif // ENABLE_DEBUGGER_SUPPORT | 3117 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3118 | 3118 |
| 3119 } } // namespace v8::internal | 3119 } } // namespace v8::internal |
| OLD | NEW |