 Chromium Code Reviews
 Chromium Code Reviews Issue 10544196:
  Defer creating Handles for HConstants to the code generation phase.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 10544196:
  Defer creating Handles for HConstants to the code generation phase.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/arm/lithium-codegen-arm.cc | 
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc | 
| index 36c67d00bb37b415eb37db958f5271631e999bff..6d033339ab4aebcbecf126962422809036ff1d5e 100644 | 
| --- a/src/arm/lithium-codegen-arm.cc | 
| +++ b/src/arm/lithium-codegen-arm.cc | 
| @@ -322,7 +322,8 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { | 
| return ToRegister(op->index()); | 
| } else if (op->IsConstantOperand()) { | 
| 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); | 
| if (r.IsInteger32()) { | 
| ASSERT(literal->IsNumber()); | 
| @@ -360,7 +361,8 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, | 
| return ToDoubleRegister(op->index()); | 
| } else if (op->IsConstantOperand()) { | 
| 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); | 
| if (r.IsInteger32()) { | 
| ASSERT(literal->IsNumber()); | 
| @@ -386,9 +388,8 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, | 
| Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 
| - Handle<Object> literal = chunk_->LookupLiteral(op); | 
| - ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); | 
| - return literal; | 
| + HConstant* constant = chunk_->LookupConstant(op); | 
| 
Michael Starzinger
2012/07/11 09:16:10
We should keep the assertion that the representati
 
sanjoy
2012/07/11 10:54:08
Done.
 | 
| + return constant->handle(); | 
| } | 
| @@ -398,33 +399,33 @@ bool LCodeGen::IsInteger32(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(static_cast<double>(static_cast<int32_t>(value->Number())) == | 
| - value->Number()); | 
| - return static_cast<int32_t>(value->Number()); | 
| + ASSERT(constant->HasInteger32Value()); | 
| + return constant->Integer32Value(); | 
| } | 
| double LCodeGen::ToDouble(LConstantOperand* op) const { | 
| - Handle<Object> value = chunk_->LookupLiteral(op); | 
| - return value->Number(); | 
| + HConstant* constant = chunk_->LookupConstant(op); | 
| + ASSERT(constant->HasDoubleValue()); | 
| + return constant->DoubleValue(); | 
| } | 
| Operand LCodeGen::ToOperand(LOperand* op) { | 
| if (op->IsConstantOperand()) { | 
| 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); | 
| if (r.IsInteger32()) { | 
| - ASSERT(literal->IsNumber()); | 
| - return Operand(static_cast<int32_t>(literal->Number())); | 
| + ASSERT(constant->HasInteger32Value()); | 
| + return Operand(constant->Integer32Value()); | 
| } else if (r.IsDouble()) { | 
| Abort("ToOperand Unsupported double immediate."); | 
| } | 
| ASSERT(r.IsTagged()); | 
| - return Operand(literal); | 
| + return Operand(constant->handle()); | 
| } else if (op->IsRegister()) { | 
| return Operand(ToRegister(op)); | 
| } else if (op->IsDoubleRegister()) { | 
| @@ -553,8 +554,8 @@ void LCodeGen::AddToTranslation(Translation* translation, | 
| DoubleRegister reg = ToDoubleRegister(op); | 
| translation->StoreDoubleRegister(reg); | 
| } else if (op->IsConstantOperand()) { | 
| - Handle<Object> literal = chunk()->LookupLiteral(LConstantOperand::cast(op)); | 
| - int src_index = DefineDeoptimizationLiteral(literal); | 
| + HConstant* constant = chunk()->LookupConstant(LConstantOperand::cast(op)); | 
| + int src_index = DefineDeoptimizationLiteral(constant->handle()); | 
| translation->StoreLiteral(src_index); | 
| } else { | 
| UNREACHABLE(); |