Commit 251b1c5f authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

ARM: Remove a bunch of spilled scopes. Still a lot to go.

Review URL: http://codereview.chromium.org/2828004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4932 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0dee9a79
This diff is collapsed.
......@@ -61,9 +61,17 @@ void JumpTarget::DoJump() {
} else {
// Clone the current frame to use as the expected one at the target.
set_entry_frame(cgen()->frame());
// Zap the fall-through frame since the jump was unconditional.
RegisterFile empty;
cgen()->SetFrame(NULL, &empty);
}
if (entry_label_.is_bound()) {
// You can't jump backwards to an already bound label unless you admitted
// up front that this was a bidirectional jump target. Bidirectional jump
// targets will zap their type info when bound in case some later virtual
// frame with less precise type info branches to them.
ASSERT(direction_ != FORWARD_ONLY);
}
__ jmp(&entry_label_);
}
......@@ -83,6 +91,13 @@ void JumpTarget::DoBranch(Condition cc, Hint ignored) {
// Clone the current frame to use as the expected one at the target.
set_entry_frame(cgen()->frame());
}
if (entry_label_.is_bound()) {
// You can't branch backwards to an already bound label unless you admitted
// up front that this was a bidirectional jump target. Bidirectional jump
// targets will zap their type info when bound in case some later virtual
// frame with less precise type info branches to them.
ASSERT(direction_ != FORWARD_ONLY);
}
__ b(cc, &entry_label_);
if (cc == al) {
cgen()->DeleteFrame();
......@@ -121,6 +136,7 @@ void JumpTarget::DoBind() {
ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters());
if (cgen()->has_valid_frame()) {
if (direction_ != FORWARD_ONLY) cgen()->frame()->ForgetTypeInfo();
// If there is a current frame we can use it on the fall through.
if (!entry_frame_set_) {
entry_frame_ = *cgen()->frame();
......
......@@ -482,6 +482,32 @@ void VirtualFrame::SpillAllButCopyTOSToR0() {
}
void VirtualFrame::SpillAllButCopyTOSToR1() {
switch (top_of_stack_state_) {
case NO_TOS_REGISTERS:
__ ldr(r1, MemOperand(sp, 0));
break;
case R0_TOS:
__ push(r0);
__ mov(r1, r0);
break;
case R1_TOS:
__ push(r1);
break;
case R0_R1_TOS:
__ Push(r1, r0);
__ mov(r1, r0);
break;
case R1_R0_TOS:
__ Push(r0, r1);
break;
default:
UNREACHABLE();
}
top_of_stack_state_ = NO_TOS_REGISTERS;
}
void VirtualFrame::SpillAllButCopyTOSToR1R0() {
switch (top_of_stack_state_) {
case NO_TOS_REGISTERS:
......@@ -524,6 +550,24 @@ Register VirtualFrame::Peek() {
}
Register VirtualFrame::Peek2() {
AssertIsNotSpilled();
switch (top_of_stack_state_) {
case NO_TOS_REGISTERS:
case R0_TOS:
case R0_R1_TOS:
MergeTOSTo(R0_R1_TOS);
return r1;
case R1_TOS:
case R1_R0_TOS:
MergeTOSTo(R1_R0_TOS);
return r0;
}
UNREACHABLE();
return no_reg;
}
void VirtualFrame::Dup() {
if (SpilledScope::is_spilled()) {
__ ldr(ip, MemOperand(sp, 0));
......
......@@ -189,12 +189,15 @@ class VirtualFrame : public ZoneObject {
return (tos_known_smi_map_ & (~other->tos_known_smi_map_)) == 0;
}
inline void ForgetTypeInfo() {
tos_known_smi_map_ = 0;
}
// Detach a frame from its code generator, perhaps temporarily. This
// tells the register allocator that it is free to use frame-internal
// registers. Used when the code generator's frame is switched from this
// one to NULL by an unconditional jump.
void DetachFromCodeGenerator() {
AssertIsSpilled();
}
// (Re)attach a frame to its code generator. This informs the register
......@@ -202,7 +205,6 @@ class VirtualFrame : public ZoneObject {
// Used when a code generator's frame is switched from NULL to this one by
// binding a label.
void AttachToCodeGenerator() {
AssertIsSpilled();
}
// Emit code for the physical JS entry and exit frame sequences. After
......@@ -330,6 +332,10 @@ class VirtualFrame : public ZoneObject {
// must be copied to a scratch register before modification.
Register Peek();
// Look at the value beneath the top of the stack. The register returned is
// aliased and must be copied to a scratch register before modification.
Register Peek2();
// Duplicate the top of stack.
void Dup();
......@@ -339,6 +345,9 @@ class VirtualFrame : public ZoneObject {
// Flushes all registers, but it puts a copy of the top-of-stack in r0.
void SpillAllButCopyTOSToR0();
// Flushes all registers, but it puts a copy of the top-of-stack in r1.
void SpillAllButCopyTOSToR1();
// Flushes all registers, but it puts a copy of the top-of-stack in r1
// and the next value on the stack in r0.
void SpillAllButCopyTOSToR1R0();
......
......@@ -45,7 +45,9 @@ SwitchStatement::SwitchStatement(ZoneStringList* labels)
IterationStatement::IterationStatement(ZoneStringList* labels)
: BreakableStatement(labels, TARGET_FOR_ANONYMOUS), body_(NULL) {
: BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
body_(NULL),
continue_target_(JumpTarget::BIDIRECTIONAL) {
}
......
......@@ -196,6 +196,8 @@ class BreakTarget : public JumpTarget {
public:
// Construct a break target.
BreakTarget() {}
explicit BreakTarget(JumpTarget::Directionality direction)
: JumpTarget(direction) { }
virtual ~BreakTarget() {}
......
......@@ -36,16 +36,20 @@ namespace internal {
// Construct a jump target.
JumpTarget::JumpTarget(Directionality direction)
: entry_frame_set_(false),
direction_(direction),
entry_frame_(kInvalidVirtualFrameInitializer) {
}
JumpTarget::JumpTarget()
: entry_frame_set_(false),
direction_(FORWARD_ONLY),
entry_frame_(kInvalidVirtualFrameInitializer) {
}
BreakTarget::BreakTarget() { }
BreakTarget::BreakTarget(JumpTarget::Directionality direction)
: JumpTarget(direction) { }
} } // namespace v8::internal
......
......@@ -120,6 +120,9 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
// Has an entry frame been found?
bool entry_frame_set_;
// Can we branch backwards to this label?
Directionality direction_;
// The frame used on entry to the block and expected at backward
// jumps to the block. Set the first time something branches to this
// jump target.
......@@ -150,6 +153,7 @@ class BreakTarget : public JumpTarget {
public:
// Construct a break target.
inline BreakTarget();
inline BreakTarget(JumpTarget::Directionality direction);
virtual ~BreakTarget() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment