| 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/crankshaft/hydrogen-instructions.h" | 5 #include "src/crankshaft/hydrogen-instructions.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/safe_math.h" | 8 #include "src/base/safe_math.h" |
| 9 #include "src/crankshaft/hydrogen-infer-representation.h" | 9 #include "src/crankshaft/hydrogen-infer-representation.h" |
| 10 #include "src/double.h" | 10 #include "src/double.h" |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 for (HUseIterator use = uses(); !use.Done(); use.Advance()) { | 758 for (HUseIterator use = uses(); !use.Done(); use.Advance()) { |
| 759 if (use.value()->IsInstruction()) { | 759 if (use.value()->IsInstruction()) { |
| 760 DCHECK(HInstruction::cast(use.value())->IsLinked()); | 760 DCHECK(HInstruction::cast(use.value())->IsLinked()); |
| 761 } | 761 } |
| 762 } | 762 } |
| 763 } | 763 } |
| 764 #endif | 764 #endif |
| 765 | 765 |
| 766 | 766 |
| 767 bool HInstruction::CanDeoptimize() { | 767 bool HInstruction::CanDeoptimize() { |
| 768 // TODO(titzer): make this a virtual method? | |
| 769 switch (opcode()) { | 768 switch (opcode()) { |
| 770 case HValue::kAbnormalExit: | 769 case HValue::kAbnormalExit: |
| 771 case HValue::kAccessArgumentsAt: | 770 case HValue::kAccessArgumentsAt: |
| 772 case HValue::kAllocate: | 771 case HValue::kAllocate: |
| 773 case HValue::kArgumentsElements: | 772 case HValue::kArgumentsElements: |
| 774 case HValue::kArgumentsLength: | 773 case HValue::kArgumentsLength: |
| 775 case HValue::kArgumentsObject: | 774 case HValue::kArgumentsObject: |
| 776 case HValue::kBlockEntry: | 775 case HValue::kBlockEntry: |
| 777 case HValue::kBoundsCheckBaseIndexInformation: | 776 case HValue::kBoundsCheckBaseIndexInformation: |
| 778 case HValue::kCallFunction: | 777 case HValue::kCallFunction: |
| (...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 } | 2723 } |
| 2725 if (object->IsNumber()) { | 2724 if (object->IsNumber()) { |
| 2726 double n = object->Number(); | 2725 double n = object->Number(); |
| 2727 bool has_int32_value = IsInteger32(n); | 2726 bool has_int32_value = IsInteger32(n); |
| 2728 bit_field_ = HasInt32ValueField::update(bit_field_, has_int32_value); | 2727 bit_field_ = HasInt32ValueField::update(bit_field_, has_int32_value); |
| 2729 int32_value_ = DoubleToInt32(n); | 2728 int32_value_ = DoubleToInt32(n); |
| 2730 bit_field_ = HasSmiValueField::update( | 2729 bit_field_ = HasSmiValueField::update( |
| 2731 bit_field_, has_int32_value && Smi::IsValid(int32_value_)); | 2730 bit_field_, has_int32_value && Smi::IsValid(int32_value_)); |
| 2732 double_value_ = n; | 2731 double_value_ = n; |
| 2733 bit_field_ = HasDoubleValueField::update(bit_field_, true); | 2732 bit_field_ = HasDoubleValueField::update(bit_field_, true); |
| 2734 // TODO(titzer): if this heap number is new space, tenure a new one. | |
| 2735 } | 2733 } |
| 2736 | 2734 |
| 2737 Initialize(r); | 2735 Initialize(r); |
| 2738 } | 2736 } |
| 2739 | 2737 |
| 2740 | 2738 |
| 2741 HConstant::HConstant(Unique<Object> object, Unique<Map> object_map, | 2739 HConstant::HConstant(Unique<Object> object, Unique<Map> object_map, |
| 2742 bool has_stable_map_value, Representation r, HType type, | 2740 bool has_stable_map_value, Representation r, HType type, |
| 2743 bool is_not_in_new_space, bool boolean_value, | 2741 bool is_not_in_new_space, bool boolean_value, |
| 2744 bool is_undetectable, InstanceType instance_type) | 2742 bool is_undetectable, InstanceType instance_type) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2897 STRING_TYPE_LIST(STRING_TYPE) | 2895 STRING_TYPE_LIST(STRING_TYPE) |
| 2898 #undef STRING_TYPE | 2896 #undef STRING_TYPE |
| 2899 false; | 2897 false; |
| 2900 } | 2898 } |
| 2901 | 2899 |
| 2902 | 2900 |
| 2903 bool HConstant::EmitAtUses() { | 2901 bool HConstant::EmitAtUses() { |
| 2904 DCHECK(IsLinked()); | 2902 DCHECK(IsLinked()); |
| 2905 if (block()->graph()->has_osr() && | 2903 if (block()->graph()->has_osr() && |
| 2906 block()->graph()->IsStandardConstant(this)) { | 2904 block()->graph()->IsStandardConstant(this)) { |
| 2907 // TODO(titzer): this seems like a hack that should be fixed by custom OSR. | |
| 2908 return true; | 2905 return true; |
| 2909 } | 2906 } |
| 2910 if (HasNoUses()) return true; | 2907 if (HasNoUses()) return true; |
| 2911 if (IsCell()) return false; | 2908 if (IsCell()) return false; |
| 2912 if (representation().IsDouble()) return false; | 2909 if (representation().IsDouble()) return false; |
| 2913 if (representation().IsExternal()) return false; | 2910 if (representation().IsExternal()) return false; |
| 2914 return true; | 2911 return true; |
| 2915 } | 2912 } |
| 2916 | 2913 |
| 2917 | 2914 |
| (...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4666 case HObjectAccess::kExternalMemory: | 4663 case HObjectAccess::kExternalMemory: |
| 4667 os << "[external-memory]"; | 4664 os << "[external-memory]"; |
| 4668 break; | 4665 break; |
| 4669 } | 4666 } |
| 4670 | 4667 |
| 4671 return os << "@" << access.offset(); | 4668 return os << "@" << access.offset(); |
| 4672 } | 4669 } |
| 4673 | 4670 |
| 4674 } // namespace internal | 4671 } // namespace internal |
| 4675 } // namespace v8 | 4672 } // namespace v8 |
| OLD | NEW |