| 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); |
| 1548 HChange::cast(new_left)->InsertBefore(this); | 1546 HChange::cast(new_left)->InsertBefore(this); |
| 1549 } | 1547 } |
| 1550 HValue* new_right = | 1548 HValue* new_right = |
| 1551 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); | 1549 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); |
| 1552 if (new_right == NULL && | 1550 if (new_right == NULL && |
| 1551 #ifdef V8_TARGET_ARCH_MIPS |
| 1552 false && // MathFloorOfDiv on MIPS can only operate on HConstant |
| 1553 #endif |
| 1553 #ifdef V8_TARGET_ARCH_ARM | 1554 #ifdef V8_TARGET_ARCH_ARM |
| 1554 CpuFeatures::IsSupported(SUDIV) && | 1555 CpuFeatures::IsSupported(SUDIV) && |
| 1555 #endif | 1556 #endif |
| 1556 hdiv->observed_input_representation(2).IsSmiOrInteger32()) { | 1557 hdiv->observed_input_representation(2).IsSmiOrInteger32()) { |
| 1557 new_right = new(block()->zone()) | 1558 new_right = new(block()->zone()) |
| 1558 HChange(right, Representation::Integer32(), false, false); | 1559 HChange(right, Representation::Integer32(), false, false); |
| 1559 HChange::cast(new_right)->InsertBefore(this); | 1560 HChange::cast(new_right)->InsertBefore(this); |
| 1560 } | 1561 } |
| 1561 | 1562 |
| 1562 // Return if left or right are not optimizable. | 1563 // Return if left or right are not optimizable. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1578 ReplaceAllUsesWith(instr); | 1579 ReplaceAllUsesWith(instr); |
| 1579 Kill(); | 1580 Kill(); |
| 1580 // We know the division had no other uses than this HMathFloor. Delete it. | 1581 // We know the division had no other uses than this HMathFloor. Delete it. |
| 1581 // Dead code elimination will deal with |left| and |right| if | 1582 // Dead code elimination will deal with |left| and |right| if |
| 1582 // appropriate. | 1583 // appropriate. |
| 1583 hdiv->DeleteAndReplaceWith(NULL); | 1584 hdiv->DeleteAndReplaceWith(NULL); |
| 1584 | 1585 |
| 1585 // Return NULL to remove this instruction from the graph. | 1586 // Return NULL to remove this instruction from the graph. |
| 1586 return NULL; | 1587 return NULL; |
| 1587 } | 1588 } |
| 1588 #endif // V8_TARGET_ARCH_ARM | |
| 1589 } | 1589 } |
| 1590 return this; | 1590 return this; |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 | 1593 |
| 1594 HValue* HCheckInstanceType::Canonicalize() { | 1594 HValue* HCheckInstanceType::Canonicalize() { |
| 1595 if (check_ == IS_STRING && | 1595 if (check_ == IS_STRING && |
| 1596 !value()->type().IsUninitialized() && | 1596 !value()->type().IsUninitialized() && |
| 1597 value()->type().IsString()) { | 1597 value()->type().IsString()) { |
| 1598 return NULL; | 1598 return NULL; |
| (...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3869 case kBackingStore: | 3869 case kBackingStore: |
| 3870 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3870 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 3871 stream->Add("[backing-store]"); | 3871 stream->Add("[backing-store]"); |
| 3872 break; | 3872 break; |
| 3873 } | 3873 } |
| 3874 | 3874 |
| 3875 stream->Add("@%d", offset()); | 3875 stream->Add("@%d", offset()); |
| 3876 } | 3876 } |
| 3877 | 3877 |
| 3878 } } // namespace v8::internal | 3878 } } // namespace v8::internal |
| OLD | NEW |