Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.h |
| =================================================================== |
| --- src/ia32/lithium-codegen-ia32.h (revision 6848) |
| +++ src/ia32/lithium-codegen-ia32.h (working copy) |
| @@ -60,6 +60,7 @@ |
| status_(UNUSED), |
| deferred_(8), |
| osr_pc_offset_(-1), |
| + deoptimization_reloc_size(), |
| resolver_(this) { |
| PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| } |
| @@ -102,6 +103,20 @@ |
| // Emit frame translation commands for an environment. |
| void WriteTranslation(LEnvironment* environment, Translation* translation); |
| + void EnsureRelocSpaceForDeoptimization() { |
|
Søren Thygesen Gjesse
2011/02/22 11:58:33
Do we want this in the .h file (I guess we have no
Rico
2011/02/22 12:06:10
Moved to the cc file
|
| + // Since we patch the reloc info with RUNTIME_ENTRY calls every patch |
| + // site will take up 2 bytes + any pc-jumps. |
| + // We are conservative and always reserver 6 bytes in case where a |
| + // simple pc-jump is not enough. |
| + uint32_t pc_delta = |
| + masm()->pc_offset() - deoptimization_reloc_size.last_pc_offset; |
| + if (is_uintn(pc_delta, 6)) { |
| + deoptimization_reloc_size.min_size += 2; |
| + } else { |
| + deoptimization_reloc_size.min_size += 6; |
| + } |
| + deoptimization_reloc_size.last_pc_offset = masm()->pc_offset(); |
| + } |
| // Declare methods that deal with the individual node types. |
| #define DECLARE_DO(type) void Do##type(L##type* node); |
| LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| @@ -151,6 +166,9 @@ |
| bool GeneratePrologue(); |
| bool GenerateBody(); |
| bool GenerateDeferredCode(); |
| + // Pad the reloc info to ensure that we have enough space to patch during |
| + // deoptimization. |
| + bool GenerateRelocPadding(); |
| bool GenerateSafepointTable(); |
| void CallCode(Handle<Code> code, RelocInfo::Mode mode, LInstruction* instr, |
| @@ -251,6 +269,13 @@ |
| ZoneList<LDeferredCode*> deferred_; |
| int osr_pc_offset_; |
| + struct DeoptimizationRelocSize { |
| + int min_size; |
| + int last_pc_offset; |
| + }; |
| + |
| + DeoptimizationRelocSize deoptimization_reloc_size; |
| + |
| // Builder that keeps track of safepoints in the code. The table |
| // itself is emitted at the end of the generated code. |
| SafepointTableBuilder safepoints_; |