Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index eff6d51e83c390beef351a1ecbe9772f6a170127..31b0d5b8b66c559004fcba7545f3d3e8db8f8444 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -974,12 +974,7 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) { |
} else if (v->IsIsObject()) { |
HIsObject* compare = HIsObject::cast(v); |
ASSERT(compare->value()->representation().IsTagged()); |
- |
- LOperand* temp1 = TempRegister(); |
- LOperand* temp2 = TempRegister(); |
- return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), |
- temp1, |
- temp2); |
+ return new LIsObjectAndBranch(UseRegisterAtStart(compare->value())); |
} else if (v->IsCompareJSObjectEq()) { |
HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
@@ -1243,26 +1238,34 @@ LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { |
LInstruction* LChunkBuilder::DoCompareJSObjectEq( |
HCompareJSObjectEq* instr) { |
- Abort("Unimplemented: %s", "DoCompareJSObjectEq"); |
- return NULL; |
+ LOperand* left = UseRegisterAtStart(instr->left()); |
+ LOperand* right = UseRegisterAtStart(instr->right()); |
+ LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right); |
+ return DefineAsRegister(result); |
} |
LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { |
- Abort("Unimplemented: %s", "DoIsNull"); |
- return NULL; |
+ ASSERT(instr->value()->representation().IsTagged()); |
+ LOperand* value = UseRegisterAtStart(instr->value()); |
+ |
+ return DefineAsRegister(new LIsNull(value)); |
} |
LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { |
- Abort("Unimplemented: %s", "DoIsObject"); |
- return NULL; |
+ ASSERT(instr->value()->representation().IsTagged()); |
+ LOperand* value = UseRegister(instr->value()); |
+ |
+ return DefineAsRegister(new LIsObject(value)); |
} |
LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { |
- Abort("Unimplemented: %s", "DoIsSmi"); |
- return NULL; |
+ ASSERT(instr->value()->representation().IsTagged()); |
+ LOperand* value = UseAtStart(instr->value()); |
+ |
+ return DefineAsRegister(new LIsSmi(value)); |
} |
@@ -1316,7 +1319,62 @@ LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
- Abort("Unimplemented: %s", "DoChange"); |
+ Representation from = instr->from(); |
+ Representation to = instr->to(); |
+ if (from.IsTagged()) { |
+ if (to.IsDouble()) { |
+ LOperand* value = UseRegister(instr->value()); |
+ LNumberUntagD* res = new LNumberUntagD(value); |
+ return AssignEnvironment(DefineAsRegister(res)); |
+ } else { |
+ ASSERT(to.IsInteger32()); |
+ LOperand* value = UseRegister(instr->value()); |
+ bool needs_check = !instr->value()->type().IsSmi(); |
+ if (needs_check) { |
+ LOperand* xmm_temp = |
+ (instr->CanTruncateToInt32() && CpuFeatures::IsSupported(SSE3)) |
+ ? NULL |
+ : FixedTemp(xmm1); |
+ LTaggedToI* res = new LTaggedToI(value, xmm_temp); |
+ return AssignEnvironment(DefineSameAsFirst(res)); |
+ } else { |
+ return DefineSameAsFirst(new LSmiUntag(value, needs_check)); |
+ } |
+ } |
+ } else if (from.IsDouble()) { |
+ if (to.IsTagged()) { |
+ LOperand* value = UseRegister(instr->value()); |
+ LOperand* temp = TempRegister(); |
+ |
+ // Make sure that temp and result_temp are different registers. |
+ LUnallocated* result_temp = TempRegister(); |
+ LNumberTagD* result = new LNumberTagD(value, temp); |
+ return AssignPointerMap(Define(result, result_temp)); |
+ } else { |
+ ASSERT(to.IsInteger32()); |
+ bool needs_temp = instr->CanTruncateToInt32() && |
+ !CpuFeatures::IsSupported(SSE3); |
+ LOperand* value = needs_temp ? |
+ UseTempRegister(instr->value()) : UseRegister(instr->value()); |
+ LOperand* temp = needs_temp ? TempRegister() : NULL; |
+ return AssignEnvironment(DefineAsRegister(new LDoubleToI(value, temp))); |
+ } |
+ } else if (from.IsInteger32()) { |
+ if (to.IsTagged()) { |
+ HValue* val = instr->value(); |
+ LOperand* value = UseRegister(val); |
+ if (val->HasRange() && val->range()->IsInSmiRange()) { |
+ return DefineSameAsFirst(new LSmiTag(value)); |
+ } else { |
+ LNumberTagI* result = new LNumberTagI(value); |
+ return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
+ } |
+ } else { |
+ ASSERT(to.IsDouble()); |
+ return DefineAsRegister(new LInteger32ToDouble(Use(instr->value()))); |
+ } |
+ } |
+ UNREACHABLE(); |
return NULL; |
} |