Index: src/ia32/codegen-ia32.cc |
=================================================================== |
--- src/ia32/codegen-ia32.cc (revision 4271) |
+++ src/ia32/codegen-ia32.cc (working copy) |
@@ -490,7 +490,11 @@ |
Load(expr); |
Result value = frame_->Pop(); |
ASSERT(frame_->HasNoUntaggedInt32Elements()); |
- ConvertInt32ResultToNumber(&value); |
+ if (expr->GuaranteedSmiResult()) { |
+ ConvertInt32ResultToSmi(&value); |
+ } else { |
+ ConvertInt32ResultToNumber(&value); |
+ } |
set_in_safe_int32_mode(false); |
set_unsafe_bailout(NULL); |
frame_->Push(&value); |
@@ -504,6 +508,19 @@ |
} |
+void CodeGenerator::ConvertInt32ResultToSmi(Result* value) { |
+ ASSERT(value->is_untagged_int32()); |
+ if (value->is_register()) { |
+ __ add(value->reg(), Operand(value->reg())); |
+ } else { |
+ ASSERT(value->is_constant()); |
+ ASSERT(value->handle()->IsSmi()); |
+ } |
+ value->set_untagged_int32(false); |
+ value->set_number_info(NumberInfo::Smi()); |
+} |
+ |
+ |
void CodeGenerator::ConvertInt32ResultToNumber(Result* value) { |
ASSERT(value->is_untagged_int32()); |
if (value->is_register()) { |
@@ -552,6 +569,7 @@ |
ASSERT(value->is_constant()); |
} |
value->set_untagged_int32(false); |
+ value->set_number_info(NumberInfo::Integer32()); |
} |