Commit 0a6ad373 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Update the gap resolver to support Smi constants.

Port r14850 (787f0941)

BUG=

Review URL: https://codereview.chromium.org/16146005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14865 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c5d0215e
......@@ -521,6 +521,12 @@ int LCodeGen::ToInteger32(LConstantOperand* op) const {
}
Smi* LCodeGen::ToSmi(LConstantOperand* op) const {
HConstant* constant = chunk_->LookupConstant(op);
return Smi::FromInt(constant->Integer32Value());
}
double LCodeGen::ToDouble(LConstantOperand* op) const {
HConstant* constant = chunk_->LookupConstant(op);
ASSERT(constant->HasDoubleValue());
......
......@@ -118,6 +118,7 @@ class LCodeGen BASE_EMBEDDED {
FloatRegister flt_scratch,
DoubleRegister dbl_scratch);
int ToInteger32(LConstantOperand* op) const;
Smi* ToSmi(LConstantOperand* op) const;
double ToDouble(LConstantOperand* op) const;
Operand ToOperand(LOperand* op);
MemOperand ToMemOperand(LOperand* op) const;
......
......@@ -252,7 +252,9 @@ void LGapResolver::EmitMove(int index) {
LConstantOperand* constant_source = LConstantOperand::cast(source);
if (destination->IsRegister()) {
Register dst = cgen_->ToRegister(destination);
if (cgen_->IsInteger32(constant_source)) {
if (cgen_->IsSmi(constant_source)) {
__ li(dst, Operand(cgen_->ToSmi(constant_source)));
} else if (cgen_->IsInteger32(constant_source)) {
__ li(dst, Operand(cgen_->ToInteger32(constant_source)));
} else {
__ LoadObject(dst, cgen_->ToHandle(constant_source));
......@@ -260,7 +262,9 @@ void LGapResolver::EmitMove(int index) {
} else {
ASSERT(destination->IsStackSlot());
ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone.
if (cgen_->IsInteger32(constant_source)) {
if (cgen_->IsSmi(constant_source)) {
__ li(kLithiumScratchReg, Operand(cgen_->ToSmi(constant_source)));
} else if (cgen_->IsInteger32(constant_source)) {
__ li(kLithiumScratchReg,
Operand(cgen_->ToInteger32(constant_source)));
} else {
......
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