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 2349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2360 Code* replacement_code) { | 2360 Code* replacement_code) { |
2361 // Iterate over the back edge table and patch every interrupt | 2361 // Iterate over the back edge table and patch every interrupt |
2362 // call to an unconditional call to the replacement code. | 2362 // call to an unconditional call to the replacement code. |
2363 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 2363 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
2364 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); | 2364 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); |
2365 Address back_edge_cursor = unoptimized_code->instruction_start() + | 2365 Address back_edge_cursor = unoptimized_code->instruction_start() + |
2366 unoptimized_code->back_edge_table_offset(); | 2366 unoptimized_code->back_edge_table_offset(); |
2367 uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 2367 uint32_t table_length = Memory::uint32_at(back_edge_cursor); |
2368 back_edge_cursor += kIntSize; | 2368 back_edge_cursor += kIntSize; |
2369 for (uint32_t i = 0; i < table_length; ++i) { | 2369 for (uint32_t i = 0; i < table_length; ++i) { |
2370 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); | 2370 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize); |
2371 if (loop_depth == loop_nesting_level) { | 2371 if (static_cast<int>(loop_depth) == loop_nesting_level) { |
2372 // Loop back edge has the loop depth that we want to patch. | 2372 // Loop back edge has the loop depth that we want to patch. |
2373 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 2373 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); |
2374 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 2374 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
2375 PatchInterruptCodeAt(unoptimized_code, | 2375 PatchInterruptCodeAt(unoptimized_code, |
2376 pc_after, | 2376 pc_after, |
2377 interrupt_code, | 2377 interrupt_code, |
2378 replacement_code); | 2378 replacement_code); |
2379 } | 2379 } |
2380 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 2380 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; |
2381 } | 2381 } |
(...skipping 10 matching lines...) Expand all Loading... | |
2392 Code* replacement_code) { | 2392 Code* replacement_code) { |
2393 // Iterate over the back edge table and revert the patched interrupt calls. | 2393 // Iterate over the back edge table and revert the patched interrupt calls. |
2394 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 2394 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
2395 ASSERT(unoptimized_code->back_edges_patched_for_osr()); | 2395 ASSERT(unoptimized_code->back_edges_patched_for_osr()); |
2396 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); | 2396 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); |
2397 Address back_edge_cursor = unoptimized_code->instruction_start() + | 2397 Address back_edge_cursor = unoptimized_code->instruction_start() + |
2398 unoptimized_code->back_edge_table_offset(); | 2398 unoptimized_code->back_edge_table_offset(); |
2399 uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 2399 uint32_t table_length = Memory::uint32_at(back_edge_cursor); |
2400 back_edge_cursor += kIntSize; | 2400 back_edge_cursor += kIntSize; |
2401 for (uint32_t i = 0; i < table_length; ++i) { | 2401 for (uint32_t i = 0; i < table_length; ++i) { |
2402 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); | 2402 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize); |
2403 if (loop_depth <= loop_nesting_level) { | 2403 if (static_cast<int>(loop_depth) <= loop_nesting_level) { |
2404 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 2404 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); |
2405 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 2405 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
2406 RevertInterruptCodeAt(unoptimized_code, | 2406 RevertInterruptCodeAt(unoptimized_code, |
2407 pc_after, | 2407 pc_after, |
2408 interrupt_code, | 2408 interrupt_code, |
2409 replacement_code); | 2409 replacement_code); |
2410 } | 2410 } |
2411 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 2411 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; |
2412 } | 2412 } |
2413 unoptimized_code->set_back_edges_patched_for_osr(false); | 2413 unoptimized_code->set_back_edges_patched_for_osr(false); |
(...skipping 10 matching lines...) Expand all Loading... | |
2424 void Deoptimizer::VerifyInterruptCode(Code* unoptimized_code, | 2424 void Deoptimizer::VerifyInterruptCode(Code* unoptimized_code, |
2425 Code* interrupt_code, | 2425 Code* interrupt_code, |
2426 Code* replacement_code, | 2426 Code* replacement_code, |
2427 int loop_nesting_level) { | 2427 int loop_nesting_level) { |
2428 CHECK(unoptimized_code->kind() == Code::FUNCTION); | 2428 CHECK(unoptimized_code->kind() == Code::FUNCTION); |
2429 Address back_edge_cursor = unoptimized_code->instruction_start() + | 2429 Address back_edge_cursor = unoptimized_code->instruction_start() + |
2430 unoptimized_code->back_edge_table_offset(); | 2430 unoptimized_code->back_edge_table_offset(); |
2431 uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 2431 uint32_t table_length = Memory::uint32_at(back_edge_cursor); |
2432 back_edge_cursor += kIntSize; | 2432 back_edge_cursor += kIntSize; |
2433 for (uint32_t i = 0; i < table_length; ++i) { | 2433 for (uint32_t i = 0; i < table_length; ++i) { |
2434 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); | 2434 int32_t loop_depth = Memory::int32_at(back_edge_cursor + 2 * kIntSize); |
kisg
2013/07/18 15:46:52
Instead of int32_t, use uint32_t and static_cast<i
kilvadyb
2013/07/18 18:22:43
Done.
| |
2435 CHECK_LE(loop_depth, Code::kMaxLoopNestingMarker); | 2435 CHECK_LE(loop_depth, Code::kMaxLoopNestingMarker); |
2436 // Assert that all back edges for shallower loops (and only those) | 2436 // Assert that all back edges for shallower loops (and only those) |
2437 // have already been patched. | 2437 // have already been patched. |
2438 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 2438 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); |
2439 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 2439 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
2440 CHECK_EQ((loop_depth <= loop_nesting_level), | 2440 CHECK_EQ((loop_depth <= loop_nesting_level), |
2441 InterruptCodeIsPatched(unoptimized_code, | 2441 InterruptCodeIsPatched(unoptimized_code, |
2442 pc_after, | 2442 pc_after, |
2443 interrupt_code, | 2443 interrupt_code, |
2444 replacement_code)); | 2444 replacement_code)); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3092 | 3092 |
3093 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3093 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3094 v->VisitPointer(BitCast<Object**>(&function_)); | 3094 v->VisitPointer(BitCast<Object**>(&function_)); |
3095 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3095 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3096 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3096 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3097 } | 3097 } |
3098 | 3098 |
3099 #endif // ENABLE_DEBUGGER_SUPPORT | 3099 #endif // ENABLE_DEBUGGER_SUPPORT |
3100 | 3100 |
3101 } } // namespace v8::internal | 3101 } } // namespace v8::internal |
OLD | NEW |