Revision: 22305
Author: [email protected]
Date: Wed Jul 9 14:08:13 2014 UTC
Log: ARM: sligthly reduce deopt tables size
BUG=
[email protected], [email protected]
Review URL: https://codereview.chromium.org/349243002
http://code.google.com/p/v8/source/detail?r=22305
Modified:
/branches/bleeding_edge/src/arm/deoptimizer-arm.cc
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
=======================================
--- /branches/bleeding_edge/src/arm/deoptimizer-arm.cc Wed Jun 25 12:32:12
2014 UTC
+++ /branches/bleeding_edge/src/arm/deoptimizer-arm.cc Wed Jul 9 14:08:13
2014 UTC
@@ -12,7 +12,7 @@
namespace v8 {
namespace internal {
-const int Deoptimizer::table_entry_size_ = 12;
+const int Deoptimizer::table_entry_size_ = 8;
int Deoptimizer::patch_size() {
@@ -328,11 +328,11 @@
int start = masm()->pc_offset();
USE(start);
__ mov(ip, Operand(i));
- __ push(ip);
__ b(&done);
ASSERT(masm()->pc_offset() - start == table_entry_size_);
}
__ bind(&done);
+ __ push(ip);
}
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Jul 3
17:01:14 2014 UTC
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Jul 9
14:08:13 2014 UTC
@@ -324,48 +324,79 @@
}
if (deopt_jump_table_.length() > 0) {
+ Label needs_frame, call_deopt_entry;
+
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 {
+ Address base = deopt_jump_table_[0].address;
+
+ Register entry_offset = scratch0();
+
+ int length = deopt_jump_table_.length();
+ for (int i = 0; i < length; i++) {
+ __ bind(&deopt_jump_table_[i].label);
+
+ Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type;
+ ASSERT(type == deopt_jump_table_[0].bailout_type);
+ Address entry = deopt_jump_table_[i].address;
+ 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(entry_offset, 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);
+ Comment(";;; call deopt with 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));
+ __ bind(&call_deopt_entry);
+ // Add the base address to the offset previously loaded in
+ // entry_offset.
+ __ add(entry_offset, entry_offset,
+ Operand(ExternalReference::ForDeoptEntry(base)));
+ __ blx(entry_offset);
+ }
+
+ masm()->CheckConstPool(false, false);
} 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);
+ // The last entry can fall through into `call_deopt_entry`,
avoiding a
+ // branch.
+ bool need_branch = ((i + 1) != length) ||
call_deopt_entry.is_bound();
+
+ if (need_branch) __ b(&call_deopt_entry);
+
+ masm()->CheckConstPool(false, !need_branch);
}
- } else {
+ }
+
+ if (!call_deopt_entry.is_bound()) {
+ Comment(";;; call deopt");
+ __ bind(&call_deopt_entry);
+
if (info()->saves_caller_doubles()) {
ASSERT(info()->IsStub());
RestoreCallerDoubles();
}
- __ mov(lr, Operand(pc), LeaveCC, al);
- __ mov(pc, Operand(ExternalReference::ForDeoptEntry(entry)));
+
+ // Add the base address to the offset previously loaded in
entry_offset.
+ __ add(entry_offset, entry_offset,
+ Operand(ExternalReference::ForDeoptEntry(base)));
+ __ blx(entry_offset);
}
- masm()->CheckConstPool(false, false);
}
// Force constant pool emission at the end of the deopt jump table to
make
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.