| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/double.h" | 7 #include "src/double.h" |
| 8 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/hydrogen-infer-representation.h" | 9 #include "src/hydrogen-infer-representation.h" |
| 10 #include "src/property-details-inl.h" | 10 #include "src/property-details-inl.h" |
| (...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 HValue* HUnaryMathOperation::Canonicalize() { | 1574 HValue* HUnaryMathOperation::Canonicalize() { |
| 1575 if (op() == kMathRound || op() == kMathFloor) { | 1575 if (op() == kMathRound || op() == kMathFloor) { |
| 1576 HValue* val = value(); | 1576 HValue* val = value(); |
| 1577 if (val->IsChange()) val = HChange::cast(val)->value(); | 1577 if (val->IsChange()) val = HChange::cast(val)->value(); |
| 1578 if (val->representation().IsSmiOrInteger32()) { | 1578 if (val->representation().IsSmiOrInteger32()) { |
| 1579 if (val->representation().Equals(representation())) return val; | 1579 if (val->representation().Equals(representation())) return val; |
| 1580 return Prepend(new(block()->zone()) HChange( | 1580 return Prepend(new(block()->zone()) HChange( |
| 1581 val, representation(), false, false)); | 1581 val, representation(), false, false)); |
| 1582 } | 1582 } |
| 1583 } | 1583 } |
| 1584 if (op() == kMathFloor && value()->IsDiv() && value()->UseCount() == 1) { | 1584 if (op() == kMathFloor && value()->IsDiv() && value()->HasOneUse()) { |
| 1585 HDiv* hdiv = HDiv::cast(value()); | 1585 HDiv* hdiv = HDiv::cast(value()); |
| 1586 | 1586 |
| 1587 HValue* left = hdiv->left(); | 1587 HValue* left = hdiv->left(); |
| 1588 if (left->representation().IsInteger32()) { | 1588 if (left->representation().IsInteger32()) { |
| 1589 // A value with an integer representation does not need to be transformed. | 1589 // A value with an integer representation does not need to be transformed. |
| 1590 } else if (left->IsChange() && HChange::cast(left)->from().IsInteger32()) { | 1590 } else if (left->IsChange() && HChange::cast(left)->from().IsInteger32()) { |
| 1591 // A change from an integer32 can be replaced by the integer32 value. | 1591 // A change from an integer32 can be replaced by the integer32 value. |
| 1592 left = HChange::cast(left)->value(); | 1592 left = HChange::cast(left)->value(); |
| 1593 } else if (hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1593 } else if (hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
| 1594 left = Prepend(new(block()->zone()) HChange( | 1594 left = Prepend(new(block()->zone()) HChange( |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 new_index->ClearAllSideEffects(); | 2142 new_index->ClearAllSideEffects(); |
| 2143 new_index->AssumeRepresentation(Representation::Integer32()); | 2143 new_index->AssumeRepresentation(Representation::Integer32()); |
| 2144 set_added_index(HBitwise::cast(new_index)); | 2144 set_added_index(HBitwise::cast(new_index)); |
| 2145 added_index()->InsertBefore(first_check_in_block()); | 2145 added_index()->InsertBefore(first_check_in_block()); |
| 2146 } | 2146 } |
| 2147 ASSERT(added_index()->op() == token); | 2147 ASSERT(added_index()->op() == token); |
| 2148 | 2148 |
| 2149 added_index()->SetOperandAt(1, index_base); | 2149 added_index()->SetOperandAt(1, index_base); |
| 2150 added_index()->SetOperandAt(2, added_constant()); | 2150 added_index()->SetOperandAt(2, added_constant()); |
| 2151 first_check_in_block()->SetOperandAt(0, added_index()); | 2151 first_check_in_block()->SetOperandAt(0, added_index()); |
| 2152 if (previous_index->UseCount() == 0) { | 2152 if (previous_index->HasNoUses()) { |
| 2153 previous_index->DeleteAndReplaceWith(NULL); | 2153 previous_index->DeleteAndReplaceWith(NULL); |
| 2154 } | 2154 } |
| 2155 } | 2155 } |
| 2156 | 2156 |
| 2157 void InductionVariableData::ChecksRelatedToLength::AddCheck( | 2157 void InductionVariableData::ChecksRelatedToLength::AddCheck( |
| 2158 HBoundsCheck* check, | 2158 HBoundsCheck* check, |
| 2159 int32_t upper_limit) { | 2159 int32_t upper_limit) { |
| 2160 BitwiseDecompositionResult decomposition; | 2160 BitwiseDecompositionResult decomposition; |
| 2161 InductionVariableData::DecomposeBitwise(check->index(), &decomposition); | 2161 InductionVariableData::DecomposeBitwise(check->index(), &decomposition); |
| 2162 | 2162 |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 } | 2886 } |
| 2887 | 2887 |
| 2888 | 2888 |
| 2889 bool HConstant::EmitAtUses() { | 2889 bool HConstant::EmitAtUses() { |
| 2890 ASSERT(IsLinked()); | 2890 ASSERT(IsLinked()); |
| 2891 if (block()->graph()->has_osr() && | 2891 if (block()->graph()->has_osr() && |
| 2892 block()->graph()->IsStandardConstant(this)) { | 2892 block()->graph()->IsStandardConstant(this)) { |
| 2893 // TODO(titzer): this seems like a hack that should be fixed by custom OSR. | 2893 // TODO(titzer): this seems like a hack that should be fixed by custom OSR. |
| 2894 return true; | 2894 return true; |
| 2895 } | 2895 } |
| 2896 if (UseCount() == 0) return true; | 2896 if (HasNoUses()) return true; |
| 2897 if (IsCell()) return false; | 2897 if (IsCell()) return false; |
| 2898 if (representation().IsDouble()) return false; | 2898 if (representation().IsDouble()) return false; |
| 2899 if (representation().IsExternal()) return false; | 2899 if (representation().IsExternal()) return false; |
| 2900 return true; | 2900 return true; |
| 2901 } | 2901 } |
| 2902 | 2902 |
| 2903 | 2903 |
| 2904 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { | 2904 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { |
| 2905 if (r.IsSmi() && !has_smi_value_) return NULL; | 2905 if (r.IsSmi() && !has_smi_value_) return NULL; |
| 2906 if (r.IsInteger32() && !has_int32_value_) return NULL; | 2906 if (r.IsInteger32() && !has_int32_value_) return NULL; |
| (...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4839 break; | 4839 break; |
| 4840 case kExternalMemory: | 4840 case kExternalMemory: |
| 4841 stream->Add("[external-memory]"); | 4841 stream->Add("[external-memory]"); |
| 4842 break; | 4842 break; |
| 4843 } | 4843 } |
| 4844 | 4844 |
| 4845 stream->Add("@%d", offset()); | 4845 stream->Add("@%d", offset()); |
| 4846 } | 4846 } |
| 4847 | 4847 |
| 4848 } } // namespace v8::internal | 4848 } } // namespace v8::internal |
| OLD | NEW |