Reduce some code duplication
R=svenpanne@chromium.org Review URL: https://chromiumcodereview.appspot.com/22732006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16130 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d435819e36
commit
5f9ff709f0
@ -1285,12 +1285,12 @@ static HValue* SimplifiedDividendForMathFloorOfDiv(HValue* dividend) {
|
||||
|
||||
|
||||
HValue* HUnaryMathOperation::Canonicalize() {
|
||||
if (op() == kMathRound) {
|
||||
if (op() == kMathRound || op() == kMathFloor) {
|
||||
HValue* val = value();
|
||||
if (val->IsChange()) val = HChange::cast(val)->value();
|
||||
|
||||
// If the input is integer32 then we replace the round instruction
|
||||
// with its input.
|
||||
// If the input is smi or integer32 then we replace the instruction with its
|
||||
// input.
|
||||
if (val->representation().IsSmiOrInteger32()) {
|
||||
if (!val->representation().Equals(representation())) {
|
||||
HChange* result = new(block()->zone()) HChange(
|
||||
@ -1305,19 +1305,6 @@ HValue* HUnaryMathOperation::Canonicalize() {
|
||||
if (op() == kMathFloor) {
|
||||
HValue* val = value();
|
||||
if (val->IsChange()) val = HChange::cast(val)->value();
|
||||
|
||||
// If the input is integer32 then we replace the floor instruction
|
||||
// with its input.
|
||||
if (val->representation().IsSmiOrInteger32()) {
|
||||
if (!val->representation().Equals(representation())) {
|
||||
HChange* result = new(block()->zone()) HChange(
|
||||
val, representation(), false, false, false);
|
||||
result->InsertBefore(this);
|
||||
return result;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
if (val->IsDiv() && (val->UseCount() == 1)) {
|
||||
HDiv* hdiv = HDiv::cast(val);
|
||||
HValue* left = hdiv->left();
|
||||
|
Loading…
Reference in New Issue
Block a user