OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 | 1526 |
1527 HValue* HUnaryMathOperation::Canonicalize() { | 1527 HValue* HUnaryMathOperation::Canonicalize() { |
1528 if (op() == kMathFloor) { | 1528 if (op() == kMathFloor) { |
1529 HValue* val = value(); | 1529 HValue* val = value(); |
1530 if (val->IsChange()) val = HChange::cast(val)->value(); | 1530 if (val->IsChange()) val = HChange::cast(val)->value(); |
1531 | 1531 |
1532 // If the input is integer32 then we replace the floor instruction | 1532 // If the input is integer32 then we replace the floor instruction |
1533 // with its input. | 1533 // with its input. |
1534 if (val->representation().IsInteger32()) return val; | 1534 if (val->representation().IsInteger32()) return val; |
1535 | 1535 |
1536 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_IA32) || \ | |
1537 defined(V8_TARGET_ARCH_X64) | |
1538 if (val->IsDiv() && (val->UseCount() == 1)) { | 1536 if (val->IsDiv() && (val->UseCount() == 1)) { |
1539 HDiv* hdiv = HDiv::cast(val); | 1537 HDiv* hdiv = HDiv::cast(val); |
1540 HValue* left = hdiv->left(); | 1538 HValue* left = hdiv->left(); |
1541 HValue* right = hdiv->right(); | 1539 HValue* right = hdiv->right(); |
1542 // Try to simplify left and right values of the division. | 1540 // Try to simplify left and right values of the division. |
1543 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); | 1541 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); |
1544 if (new_left == NULL && | 1542 if (new_left == NULL && |
1545 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1543 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
1546 new_left = new(block()->zone()) | 1544 new_left = new(block()->zone()) |
1547 HChange(left, Representation::Integer32(), false, false); | 1545 HChange(left, Representation::Integer32(), false, false); |
(...skipping 30 matching lines...) Expand all Loading... |
1578 ReplaceAllUsesWith(instr); | 1576 ReplaceAllUsesWith(instr); |
1579 Kill(); | 1577 Kill(); |
1580 // We know the division had no other uses than this HMathFloor. Delete it. | 1578 // We know the division had no other uses than this HMathFloor. Delete it. |
1581 // Dead code elimination will deal with |left| and |right| if | 1579 // Dead code elimination will deal with |left| and |right| if |
1582 // appropriate. | 1580 // appropriate. |
1583 hdiv->DeleteAndReplaceWith(NULL); | 1581 hdiv->DeleteAndReplaceWith(NULL); |
1584 | 1582 |
1585 // Return NULL to remove this instruction from the graph. | 1583 // Return NULL to remove this instruction from the graph. |
1586 return NULL; | 1584 return NULL; |
1587 } | 1585 } |
1588 #endif // V8_TARGET_ARCH_ARM | |
1589 } | 1586 } |
1590 return this; | 1587 return this; |
1591 } | 1588 } |
1592 | 1589 |
1593 | 1590 |
1594 HValue* HCheckInstanceType::Canonicalize() { | 1591 HValue* HCheckInstanceType::Canonicalize() { |
1595 if (check_ == IS_STRING && | 1592 if (check_ == IS_STRING && |
1596 !value()->type().IsUninitialized() && | 1593 !value()->type().IsUninitialized() && |
1597 value()->type().IsString()) { | 1594 value()->type().IsString()) { |
1598 return NULL; | 1595 return NULL; |
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3869 case kBackingStore: | 3866 case kBackingStore: |
3870 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3867 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3871 stream->Add("[backing-store]"); | 3868 stream->Add("[backing-store]"); |
3872 break; | 3869 break; |
3873 } | 3870 } |
3874 | 3871 |
3875 stream->Add("@%d", offset()); | 3872 stream->Add("@%d", offset()); |
3876 } | 3873 } |
3877 | 3874 |
3878 } } // namespace v8::internal | 3875 } } // namespace v8::internal |
OLD | NEW |