Change the SpilledScope scope and ...AndSpill functions on ARM so that

they do nothing.  The frame is currently always spilled, so they were
not doing anything useful.

The call sites have been left alone to mark where spills will
eventually be needed if we begin doing register allocation on ARM.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2644 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2009-08-07 08:18:31 +00:00
parent 9edc69c72f
commit 90772fa427
4 changed files with 42 additions and 97 deletions

View File

@ -34,6 +34,37 @@ namespace internal {
#define __ ACCESS_MASM(masm_)
void CodeGenerator::LoadConditionAndSpill(Expression* expression,
TypeofState typeof_state,
JumpTarget* true_target,
JumpTarget* false_target,
bool force_control) {
LoadCondition(expression, typeof_state, true_target, false_target,
force_control);
}
void CodeGenerator::LoadAndSpill(Expression* expression,
TypeofState typeof_state) {
Load(expression, typeof_state);
}
void CodeGenerator::VisitAndSpill(Statement* statement) {
Visit(statement);
}
void CodeGenerator::VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
VisitStatements(statements);
}
void Reference::GetValueAndSpill(TypeofState typeof_state) {
GetValue(typeof_state);
}
// Platform-specific inline functions.
void DeferredCode::Jump() { __ jmp(&entry_label_); }

View File

@ -133,8 +133,7 @@ CodeGenerator::CodeGenerator(int buffer_size, Handle<Script> script,
allocator_(NULL),
cc_reg_(al),
state_(NULL),
function_return_is_shadowed_(false),
in_spilled_code_(false) {
function_return_is_shadowed_(false) {
}
@ -156,7 +155,6 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) {
ASSERT(frame_ == NULL);
frame_ = new VirtualFrame();
cc_reg_ = al;
set_in_spilled_code(false);
{
CodeGenState state(this);
@ -423,22 +421,6 @@ MemOperand CodeGenerator::ContextSlotOperandCheckExtensions(
}
void CodeGenerator::LoadConditionAndSpill(Expression* expression,
TypeofState typeof_state,
JumpTarget* true_target,
JumpTarget* false_target,
bool force_control) {
ASSERT(in_spilled_code());
set_in_spilled_code(false);
LoadCondition(expression, typeof_state, true_target, false_target,
force_control);
if (frame_ != NULL) {
frame_->SpillAll();
}
set_in_spilled_code(true);
}
// Loads a value on TOS. If it is a boolean value, the result may have been
// (partially) translated into branches, or it may have set the condition
// code register. If force_cc is set, the value is forced to set the
@ -450,7 +432,6 @@ void CodeGenerator::LoadCondition(Expression* x,
JumpTarget* true_target,
JumpTarget* false_target,
bool force_cc) {
ASSERT(!in_spilled_code());
ASSERT(!has_cc());
int original_height = frame_->height();
@ -484,21 +465,10 @@ void CodeGenerator::LoadCondition(Expression* x,
}
void CodeGenerator::LoadAndSpill(Expression* expression,
TypeofState typeof_state) {
ASSERT(in_spilled_code());
set_in_spilled_code(false);
Load(expression, typeof_state);
frame_->SpillAll();
set_in_spilled_code(true);
}
void CodeGenerator::Load(Expression* x, TypeofState typeof_state) {
#ifdef DEBUG
int original_height = frame_->height();
#endif
ASSERT(!in_spilled_code());
JumpTarget true_target;
JumpTarget false_target;
LoadCondition(x, typeof_state, &true_target, &false_target, false);
@ -1146,28 +1116,6 @@ void CodeGenerator::CheckStack() {
}
void CodeGenerator::VisitAndSpill(Statement* statement) {
ASSERT(in_spilled_code());
set_in_spilled_code(false);
Visit(statement);
if (frame_ != NULL) {
frame_->SpillAll();
}
set_in_spilled_code(true);
}
void CodeGenerator::VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
ASSERT(in_spilled_code());
set_in_spilled_code(false);
VisitStatements(statements);
if (frame_ != NULL) {
frame_->SpillAll();
}
set_in_spilled_code(true);
}
void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
#ifdef DEBUG
int original_height = frame_->height();
@ -1764,7 +1712,6 @@ void CodeGenerator::VisitForInStatement(ForInStatement* node) {
#ifdef DEBUG
int original_height = frame_->height();
#endif
ASSERT(!in_spilled_code());
VirtualFrame::SpilledScope spilled_scope;
Comment cmnt(masm_, "[ ForInStatement");
CodeForStatementPosition(node);
@ -2822,7 +2769,6 @@ void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) {
#ifdef DEBUG
int original_height = frame_->height();
#endif
ASSERT(!in_spilled_code());
VirtualFrame::SpilledScope spilled_scope;
// Call runtime routine to allocate the catch extension object and
// assign the exception value to the catch variable.
@ -4158,17 +4104,7 @@ Handle<String> Reference::GetName() {
}
void Reference::GetValueAndSpill(TypeofState typeof_state) {
ASSERT(cgen_->in_spilled_code());
cgen_->set_in_spilled_code(false);
GetValue(typeof_state);
cgen_->frame()->SpillAll();
cgen_->set_in_spilled_code(true);
}
void Reference::GetValue(TypeofState typeof_state) {
ASSERT(!cgen_->in_spilled_code());
ASSERT(cgen_->HasValidEntryRegisters());
ASSERT(!is_illegal());
ASSERT(!cgen_->has_cc());

View File

@ -183,9 +183,6 @@ class CodeGenerator: public AstVisitor {
void AddDeferred(DeferredCode* code) { deferred_.Add(code); }
bool in_spilled_code() const { return in_spilled_code_; }
void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; }
static const int kUnknownIntValue = -1;
private:
@ -222,11 +219,11 @@ class CodeGenerator: public AstVisitor {
// reach the end of the statement (ie, it does not exit via break,
// continue, return, or throw). This function is used temporarily while
// the code generator is being transformed.
void VisitAndSpill(Statement* statement);
inline void VisitAndSpill(Statement* statement);
// Visit a list of statements and then spill the virtual frame if control
// flow can reach the end of the list.
void VisitStatementsAndSpill(ZoneList<Statement*>* statements);
inline void VisitStatementsAndSpill(ZoneList<Statement*>* statements);
// Main code generation function
void GenCode(FunctionLiteral* fun);
@ -263,17 +260,17 @@ class CodeGenerator: public AstVisitor {
// Generate code to push the value of an expression on top of the frame
// and then spill the frame fully to memory. This function is used
// temporarily while the code generator is being transformed.
void LoadAndSpill(Expression* expression,
TypeofState typeof_state = NOT_INSIDE_TYPEOF);
inline void LoadAndSpill(Expression* expression,
TypeofState typeof_state = NOT_INSIDE_TYPEOF);
// Call LoadCondition and then spill the virtual frame unless control flow
// cannot reach the end of the expression (ie, by emitting only
// unconditional jumps to the control targets).
void LoadConditionAndSpill(Expression* expression,
TypeofState typeof_state,
JumpTarget* true_target,
JumpTarget* false_target,
bool force_control);
inline void LoadConditionAndSpill(Expression* expression,
TypeofState typeof_state,
JumpTarget* true_target,
JumpTarget* false_target,
bool force_control);
// Read a value from a slot and leave it on top of the expression stack.
void LoadFromSlot(Slot* slot, TypeofState typeof_state);
@ -405,12 +402,6 @@ class CodeGenerator: public AstVisitor {
// to some unlinking code).
bool function_return_is_shadowed_;
// True when we are in code that expects the virtual frame to be fully
// spilled. Some virtual frame function are disabled in DEBUG builds when
// called from spilled code, because they do not leave the virtual frame
// in a spilled state.
bool in_spilled_code_;
static InlineRuntimeLUT kInlineRuntimeLUT[];
friend class VirtualFrame;

View File

@ -52,20 +52,7 @@ class VirtualFrame : public ZoneObject {
// generator is being transformed.
class SpilledScope BASE_EMBEDDED {
public:
SpilledScope() : previous_state_(cgen()->in_spilled_code()) {
ASSERT(cgen()->has_valid_frame());
cgen()->frame()->SpillAll();
cgen()->set_in_spilled_code(true);
}
~SpilledScope() {
cgen()->set_in_spilled_code(previous_state_);
}
private:
bool previous_state_;
CodeGenerator* cgen() { return CodeGeneratorScope::Current(); }
SpilledScope() {}
};
// An illegal index into the virtual frame.