OLD | NEW |
1 | 1 |
2 // Copyright 2011 the V8 project authors. All rights reserved. | 2 // Copyright 2011 the V8 project authors. All rights reserved. |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return kCallInstructionSizeInWords * Assembler::kInstrSize; | 42 return kCallInstructionSizeInWords * Assembler::kInstrSize; |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { | 46 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { |
47 Address code_start_address = code->instruction_start(); | 47 Address code_start_address = code->instruction_start(); |
48 // Invalidate the relocation information, as it will become invalid by the | 48 // Invalidate the relocation information, as it will become invalid by the |
49 // code patching below, and is not needed any more. | 49 // code patching below, and is not needed any more. |
50 code->InvalidateRelocation(); | 50 code->InvalidateRelocation(); |
51 | 51 |
| 52 if (FLAG_zap_code_space) { |
| 53 // Fail hard and early if we enter this code object again. |
| 54 byte* pointer = code->FindCodeAgeSequence(); |
| 55 if (pointer != NULL) { |
| 56 pointer += kNoCodeAgeSequenceLength; |
| 57 } else { |
| 58 pointer = code->instruction_start(); |
| 59 } |
| 60 CodePatcher patcher(pointer, 1); |
| 61 patcher.masm()->break_(0xCC); |
| 62 |
| 63 DeoptimizationInputData* data = |
| 64 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 65 int osr_offset = data->OsrPcOffset()->value(); |
| 66 if (osr_offset > 0) { |
| 67 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1); |
| 68 osr_patcher.masm()->break_(0xCC); |
| 69 } |
| 70 } |
| 71 |
52 // For each LLazyBailout instruction insert a call to the corresponding | 72 // For each LLazyBailout instruction insert a call to the corresponding |
53 // deoptimization entry. | 73 // deoptimization entry. |
54 DeoptimizationInputData* deopt_data = | 74 DeoptimizationInputData* deopt_data = |
55 DeoptimizationInputData::cast(code->deoptimization_data()); | 75 DeoptimizationInputData::cast(code->deoptimization_data()); |
56 #ifdef DEBUG | 76 #ifdef DEBUG |
57 Address prev_call_address = NULL; | 77 Address prev_call_address = NULL; |
58 #endif | 78 #endif |
59 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 79 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
60 if (deopt_data->Pc(i)->value() == -1) continue; | 80 if (deopt_data->Pc(i)->value() == -1) continue; |
61 Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 81 Address call_address = code_start_address + deopt_data->Pc(i)->value(); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 388 |
369 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 389 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
370 SetFrameSlot(offset, value); | 390 SetFrameSlot(offset, value); |
371 } | 391 } |
372 | 392 |
373 | 393 |
374 #undef __ | 394 #undef __ |
375 | 395 |
376 | 396 |
377 } } // namespace v8::internal | 397 } } // namespace v8::internal |
OLD | NEW |