Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: src/rewriter.cc

Issue 975001: Use untagged int32 values in evaluation of side-effect free expressions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/register-allocator.h ('k') | src/virtual-frame.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/rewriter.cc
===================================================================
--- src/rewriter.cc (revision 4147)
+++ src/rewriter.cc (working copy)
@@ -266,7 +266,14 @@
func_name_inferrer_.PushName(lit_str);
}
} else if (literal->IsHeapNumber()) {
- node->set_side_effect_free(true);
+ if (node->to_int32()) {
+ // Any HeapNumber has an int32 value if it is the input to a bit op.
+ node->set_side_effect_free(true);
+ } else {
+ double double_value = HeapNumber::cast(*literal)->value();
+ int32_t int32_value = DoubleToInt32(double_value);
+ node->set_side_effect_free(double_value == int32_value);
+ }
}
}
@@ -320,6 +327,7 @@
node->type()->SetAsLikelySmiIfUnknown();
node->target()->type()->SetAsLikelySmiIfUnknown();
node->value()->type()->SetAsLikelySmiIfUnknown();
+ node->value()->set_to_int32(true);
node->value()->set_no_negative_zero(true);
break;
case Token::ASSIGN_ADD:
@@ -438,9 +446,9 @@
// Fall through.
case Token::ADD:
case Token::SUB:
- case Token::NOT:
node->set_side_effect_free(node->expression()->side_effect_free());
break;
+ case Token::NOT:
case Token::DELETE:
case Token::TYPEOF:
case Token::VOID:
@@ -553,6 +561,9 @@
case Token::SHL:
case Token::SAR:
case Token::SHR:
+ // Add one to the number of bit operations in this expression.
+ node->set_num_bit_ops(1);
+ // Fall through.
case Token::ADD:
case Token::SUB:
case Token::MUL:
@@ -560,6 +571,12 @@
case Token::MOD:
node->set_side_effect_free(node->left()->side_effect_free() &&
node->right()->side_effect_free());
+ node->set_num_bit_ops(node->num_bit_ops() +
+ node->left()->num_bit_ops() +
+ node->right()->num_bit_ops());
+ if (!node->no_negative_zero() && node->op() == Token::MUL) {
+ node->set_side_effect_free(false);
+ }
break;
default:
UNREACHABLE();
« no previous file with comments | « src/register-allocator.h ('k') | src/virtual-frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698