| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/codegen.h" | 5 #include "src/codegen.h" |
| 6 #include "src/deoptimizer.h" | 6 #include "src/deoptimizer.h" |
| 7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
| 8 #include "src/register-configuration.h" | 8 #include "src/register-configuration.h" |
| 9 #include "src/safepoint-table.h" | 9 #include "src/safepoint-table.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 code->InvalidateRelocation(); | 38 code->InvalidateRelocation(); |
| 39 | 39 |
| 40 if (FLAG_zap_code_space) { | 40 if (FLAG_zap_code_space) { |
| 41 // Fail hard and early if we enter this code object again. | 41 // Fail hard and early if we enter this code object again. |
| 42 byte* pointer = code->FindCodeAgeSequence(); | 42 byte* pointer = code->FindCodeAgeSequence(); |
| 43 if (pointer != NULL) { | 43 if (pointer != NULL) { |
| 44 pointer += kNoCodeAgeSequenceLength; | 44 pointer += kNoCodeAgeSequenceLength; |
| 45 } else { | 45 } else { |
| 46 pointer = code->instruction_start(); | 46 pointer = code->instruction_start(); |
| 47 } | 47 } |
| 48 CodePatcher patcher(pointer, 1); | 48 CodePatcher patcher(isolate, pointer, 1); |
| 49 patcher.masm()->bkpt(0); | 49 patcher.masm()->bkpt(0); |
| 50 | 50 |
| 51 DeoptimizationInputData* data = | 51 DeoptimizationInputData* data = |
| 52 DeoptimizationInputData::cast(code->deoptimization_data()); | 52 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 53 int osr_offset = data->OsrPcOffset()->value(); | 53 int osr_offset = data->OsrPcOffset()->value(); |
| 54 if (osr_offset > 0) { | 54 if (osr_offset > 0) { |
| 55 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1); | 55 CodePatcher osr_patcher(isolate, code->instruction_start() + osr_offset, |
| 56 1); |
| 56 osr_patcher.masm()->bkpt(0); | 57 osr_patcher.masm()->bkpt(0); |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 | 60 |
| 60 DeoptimizationInputData* deopt_data = | 61 DeoptimizationInputData* deopt_data = |
| 61 DeoptimizationInputData::cast(code->deoptimization_data()); | 62 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 62 #ifdef DEBUG | 63 #ifdef DEBUG |
| 63 Address prev_call_address = NULL; | 64 Address prev_call_address = NULL; |
| 64 #endif | 65 #endif |
| 65 // For each LLazyBailout instruction insert a call to the corresponding | 66 // For each LLazyBailout instruction insert a call to the corresponding |
| 66 // deoptimization entry. | 67 // deoptimization entry. |
| 67 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 68 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
| 68 if (deopt_data->Pc(i)->value() == -1) continue; | 69 if (deopt_data->Pc(i)->value() == -1) continue; |
| 69 Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 70 Address call_address = code_start_address + deopt_data->Pc(i)->value(); |
| 70 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); | 71 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); |
| 71 // We need calls to have a predictable size in the unoptimized code, but | 72 // We need calls to have a predictable size in the unoptimized code, but |
| 72 // this is optimized code, so we don't have to have a predictable size. | 73 // this is optimized code, so we don't have to have a predictable size. |
| 73 int call_size_in_bytes = MacroAssembler::CallSizeNotPredictableCodeSize( | 74 int call_size_in_bytes = MacroAssembler::CallSizeNotPredictableCodeSize( |
| 74 deopt_entry, kRelocInfo_NONEPTR); | 75 deopt_entry, kRelocInfo_NONEPTR); |
| 75 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; | 76 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; |
| 76 DCHECK(call_size_in_bytes % Assembler::kInstrSize == 0); | 77 DCHECK(call_size_in_bytes % Assembler::kInstrSize == 0); |
| 77 DCHECK(call_size_in_bytes <= patch_size()); | 78 DCHECK(call_size_in_bytes <= patch_size()); |
| 78 CodePatcher patcher(call_address, call_size_in_words); | 79 CodePatcher patcher(isolate, call_address, call_size_in_words); |
| 79 patcher.masm()->Call(deopt_entry, kRelocInfo_NONEPTR); | 80 patcher.masm()->Call(deopt_entry, kRelocInfo_NONEPTR); |
| 80 DCHECK(prev_call_address == NULL || | 81 DCHECK(prev_call_address == NULL || |
| 81 call_address >= prev_call_address + patch_size()); | 82 call_address >= prev_call_address + patch_size()); |
| 82 DCHECK(call_address + patch_size() <= code->instruction_end()); | 83 DCHECK(call_address + patch_size() <= code->instruction_end()); |
| 83 #ifdef DEBUG | 84 #ifdef DEBUG |
| 84 prev_call_address = call_address; | 85 prev_call_address = call_address; |
| 85 #endif | 86 #endif |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 361 |
| 361 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 362 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
| 362 DCHECK(FLAG_enable_embedded_constant_pool); | 363 DCHECK(FLAG_enable_embedded_constant_pool); |
| 363 SetFrameSlot(offset, value); | 364 SetFrameSlot(offset, value); |
| 364 } | 365 } |
| 365 | 366 |
| 366 | 367 |
| 367 #undef __ | 368 #undef __ |
| 368 } // namespace internal | 369 } // namespace internal |
| 369 } // namespace v8 | 370 } // namespace v8 |
| OLD | NEW |