OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 20 matching lines...) Expand all Loading... |
31 code->InvalidateRelocation(); | 31 code->InvalidateRelocation(); |
32 | 32 |
33 if (FLAG_zap_code_space) { | 33 if (FLAG_zap_code_space) { |
34 // Fail hard and early if we enter this code object again. | 34 // Fail hard and early if we enter this code object again. |
35 byte* pointer = code->FindCodeAgeSequence(); | 35 byte* pointer = code->FindCodeAgeSequence(); |
36 if (pointer != NULL) { | 36 if (pointer != NULL) { |
37 pointer += kNoCodeAgeSequenceLength; | 37 pointer += kNoCodeAgeSequenceLength; |
38 } else { | 38 } else { |
39 pointer = code->instruction_start(); | 39 pointer = code->instruction_start(); |
40 } | 40 } |
41 CodePatcher patcher(pointer, 1); | 41 CodePatcher patcher(isolate, pointer, 1); |
42 patcher.masm()->break_(0xCC); | 42 patcher.masm()->break_(0xCC); |
43 | 43 |
44 DeoptimizationInputData* data = | 44 DeoptimizationInputData* data = |
45 DeoptimizationInputData::cast(code->deoptimization_data()); | 45 DeoptimizationInputData::cast(code->deoptimization_data()); |
46 int osr_offset = data->OsrPcOffset()->value(); | 46 int osr_offset = data->OsrPcOffset()->value(); |
47 if (osr_offset > 0) { | 47 if (osr_offset > 0) { |
48 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1); | 48 CodePatcher osr_patcher(isolate, code->instruction_start() + osr_offset, |
| 49 1); |
49 osr_patcher.masm()->break_(0xCC); | 50 osr_patcher.masm()->break_(0xCC); |
50 } | 51 } |
51 } | 52 } |
52 | 53 |
53 DeoptimizationInputData* deopt_data = | 54 DeoptimizationInputData* deopt_data = |
54 DeoptimizationInputData::cast(code->deoptimization_data()); | 55 DeoptimizationInputData::cast(code->deoptimization_data()); |
55 #ifdef DEBUG | 56 #ifdef DEBUG |
56 Address prev_call_address = NULL; | 57 Address prev_call_address = NULL; |
57 #endif | 58 #endif |
58 // For each LLazyBailout instruction insert a call to the corresponding | 59 // For each LLazyBailout instruction insert a call to the corresponding |
59 // deoptimization entry. | 60 // deoptimization entry. |
60 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 61 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
61 if (deopt_data->Pc(i)->value() == -1) continue; | 62 if (deopt_data->Pc(i)->value() == -1) continue; |
62 Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 63 Address call_address = code_start_address + deopt_data->Pc(i)->value(); |
63 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); | 64 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); |
64 int call_size_in_bytes = MacroAssembler::CallSize(deopt_entry, | 65 int call_size_in_bytes = MacroAssembler::CallSize(deopt_entry, |
65 RelocInfo::NONE32); | 66 RelocInfo::NONE32); |
66 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; | 67 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; |
67 DCHECK(call_size_in_bytes % Assembler::kInstrSize == 0); | 68 DCHECK(call_size_in_bytes % Assembler::kInstrSize == 0); |
68 DCHECK(call_size_in_bytes <= patch_size()); | 69 DCHECK(call_size_in_bytes <= patch_size()); |
69 CodePatcher patcher(call_address, call_size_in_words); | 70 CodePatcher patcher(isolate, call_address, call_size_in_words); |
70 patcher.masm()->Call(deopt_entry, RelocInfo::NONE32); | 71 patcher.masm()->Call(deopt_entry, RelocInfo::NONE32); |
71 DCHECK(prev_call_address == NULL || | 72 DCHECK(prev_call_address == NULL || |
72 call_address >= prev_call_address + patch_size()); | 73 call_address >= prev_call_address + patch_size()); |
73 DCHECK(call_address + patch_size() <= code->instruction_end()); | 74 DCHECK(call_address + patch_size() <= code->instruction_end()); |
74 | 75 |
75 #ifdef DEBUG | 76 #ifdef DEBUG |
76 prev_call_address = call_address; | 77 prev_call_address = call_address; |
77 #endif | 78 #endif |
78 } | 79 } |
79 } | 80 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // No embedded constant pool support. | 405 // No embedded constant pool support. |
405 UNREACHABLE(); | 406 UNREACHABLE(); |
406 } | 407 } |
407 | 408 |
408 | 409 |
409 #undef __ | 410 #undef __ |
410 | 411 |
411 | 412 |
412 } // namespace internal | 413 } // namespace internal |
413 } // namespace v8 | 414 } // namespace v8 |
OLD | NEW |