Commit 71d863e5 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Set a fixed scratch register for ARM code generation

r9 is now set as a fixed scratch register for ARM code generation. removed some unneeded allocation of temporary registers and use the scratch register instead.
Review URL: http://codereview.chromium.org/5976014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6162 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent aa396c57
......@@ -66,13 +66,14 @@ namespace internal {
// such that we use an enum in optimized mode, and the struct in debug
// mode. This way we get the compile-time error checking in debug mode
// and best performance in optimized code.
//
// Core register
struct Register {
static const int kNumRegisters = 16;
static const int kNumAllocatableRegisters = 8;
static int ToAllocationIndex(Register reg) {
ASSERT(reg.code() < kNumAllocatableRegisters);
return reg.code();
}
......@@ -132,7 +133,7 @@ const Register r5 = { 5 };
const Register r6 = { 6 };
const Register r7 = { 7 };
const Register r8 = { 8 }; // Used as context register.
const Register r9 = { 9 };
const Register r9 = { 9 }; // Used as lithium codegen scratch register.
const Register r10 = { 10 }; // Used as roots register.
const Register fp = { 11 };
const Register ip = { 12 };
......
......@@ -1222,7 +1222,6 @@ LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
ASSERT(compare->value()->representation().IsTagged());
return new LHasInstanceTypeAndBranch(UseRegisterAtStart(compare->value()),
TempRegister(),
first_id,
second_id);
} else if (v->IsHasCachedArrayIndex()) {
......@@ -1235,11 +1234,8 @@ LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
HIsNull* compare = HIsNull::cast(v);
ASSERT(compare->value()->representation().IsTagged());
// We only need a temp register for non-strict compare.
LOperand* temp = compare->is_strict() ? NULL : TempRegister();
return new LIsNullAndBranch(UseRegisterAtStart(compare->value()),
compare->is_strict(),
temp,
first_id,
second_id);
} else if (v->IsIsObject()) {
......@@ -1851,8 +1847,7 @@ LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
HLoadFunctionPrototype* instr) {
return AssignEnvironment(DefineAsRegister(
new LLoadFunctionPrototype(UseRegister(instr->function()),
TempRegister())));
new LLoadFunctionPrototype(UseRegister(instr->function()))));
}
......
......@@ -726,11 +726,9 @@ class LIsNullAndBranch: public LIsNull {
public:
LIsNullAndBranch(LOperand* value,
bool is_strict,
LOperand* temp,
int true_block_id,
int false_block_id)
: LIsNull(value, is_strict),
temp_(temp),
true_block_id_(true_block_id),
false_block_id_(false_block_id) { }
......@@ -741,10 +739,7 @@ class LIsNullAndBranch: public LIsNull {
int true_block_id() const { return true_block_id_; }
int false_block_id() const { return false_block_id_; }
LOperand* temp() const { return temp_; }
private:
LOperand* temp_;
int true_block_id_;
int false_block_id_;
};
......@@ -839,11 +834,9 @@ class LHasInstanceType: public LUnaryOperation {
class LHasInstanceTypeAndBranch: public LHasInstanceType {
public:
LHasInstanceTypeAndBranch(LOperand* value,
LOperand* temporary,
int true_block_id,
int false_block_id)
: LHasInstanceType(value),
temp_(temporary),
true_block_id_(true_block_id),
false_block_id_(false_block_id) { }
......@@ -855,10 +848,7 @@ class LHasInstanceTypeAndBranch: public LHasInstanceType {
int true_block_id() const { return true_block_id_; }
int false_block_id() const { return false_block_id_; }
LOperand* temp() { return temp_; }
private:
LOperand* temp_;
int true_block_id_;
int false_block_id_;
};
......@@ -1263,17 +1253,12 @@ class LLoadNamedGeneric: public LUnaryOperation {
class LLoadFunctionPrototype: public LUnaryOperation {
public:
LLoadFunctionPrototype(LOperand* function, LOperand* temporary)
: LUnaryOperation(function), temporary_(temporary) { }
LLoadFunctionPrototype(LOperand* function) : LUnaryOperation(function) { }
DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
LOperand* function() const { return input(); }
LOperand* temporary() const { return temporary_; }
private:
LOperand* temporary_;
};
......
This diff is collapsed.
......@@ -103,6 +103,8 @@ class LCodeGen BASE_EMBEDDED {
HGraph* graph() const { return chunk_->graph(); }
MacroAssembler* masm() const { return masm_; }
Register scratch0() { return r9; }
int GetNextEmittedBlock(int block);
LInstruction* GetNextInstruction();
......
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