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