| Index: src/ia32/deoptimizer-ia32.cc
|
| diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc
|
| index 5300dde9a21e490eaef923710341dfa97d2c135c..546781eb87c907c98075efd2d2d8845f6eb9aa49 100644
|
| --- a/src/ia32/deoptimizer-ia32.cc
|
| +++ b/src/ia32/deoptimizer-ia32.cc
|
| @@ -116,6 +116,27 @@ void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
|
|
|
| void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) {
|
| Address code_start_address = code->instruction_start();
|
| +
|
| + if (FLAG_zap_code_space) {
|
| + // Fail hard and early if we enter this code object again.
|
| + byte* pointer = code->FindCodeAgeSequence();
|
| + if (pointer != NULL) {
|
| + pointer += kNoCodeAgeSequenceLength;
|
| + } else {
|
| + pointer = code->instruction_start();
|
| + }
|
| + CodePatcher patcher(pointer, 1);
|
| + patcher.masm()->int3();
|
| +
|
| + DeoptimizationInputData* data =
|
| + DeoptimizationInputData::cast(code->deoptimization_data());
|
| + int osr_offset = data->OsrPcOffset()->value();
|
| + if (osr_offset > 0) {
|
| + CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1);
|
| + osr_patcher.masm()->int3();
|
| + }
|
| + }
|
| +
|
| // We will overwrite the code's relocation info in-place. Relocation info
|
| // is written backward. The relocation info is the payload of a byte
|
| // array. Later on we will slide this to the start of the byte array and
|
| @@ -124,9 +145,6 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) {
|
| Address reloc_end_address = reloc_info->address() + reloc_info->Size();
|
| RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address);
|
|
|
| - // For each LLazyBailout instruction insert a call to the corresponding
|
| - // deoptimization entry.
|
| -
|
| // Since the call is a relative encoding, write new
|
| // reloc info. We do not need any of the existing reloc info because the
|
| // existing code will not be used again (we zap it in debug builds).
|
| @@ -134,9 +152,14 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) {
|
| // Emit call to lazy deoptimization at all lazy deopt points.
|
| DeoptimizationInputData* deopt_data =
|
| DeoptimizationInputData::cast(code->deoptimization_data());
|
| + SharedFunctionInfo* shared =
|
| + SharedFunctionInfo::cast(deopt_data->SharedFunctionInfo());
|
| + shared->EvictFromOptimizedCodeMap(code, "deoptimized code");
|
| #ifdef DEBUG
|
| Address prev_call_address = NULL;
|
| #endif
|
| + // For each LLazyBailout instruction insert a call to the corresponding
|
| + // deoptimization entry.
|
| for (int i = 0; i < deopt_data->DeoptCount(); i++) {
|
| if (deopt_data->Pc(i)->value() == -1) continue;
|
| // Patch lazy deoptimization entry.
|
|
|