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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/double.h" | 8 #include "src/double.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/hydrogen-infer-representation.h" | 10 #include "src/hydrogen-infer-representation.h" |
(...skipping 4022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4033 // constant-offset-from-key * kPointerSize) | 4033 // constant-offset-from-key * kPointerSize) |
4034 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; | 4034 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; |
4035 addition_result += increase_by_value; | 4035 addition_result += increase_by_value; |
4036 if (!addition_result.IsValid()) return false; | 4036 if (!addition_result.IsValid()) return false; |
4037 base_offset_ = addition_result.ValueOrDie(); | 4037 base_offset_ = addition_result.ValueOrDie(); |
4038 return true; | 4038 return true; |
4039 } | 4039 } |
4040 | 4040 |
4041 | 4041 |
4042 bool HStoreKeyed::NeedsCanonicalization() { | 4042 bool HStoreKeyed::NeedsCanonicalization() { |
4043 // If value is an integer or smi or comes from the result of a keyed load or | 4043 switch (value()->opcode()) { |
4044 // constant then it is either be a non-hole value or in the case of a constant | 4044 case kLoadKeyed: { |
4045 // the hole is only being stored explicitly: no need for canonicalization. | 4045 ElementsKind load_kind = HLoadKeyed::cast(value())->elements_kind(); |
4046 // | 4046 return IsExternalFloatOrDoubleElementsKind(load_kind) || |
4047 // The exception to that is keyed loads from external float or double arrays: | 4047 IsFixedFloatElementsKind(load_kind); |
4048 // these can load arbitrary representation of NaN. | 4048 } |
4049 | 4049 case kChange: { |
4050 if (value()->IsConstant()) { | 4050 Representation from = HChange::cast(value())->from(); |
4051 return false; | 4051 return from.IsTagged() || from.IsHeapObject(); |
| 4052 } |
| 4053 default: |
| 4054 return false; |
4052 } | 4055 } |
4053 | |
4054 if (value()->IsLoadKeyed()) { | |
4055 return IsExternalFloatOrDoubleElementsKind( | |
4056 HLoadKeyed::cast(value())->elements_kind()); | |
4057 } | |
4058 | |
4059 if (value()->IsChange()) { | |
4060 if (HChange::cast(value())->from().IsSmiOrInteger32()) { | |
4061 return false; | |
4062 } | |
4063 if (HChange::cast(value())->value()->type().IsSmi()) { | |
4064 return false; | |
4065 } | |
4066 } | |
4067 return true; | |
4068 } | 4056 } |
4069 | 4057 |
4070 | 4058 |
4071 #define H_CONSTANT_INT(val) \ | 4059 #define H_CONSTANT_INT(val) \ |
4072 HConstant::New(zone, context, static_cast<int32_t>(val)) | 4060 HConstant::New(zone, context, static_cast<int32_t>(val)) |
4073 #define H_CONSTANT_DOUBLE(val) \ | 4061 #define H_CONSTANT_DOUBLE(val) \ |
4074 HConstant::New(zone, context, static_cast<double>(val)) | 4062 HConstant::New(zone, context, static_cast<double>(val)) |
4075 | 4063 |
4076 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ | 4064 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ |
4077 HInstruction* HInstr::New( \ | 4065 HInstruction* HInstr::New( \ |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4817 break; | 4805 break; |
4818 case HObjectAccess::kExternalMemory: | 4806 case HObjectAccess::kExternalMemory: |
4819 os << "[external-memory]"; | 4807 os << "[external-memory]"; |
4820 break; | 4808 break; |
4821 } | 4809 } |
4822 | 4810 |
4823 return os << "@" << access.offset(); | 4811 return os << "@" << access.offset(); |
4824 } | 4812 } |
4825 | 4813 |
4826 } } // namespace v8::internal | 4814 } } // namespace v8::internal |
OLD | NEW |