| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize; | 99 (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize; |
| 100 CodePatcher destroyer(code->instruction_start() + last_pc_offset, | 100 CodePatcher destroyer(code->instruction_start() + last_pc_offset, |
| 101 instructions); | 101 instructions); |
| 102 for (int x = 0; x < instructions; x++) { | 102 for (int x = 0; x < instructions; x++) { |
| 103 destroyer.masm()->bkpt(0); | 103 destroyer.masm()->bkpt(0); |
| 104 } | 104 } |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 // Add the deoptimizing code to the list. | 107 // Add the deoptimizing code to the list. |
| 108 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); | 108 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); |
| 109 node->set_next(deoptimizing_code_list_); | 109 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); |
| 110 deoptimizing_code_list_ = node; | 110 node->set_next(data->deoptimizing_code_list_); |
| 111 data->deoptimizing_code_list_ = node; |
| 111 | 112 |
| 112 // Set the code for the function to non-optimized version. | 113 // Set the code for the function to non-optimized version. |
| 113 function->ReplaceCode(function->shared()->code()); | 114 function->ReplaceCode(function->shared()->code()); |
| 114 | 115 |
| 115 if (FLAG_trace_deopt) { | 116 if (FLAG_trace_deopt) { |
| 116 PrintF("[forced deoptimization: "); | 117 PrintF("[forced deoptimization: "); |
| 117 function->PrintName(); | 118 function->PrintName(); |
| 118 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 119 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
| 119 #ifdef DEBUG | 120 #ifdef DEBUG |
| 120 if (FLAG_print_code) { | 121 if (FLAG_print_code) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } else { | 311 } else { |
| 311 // Setup the frame pointer and the context pointer. | 312 // Setup the frame pointer and the context pointer. |
| 312 output_[0]->SetRegister(fp.code(), input_->GetRegister(fp.code())); | 313 output_[0]->SetRegister(fp.code(), input_->GetRegister(fp.code())); |
| 313 output_[0]->SetRegister(cp.code(), input_->GetRegister(cp.code())); | 314 output_[0]->SetRegister(cp.code(), input_->GetRegister(cp.code())); |
| 314 | 315 |
| 315 unsigned pc_offset = data->OsrPcOffset()->value(); | 316 unsigned pc_offset = data->OsrPcOffset()->value(); |
| 316 uint32_t pc = reinterpret_cast<uint32_t>( | 317 uint32_t pc = reinterpret_cast<uint32_t>( |
| 317 optimized_code_->entry() + pc_offset); | 318 optimized_code_->entry() + pc_offset); |
| 318 output_[0]->SetPc(pc); | 319 output_[0]->SetPc(pc); |
| 319 } | 320 } |
| 320 Code* continuation = Builtins::builtin(Builtins::NotifyOSR); | 321 Code* continuation = Isolate::Current()->builtins()->builtin( |
| 322 Builtins::NotifyOSR); |
| 321 output_[0]->SetContinuation( | 323 output_[0]->SetContinuation( |
| 322 reinterpret_cast<uint32_t>(continuation->entry())); | 324 reinterpret_cast<uint32_t>(continuation->entry())); |
| 323 | 325 |
| 324 if (FLAG_trace_osr) { | 326 if (FLAG_trace_osr) { |
| 325 PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ", | 327 PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ", |
| 326 ok ? "finished" : "aborted", | 328 ok ? "finished" : "aborted", |
| 327 reinterpret_cast<intptr_t>(function)); | 329 reinterpret_cast<intptr_t>(function)); |
| 328 function->PrintName(); | 330 function->PrintName(); |
| 329 PrintF(" => pc=0x%0x]\n", output_[0]->GetPc()); | 331 PrintF(" => pc=0x%0x]\n", output_[0]->GetPc()); |
| 330 } | 332 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset); | 486 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset); |
| 485 output_frame->SetPc(pc_value); | 487 output_frame->SetPc(pc_value); |
| 486 if (is_topmost) { | 488 if (is_topmost) { |
| 487 output_frame->SetRegister(pc.code(), pc_value); | 489 output_frame->SetRegister(pc.code(), pc_value); |
| 488 } | 490 } |
| 489 | 491 |
| 490 FullCodeGenerator::State state = | 492 FullCodeGenerator::State state = |
| 491 FullCodeGenerator::StateField::decode(pc_and_state); | 493 FullCodeGenerator::StateField::decode(pc_and_state); |
| 492 output_frame->SetState(Smi::FromInt(state)); | 494 output_frame->SetState(Smi::FromInt(state)); |
| 493 | 495 |
| 496 |
| 494 // Set the continuation for the topmost frame. | 497 // Set the continuation for the topmost frame. |
| 495 if (is_topmost) { | 498 if (is_topmost) { |
| 499 Builtins* builtins = isolate_->builtins(); |
| 496 Code* continuation = (bailout_type_ == EAGER) | 500 Code* continuation = (bailout_type_ == EAGER) |
| 497 ? Builtins::builtin(Builtins::NotifyDeoptimized) | 501 ? builtins->builtin(Builtins::NotifyDeoptimized) |
| 498 : Builtins::builtin(Builtins::NotifyLazyDeoptimized); | 502 : builtins->builtin(Builtins::NotifyLazyDeoptimized); |
| 499 output_frame->SetContinuation( | 503 output_frame->SetContinuation( |
| 500 reinterpret_cast<uint32_t>(continuation->entry())); | 504 reinterpret_cast<uint32_t>(continuation->entry())); |
| 501 } | 505 } |
| 502 | 506 |
| 503 if (output_count_ - 1 == frame_index) iterator->Done(); | 507 if (output_count_ - 1 == frame_index) iterator->Done(); |
| 504 } | 508 } |
| 505 | 509 |
| 506 | 510 |
| 507 #define __ masm()-> | 511 #define __ masm()-> |
| 508 | 512 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 __ push(ip); | 701 __ push(ip); |
| 698 __ b(&done); | 702 __ b(&done); |
| 699 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 703 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
| 700 } | 704 } |
| 701 __ bind(&done); | 705 __ bind(&done); |
| 702 } | 706 } |
| 703 | 707 |
| 704 #undef __ | 708 #undef __ |
| 705 | 709 |
| 706 } } // namespace v8::internal | 710 } } // namespace v8::internal |
| OLD | NEW |