Commit 6479ea33 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Eliminate Smi check when changing from Smi to Integer32

BUG=
R=verwaest@chromium.org

Review URL: https://chromiumcodereview.appspot.com/22824003

Patch from Weiliang Lin <weiliang.lin2@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16362 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 78881124
......@@ -1925,11 +1925,12 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
ASSERT(to.IsInteger32());
LOperand* value = NULL;
LInstruction* res = NULL;
if (instr->value()->type().IsSmi()) {
value = UseRegisterAtStart(instr->value());
HValue* val = instr->value();
if (val->type().IsSmi() || val->representation().IsSmi()) {
value = UseRegisterAtStart(val);
res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
} else {
value = UseRegister(instr->value());
value = UseRegister(val);
LOperand* temp1 = TempRegister();
LOperand* temp2 = FixedTemp(d11);
res = DefineSameAsFirst(new(zone()) LTaggedToI(value,
......
......@@ -1945,13 +1945,14 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
} else {
ASSERT(to.IsInteger32());
if (instr->value()->type().IsSmi()) {
LOperand* value = UseRegister(instr->value());
HValue* val = instr->value();
if (val->type().IsSmi() || val->representation().IsSmi()) {
LOperand* value = UseRegister(val);
return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
} else {
bool truncating = instr->CanTruncateToInt32();
if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
LOperand* value = UseRegister(instr->value());
LOperand* value = UseRegister(val);
LOperand* xmm_temp =
(truncating && CpuFeatures::IsSupported(SSE3))
? NULL
......@@ -1959,7 +1960,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp);
return AssignEnvironment(DefineSameAsFirst(res));
} else {
LOperand* value = UseFixed(instr->value(), ecx);
LOperand* value = UseFixed(val, ecx);
LTaggedToINoSSE2* res =
new(zone()) LTaggedToINoSSE2(value, TempRegister(),
TempRegister(), TempRegister());
......
......@@ -1843,8 +1843,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
} else {
ASSERT(to.IsInteger32());
LOperand* value = UseRegister(instr->value());
if (instr->value()->type().IsSmi()) {
HValue* val = instr->value();
LOperand* value = UseRegister(val);
if (val->type().IsSmi() || val->representation().IsSmi()) {
return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
} else {
bool truncating = instr->CanTruncateToInt32();
......
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