Commit acc4edea authored by sanjoy@chromium.org's avatar sanjoy@chromium.org

MIPS: Defer creating Handles for HConstants to the code generation phase.

Port r12048 (b4b20305)

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10692193
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12080 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 65e7a149
...@@ -292,7 +292,8 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { ...@@ -292,7 +292,8 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) {
return ToRegister(op->index()); return ToRegister(op->index());
} else if (op->IsConstantOperand()) { } else if (op->IsConstantOperand()) {
LConstantOperand* const_op = LConstantOperand::cast(op); LConstantOperand* const_op = LConstantOperand::cast(op);
Handle<Object> literal = chunk_->LookupLiteral(const_op); HConstant* constant = chunk_->LookupConstant(const_op);
Handle<Object> literal = constant->handle();
Representation r = chunk_->LookupLiteralRepresentation(const_op); Representation r = chunk_->LookupLiteralRepresentation(const_op);
if (r.IsInteger32()) { if (r.IsInteger32()) {
ASSERT(literal->IsNumber()); ASSERT(literal->IsNumber());
...@@ -330,7 +331,8 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, ...@@ -330,7 +331,8 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op,
return ToDoubleRegister(op->index()); return ToDoubleRegister(op->index());
} else if (op->IsConstantOperand()) { } else if (op->IsConstantOperand()) {
LConstantOperand* const_op = LConstantOperand::cast(op); LConstantOperand* const_op = LConstantOperand::cast(op);
Handle<Object> literal = chunk_->LookupLiteral(const_op); HConstant* constant = chunk_->LookupConstant(const_op);
Handle<Object> literal = constant->handle();
Representation r = chunk_->LookupLiteralRepresentation(const_op); Representation r = chunk_->LookupLiteralRepresentation(const_op);
if (r.IsInteger32()) { if (r.IsInteger32()) {
ASSERT(literal->IsNumber()); ASSERT(literal->IsNumber());
...@@ -354,9 +356,9 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, ...@@ -354,9 +356,9 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op,
Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const {
Handle<Object> literal = chunk_->LookupLiteral(op); HConstant* constant = chunk_->LookupConstant(op);
ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged());
return literal; return constant->handle();
} }
...@@ -366,33 +368,33 @@ bool LCodeGen::IsInteger32(LConstantOperand* op) const { ...@@ -366,33 +368,33 @@ bool LCodeGen::IsInteger32(LConstantOperand* op) const {
int LCodeGen::ToInteger32(LConstantOperand* op) const { int LCodeGen::ToInteger32(LConstantOperand* op) const {
Handle<Object> value = chunk_->LookupLiteral(op); HConstant* constant = chunk_->LookupConstant(op);
ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32()); ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32());
ASSERT(static_cast<double>(static_cast<int32_t>(value->Number())) == ASSERT(constant->HasInteger32Value());
value->Number()); return constant->Integer32Value();
return static_cast<int32_t>(value->Number());
} }
double LCodeGen::ToDouble(LConstantOperand* op) const { double LCodeGen::ToDouble(LConstantOperand* op) const {
Handle<Object> value = chunk_->LookupLiteral(op); HConstant* constant = chunk_->LookupConstant(op);
return value->Number(); ASSERT(constant->HasDoubleValue());
return constant->DoubleValue();
} }
Operand LCodeGen::ToOperand(LOperand* op) { Operand LCodeGen::ToOperand(LOperand* op) {
if (op->IsConstantOperand()) { if (op->IsConstantOperand()) {
LConstantOperand* const_op = LConstantOperand::cast(op); LConstantOperand* const_op = LConstantOperand::cast(op);
Handle<Object> literal = chunk_->LookupLiteral(const_op); HConstant* constant = chunk()->LookupConstant(const_op);
Representation r = chunk_->LookupLiteralRepresentation(const_op); Representation r = chunk_->LookupLiteralRepresentation(const_op);
if (r.IsInteger32()) { if (r.IsInteger32()) {
ASSERT(literal->IsNumber()); ASSERT(constant->HasInteger32Value());
return Operand(static_cast<int32_t>(literal->Number())); return Operand(constant->Integer32Value());
} else if (r.IsDouble()) { } else if (r.IsDouble()) {
Abort("ToOperand Unsupported double immediate."); Abort("ToOperand Unsupported double immediate.");
} }
ASSERT(r.IsTagged()); ASSERT(r.IsTagged());
return Operand(literal); return Operand(constant->handle());
} else if (op->IsRegister()) { } else if (op->IsRegister()) {
return Operand(ToRegister(op)); return Operand(ToRegister(op));
} else if (op->IsDoubleRegister()) { } else if (op->IsDoubleRegister()) {
...@@ -521,8 +523,8 @@ void LCodeGen::AddToTranslation(Translation* translation, ...@@ -521,8 +523,8 @@ void LCodeGen::AddToTranslation(Translation* translation,
DoubleRegister reg = ToDoubleRegister(op); DoubleRegister reg = ToDoubleRegister(op);
translation->StoreDoubleRegister(reg); translation->StoreDoubleRegister(reg);
} else if (op->IsConstantOperand()) { } else if (op->IsConstantOperand()) {
Handle<Object> literal = chunk()->LookupLiteral(LConstantOperand::cast(op)); HConstant* constant = chunk()->LookupConstant(LConstantOperand::cast(op));
int src_index = DefineDeoptimizationLiteral(literal); int src_index = DefineDeoptimizationLiteral(constant->handle());
translation->StoreLiteral(src_index); translation->StoreLiteral(src_index);
} else { } else {
UNREACHABLE(); UNREACHABLE();
......
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