| 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 24 matching lines...) Expand all Loading... |
| 35 #include "safepoint-table.h" | 35 #include "safepoint-table.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 | 40 |
| 41 const int Deoptimizer::table_entry_size_ = 10; | 41 const int Deoptimizer::table_entry_size_ = 10; |
| 42 | 42 |
| 43 | 43 |
| 44 int Deoptimizer::patch_size() { | 44 int Deoptimizer::patch_size() { |
| 45 return Assembler::kCallSequenceLength; | 45 return Assembler::kCallInstructionLength; |
| 46 } | 46 } |
| 47 | 47 |
| 48 | 48 |
| 49 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { | 49 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { |
| 50 // Invalidate the relocation information, as it will become invalid by the | 50 // Invalidate the relocation information, as it will become invalid by the |
| 51 // code patching below, and is not needed any more. | 51 // code patching below, and is not needed any more. |
| 52 code->InvalidateRelocation(); | 52 code->InvalidateRelocation(); |
| 53 | 53 |
| 54 // For each LLazyBailout instruction insert a absolute call to the | 54 // For each LLazyBailout instruction insert a absolute call to the |
| 55 // corresponding deoptimization entry, or a short call to an absolute | 55 // corresponding deoptimization entry, or a short call to an absolute |
| 56 // jump if space is short. The absolute jumps are put in a table just | 56 // jump if space is short. The absolute jumps are put in a table just |
| 57 // before the safepoint table (space was allocated there when the Code | 57 // before the safepoint table (space was allocated there when the Code |
| 58 // object was created, if necessary). | 58 // object was created, if necessary). |
| 59 | 59 |
| 60 Address instruction_start = code->instruction_start(); | 60 Address instruction_start = code->instruction_start(); |
| 61 #ifdef DEBUG | 61 #ifdef DEBUG |
| 62 Address prev_call_address = NULL; | 62 Address prev_call_address = NULL; |
| 63 #endif | 63 #endif |
| 64 DeoptimizationInputData* deopt_data = | 64 DeoptimizationInputData* deopt_data = |
| 65 DeoptimizationInputData::cast(code->deoptimization_data()); | 65 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 66 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 66 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
| 67 if (deopt_data->Pc(i)->value() == -1) continue; | 67 if (deopt_data->Pc(i)->value() == -1) continue; |
| 68 // Position where Call will be patched in. | 68 // Position where Call will be patched in. |
| 69 Address call_address = instruction_start + deopt_data->Pc(i)->value(); | 69 Address call_address = instruction_start + deopt_data->Pc(i)->value(); |
| 70 // There is room enough to write a long call instruction because we pad | 70 // There is room enough to write a long call instruction because we pad |
| 71 // LLazyBailout instructions with nops if necessary. | 71 // LLazyBailout instructions with nops if necessary. |
| 72 CodePatcher patcher(call_address, Assembler::kCallSequenceLength); | 72 CodePatcher patcher(call_address, Assembler::kCallInstructionLength); |
| 73 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY), | 73 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY), |
| 74 RelocInfo::NONE64); | 74 RelocInfo::NONE64); |
| 75 ASSERT(prev_call_address == NULL || | 75 ASSERT(prev_call_address == NULL || |
| 76 call_address >= prev_call_address + patch_size()); | 76 call_address >= prev_call_address + patch_size()); |
| 77 ASSERT(call_address + patch_size() <= code->instruction_end()); | 77 ASSERT(call_address + patch_size() <= code->instruction_end()); |
| 78 #ifdef DEBUG | 78 #ifdef DEBUG |
| 79 prev_call_address = call_address; | 79 prev_call_address = call_address; |
| 80 #endif | 80 #endif |
| 81 } | 81 } |
| 82 } | 82 } |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 SetFrameSlot(offset, value); | 587 SetFrameSlot(offset, value); |
| 588 } | 588 } |
| 589 | 589 |
| 590 | 590 |
| 591 #undef __ | 591 #undef __ |
| 592 | 592 |
| 593 | 593 |
| 594 } } // namespace v8::internal | 594 } } // namespace v8::internal |
| 595 | 595 |
| 596 #endif // V8_TARGET_ARCH_X64 | 596 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |