| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 // For each LLazyBailout instruction insert a absolute call to the | 51 // For each LLazyBailout instruction insert a absolute call to the |
| 52 // corresponding deoptimization entry, or a short call to an absolute | 52 // corresponding deoptimization entry, or a short call to an absolute |
| 53 // jump if space is short. The absolute jumps are put in a table just | 53 // jump if space is short. The absolute jumps are put in a table just |
| 54 // before the safepoint table (space was allocated there when the Code | 54 // before the safepoint table (space was allocated there when the Code |
| 55 // object was created, if necessary). | 55 // object was created, if necessary). |
| 56 | 56 |
| 57 Address instruction_start = code->instruction_start(); | 57 Address instruction_start = code->instruction_start(); |
| 58 #ifdef DEBUG | 58 #if DCHECK_IS_ON |
| 59 Address prev_call_address = NULL; | 59 Address prev_call_address = NULL; |
| 60 #endif | 60 #endif |
| 61 DeoptimizationInputData* deopt_data = | 61 DeoptimizationInputData* deopt_data = |
| 62 DeoptimizationInputData::cast(code->deoptimization_data()); | 62 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 63 deopt_data->SetSharedFunctionInfo(Smi::FromInt(0)); | 63 deopt_data->SetSharedFunctionInfo(Smi::FromInt(0)); |
| 64 // For each LLazyBailout instruction insert a call to the corresponding | 64 // For each LLazyBailout instruction insert a call to the corresponding |
| 65 // deoptimization entry. | 65 // deoptimization entry. |
| 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::kCallSequenceLength); |
| 73 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY), | 73 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY), |
| 74 Assembler::RelocInfoNone()); | 74 Assembler::RelocInfoNone()); |
| 75 DCHECK(prev_call_address == NULL || | 75 DCHECK(prev_call_address == NULL || |
| 76 call_address >= prev_call_address + patch_size()); | 76 call_address >= prev_call_address + patch_size()); |
| 77 DCHECK(call_address + patch_size() <= code->instruction_end()); | 77 DCHECK(call_address + patch_size() <= code->instruction_end()); |
| 78 #ifdef DEBUG | 78 #if DCHECK_IS_ON |
| 79 prev_call_address = call_address; | 79 prev_call_address = call_address; |
| 80 #endif | 80 #endif |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | 85 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { |
| 86 // Set the register values. The values are not important as there are no | 86 // Set the register values. The values are not important as there are no |
| 87 // callee saved registers in JavaScript frames, so all registers are | 87 // callee saved registers in JavaScript frames, so all registers are |
| 88 // spilled. Registers rbp and rsp are set to the correct values though. | 88 // spilled. Registers rbp and rsp are set to the correct values though. |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 UNREACHABLE(); | 343 UNREACHABLE(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 | 346 |
| 347 #undef __ | 347 #undef __ |
| 348 | 348 |
| 349 | 349 |
| 350 } } // namespace v8::internal | 350 } } // namespace v8::internal |
| 351 | 351 |
| 352 #endif // V8_TARGET_ARCH_X64 | 352 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |