Chromium Code Reviews| Index: src/arm/lithium-codegen-arm.cc |
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
| index 36aec4544625783653567becf52f1483eb42d1d5..88e38338bdbcaf05139987dc6902a2b93702bdc1 100644 |
| --- a/src/arm/lithium-codegen-arm.cc |
| +++ b/src/arm/lithium-codegen-arm.cc |
| @@ -325,47 +325,59 @@ bool LCodeGen::GenerateDeoptJumpTable() { |
| if (deopt_jump_table_.length() > 0) { |
| Comment(";;; -------------------- Jump table --------------------"); |
| - } |
| - Label table_start; |
| - __ bind(&table_start); |
| - Label needs_frame; |
| - for (int i = 0; i < deopt_jump_table_.length(); i++) { |
| - __ bind(&deopt_jump_table_[i].label); |
| - Address entry = deopt_jump_table_[i].address; |
| - Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; |
| - int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); |
| - if (id == Deoptimizer::kNotDeoptimizationEntry) { |
| - Comment(";;; jump table entry %d.", i); |
| - } else { |
| + Label table_start; |
| + __ bind(&table_start); |
| + Label needs_frame, call_l2; |
| + Address base = deopt_jump_table_[0].address; |
| + for (int i = 0; i < deopt_jump_table_.length(); i++) { |
| + __ bind(&deopt_jump_table_[i].label); |
| + Address entry = deopt_jump_table_[i].address; |
| + Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; |
| + ASSERT(type == deopt_jump_table_[0].bailout_type); |
| + int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); |
| + ASSERT(id != Deoptimizer::kNotDeoptimizationEntry); |
| Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
| - } |
| - if (deopt_jump_table_[i].needs_frame) { |
| - ASSERT(!info()->saves_caller_doubles()); |
| - __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); |
| - if (needs_frame.is_bound()) { |
| - __ b(&needs_frame); |
| + // Second-level deopt table entries are contiguous and small, so instead |
| + // of loading the full, absolute address of each one, load an immediate |
| + // offset which will be added to the base address later. |
| + __ mov(scratch0(), Operand(entry - base)); |
| + if (deopt_jump_table_[i].needs_frame) { |
| + ASSERT(!info()->saves_caller_doubles()); |
| + if (needs_frame.is_bound()) { |
| + __ b(&needs_frame); |
| + } else { |
| + __ bind(&needs_frame); |
| + __ PushFixedFrame(); |
| + // This variant of deopt can only be used with stubs. Since we don't |
| + // have a function pointer to install in the stack frame that we're |
| + // building, install a special marker there instead. |
| + ASSERT(info()->IsStub()); |
| + __ mov(ip, Operand(Smi::FromInt(StackFrame::STUB))); |
| + __ push(ip); |
| + __ add(fp, sp, |
| + Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| + // Add the base address to the offset previously loaded in scratch0. |
| + __ add(scratch0(), scratch0(), |
|
ulan
2014/06/23 11:41:40
Any reason you didn't move this out of the loop li
vincent.belliard
2014/06/23 11:52:29
Both versions generate the same number of instruct
vincent.belliard
2014/06/24 14:28:17
Done.
|
| + Operand(ExternalReference::ForDeoptEntry(base))); |
| + __ blx(scratch0()); |
| + } |
| } else { |
| - __ bind(&needs_frame); |
| - __ PushFixedFrame(); |
| - // This variant of deopt can only be used with stubs. Since we don't |
| - // have a function pointer to install in the stack frame that we're |
| - // building, install a special marker there instead. |
| - ASSERT(info()->IsStub()); |
| - __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
| - __ push(scratch0()); |
| - __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| - __ mov(lr, Operand(pc), LeaveCC, al); |
| - __ mov(pc, ip); |
| - } |
| - } else { |
| - if (info()->saves_caller_doubles()) { |
| - ASSERT(info()->IsStub()); |
| - RestoreCallerDoubles(); |
| + if (call_l2.is_bound()) { |
| + __ b(&call_l2); |
| + } else { |
| + __ bind(&call_l2); |
| + if (info()->saves_caller_doubles()) { |
| + ASSERT(info()->IsStub()); |
| + RestoreCallerDoubles(); |
| + } |
| + // Add the base address to the offset previously loaded in scratch0. |
| + __ add(scratch0(), scratch0(), |
| + Operand(ExternalReference::ForDeoptEntry(base))); |
| + __ blx(scratch0()); |
| + } |
| } |
| - __ mov(lr, Operand(pc), LeaveCC, al); |
| - __ mov(pc, Operand(ExternalReference::ForDeoptEntry(entry))); |
| + masm()->CheckConstPool(false, false); |
| } |
| - masm()->CheckConstPool(false, false); |
| } |
| // Force constant pool emission at the end of the deopt jump table to make |