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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 pos_before - reloc_info_writer.pos()); | 109 pos_before - reloc_info_writer.pos()); |
110 } | 110 } |
111 // Replace relocation information on the code object. | 111 // Replace relocation information on the code object. |
112 code->set_relocation_info(*new_reloc); | 112 code->set_relocation_info(*new_reloc); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { | 117 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { |
118 Address code_start_address = code->instruction_start(); | 118 Address code_start_address = code->instruction_start(); |
| 119 |
| 120 if (FLAG_zap_code_space) { |
| 121 // Fail hard and early if we enter this code object again. |
| 122 byte* pointer = code->FindCodeAgeSequence(); |
| 123 if (pointer != NULL) { |
| 124 pointer += kNoCodeAgeSequenceLength; |
| 125 } else { |
| 126 pointer = code->instruction_start(); |
| 127 } |
| 128 CodePatcher patcher(pointer, 1); |
| 129 patcher.masm()->int3(); |
| 130 |
| 131 DeoptimizationInputData* data = |
| 132 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 133 int osr_offset = data->OsrPcOffset()->value(); |
| 134 if (osr_offset > 0) { |
| 135 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1); |
| 136 osr_patcher.masm()->int3(); |
| 137 } |
| 138 } |
| 139 |
119 // We will overwrite the code's relocation info in-place. Relocation info | 140 // We will overwrite the code's relocation info in-place. Relocation info |
120 // is written backward. The relocation info is the payload of a byte | 141 // is written backward. The relocation info is the payload of a byte |
121 // array. Later on we will slide this to the start of the byte array and | 142 // array. Later on we will slide this to the start of the byte array and |
122 // create a filler object in the remaining space. | 143 // create a filler object in the remaining space. |
123 ByteArray* reloc_info = code->relocation_info(); | 144 ByteArray* reloc_info = code->relocation_info(); |
124 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); | 145 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); |
125 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); | 146 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); |
126 | 147 |
127 // For each LLazyBailout instruction insert a call to the corresponding | 148 // For each LLazyBailout instruction insert a call to the corresponding |
128 // deoptimization entry. | 149 // deoptimization entry. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 SetFrameSlot(offset, value); | 460 SetFrameSlot(offset, value); |
440 } | 461 } |
441 | 462 |
442 | 463 |
443 #undef __ | 464 #undef __ |
444 | 465 |
445 | 466 |
446 } } // namespace v8::internal | 467 } } // namespace v8::internal |
447 | 468 |
448 #endif // V8_TARGET_ARCH_IA32 | 469 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |