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

Side by Side Diff: src/deoptimizer.cc

Issue 19248002: Fix unaligned accesses in back_edge tables. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Fixed nit. Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/full-codegen.h » ('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 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 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 Code* replacement_code) { 2364 Code* replacement_code) {
2365 // Iterate over the back edge table and patch every interrupt 2365 // Iterate over the back edge table and patch every interrupt
2366 // call to an unconditional call to the replacement code. 2366 // call to an unconditional call to the replacement code.
2367 ASSERT(unoptimized_code->kind() == Code::FUNCTION); 2367 ASSERT(unoptimized_code->kind() == Code::FUNCTION);
2368 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); 2368 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level();
2369 Address back_edge_cursor = unoptimized_code->instruction_start() + 2369 Address back_edge_cursor = unoptimized_code->instruction_start() +
2370 unoptimized_code->back_edge_table_offset(); 2370 unoptimized_code->back_edge_table_offset();
2371 uint32_t table_length = Memory::uint32_at(back_edge_cursor); 2371 uint32_t table_length = Memory::uint32_at(back_edge_cursor);
2372 back_edge_cursor += kIntSize; 2372 back_edge_cursor += kIntSize;
2373 for (uint32_t i = 0; i < table_length; ++i) { 2373 for (uint32_t i = 0; i < table_length; ++i) {
2374 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); 2374 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize);
2375 if (loop_depth == loop_nesting_level) { 2375 if (static_cast<int>(loop_depth) == loop_nesting_level) {
2376 // Loop back edge has the loop depth that we want to patch. 2376 // Loop back edge has the loop depth that we want to patch.
2377 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); 2377 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize);
2378 Address pc_after = unoptimized_code->instruction_start() + pc_offset; 2378 Address pc_after = unoptimized_code->instruction_start() + pc_offset;
2379 PatchInterruptCodeAt(unoptimized_code, 2379 PatchInterruptCodeAt(unoptimized_code,
2380 pc_after, 2380 pc_after,
2381 interrupt_code, 2381 interrupt_code,
2382 replacement_code); 2382 replacement_code);
2383 } 2383 }
2384 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; 2384 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize;
2385 } 2385 }
(...skipping 10 matching lines...) Expand all
2396 Code* replacement_code) { 2396 Code* replacement_code) {
2397 // Iterate over the back edge table and revert the patched interrupt calls. 2397 // Iterate over the back edge table and revert the patched interrupt calls.
2398 ASSERT(unoptimized_code->kind() == Code::FUNCTION); 2398 ASSERT(unoptimized_code->kind() == Code::FUNCTION);
2399 ASSERT(unoptimized_code->back_edges_patched_for_osr()); 2399 ASSERT(unoptimized_code->back_edges_patched_for_osr());
2400 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level(); 2400 int loop_nesting_level = unoptimized_code->allow_osr_at_loop_nesting_level();
2401 Address back_edge_cursor = unoptimized_code->instruction_start() + 2401 Address back_edge_cursor = unoptimized_code->instruction_start() +
2402 unoptimized_code->back_edge_table_offset(); 2402 unoptimized_code->back_edge_table_offset();
2403 uint32_t table_length = Memory::uint32_at(back_edge_cursor); 2403 uint32_t table_length = Memory::uint32_at(back_edge_cursor);
2404 back_edge_cursor += kIntSize; 2404 back_edge_cursor += kIntSize;
2405 for (uint32_t i = 0; i < table_length; ++i) { 2405 for (uint32_t i = 0; i < table_length; ++i) {
2406 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); 2406 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize);
2407 if (loop_depth <= loop_nesting_level) { 2407 if (static_cast<int>(loop_depth) <= loop_nesting_level) {
2408 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); 2408 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize);
2409 Address pc_after = unoptimized_code->instruction_start() + pc_offset; 2409 Address pc_after = unoptimized_code->instruction_start() + pc_offset;
2410 RevertInterruptCodeAt(unoptimized_code, 2410 RevertInterruptCodeAt(unoptimized_code,
2411 pc_after, 2411 pc_after,
2412 interrupt_code, 2412 interrupt_code,
2413 replacement_code); 2413 replacement_code);
2414 } 2414 }
2415 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; 2415 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize;
2416 } 2416 }
2417 unoptimized_code->set_back_edges_patched_for_osr(false); 2417 unoptimized_code->set_back_edges_patched_for_osr(false);
(...skipping 10 matching lines...) Expand all
2428 void Deoptimizer::VerifyInterruptCode(Code* unoptimized_code, 2428 void Deoptimizer::VerifyInterruptCode(Code* unoptimized_code,
2429 Code* interrupt_code, 2429 Code* interrupt_code,
2430 Code* replacement_code, 2430 Code* replacement_code,
2431 int loop_nesting_level) { 2431 int loop_nesting_level) {
2432 CHECK(unoptimized_code->kind() == Code::FUNCTION); 2432 CHECK(unoptimized_code->kind() == Code::FUNCTION);
2433 Address back_edge_cursor = unoptimized_code->instruction_start() + 2433 Address back_edge_cursor = unoptimized_code->instruction_start() +
2434 unoptimized_code->back_edge_table_offset(); 2434 unoptimized_code->back_edge_table_offset();
2435 uint32_t table_length = Memory::uint32_at(back_edge_cursor); 2435 uint32_t table_length = Memory::uint32_at(back_edge_cursor);
2436 back_edge_cursor += kIntSize; 2436 back_edge_cursor += kIntSize;
2437 for (uint32_t i = 0; i < table_length; ++i) { 2437 for (uint32_t i = 0; i < table_length; ++i) {
2438 uint8_t loop_depth = Memory::uint8_at(back_edge_cursor + 2 * kIntSize); 2438 uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + 2 * kIntSize);
2439 CHECK_LE(loop_depth, Code::kMaxLoopNestingMarker); 2439 CHECK_LE(static_cast<int>(loop_depth), Code::kMaxLoopNestingMarker);
2440 // Assert that all back edges for shallower loops (and only those) 2440 // Assert that all back edges for shallower loops (and only those)
2441 // have already been patched. 2441 // have already been patched.
2442 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); 2442 uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize);
2443 Address pc_after = unoptimized_code->instruction_start() + pc_offset; 2443 Address pc_after = unoptimized_code->instruction_start() + pc_offset;
2444 CHECK_EQ((loop_depth <= loop_nesting_level), 2444 CHECK_EQ((static_cast<int>(loop_depth) <= loop_nesting_level),
2445 InterruptCodeIsPatched(unoptimized_code, 2445 InterruptCodeIsPatched(unoptimized_code,
2446 pc_after, 2446 pc_after,
2447 interrupt_code, 2447 interrupt_code,
2448 replacement_code)); 2448 replacement_code));
2449 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; 2449 back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize;
2450 } 2450 }
2451 } 2451 }
2452 #endif // DEBUG 2452 #endif // DEBUG
2453 2453
2454 2454
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 3096
3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3098 v->VisitPointer(BitCast<Object**>(&function_)); 3098 v->VisitPointer(BitCast<Object**>(&function_));
3099 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3099 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3101 } 3101 }
3102 3102
3103 #endif // ENABLE_DEBUGGER_SUPPORT 3103 #endif // ENABLE_DEBUGGER_SUPPORT
3104 3104
3105 } } // namespace v8::internal 3105 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698