OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 ProcessInput(node, 0, UseInfo::TruncatingWord32()); | 2182 ProcessInput(node, 0, UseInfo::TruncatingWord32()); |
2183 ProcessRemainingInputs(node, 1); | 2183 ProcessRemainingInputs(node, 1); |
2184 SetOutput(node, MachineRepresentation::kTagged); | 2184 SetOutput(node, MachineRepresentation::kTagged); |
2185 return; | 2185 return; |
2186 } | 2186 } |
2187 case IrOpcode::kLoadField: { | 2187 case IrOpcode::kLoadField: { |
2188 if (truncation.IsUnused()) return VisitUnused(node); | 2188 if (truncation.IsUnused()) return VisitUnused(node); |
2189 FieldAccess access = FieldAccessOf(node->op()); | 2189 FieldAccess access = FieldAccessOf(node->op()); |
2190 MachineRepresentation const representation = | 2190 MachineRepresentation const representation = |
2191 access.machine_type.representation(); | 2191 access.machine_type.representation(); |
2192 // If we are loading from a Smi field and truncate the result to Word32, | |
2193 // we can instead just load the high word on 64-bit architectures, which | |
2194 // is exactly the Word32 we are looking for, and therefore avoid a nasty | |
2195 // right shift afterwards. | |
2196 // TODO(bmeurer): Introduce an appropriate tagged-signed machine rep. | 2192 // TODO(bmeurer): Introduce an appropriate tagged-signed machine rep. |
2197 if (truncation.IsUsedAsWord32() && | 2193 VisitUnop(node, UseInfoForBasePointer(access), representation); |
2198 representation == MachineRepresentation::kTagged && | |
2199 access.type->Is(Type::TaggedSigned()) && SmiValuesAre32Bits()) { | |
2200 VisitUnop(node, UseInfoForBasePointer(access), | |
2201 MachineRepresentation::kWord32); | |
2202 if (lower()) { | |
2203 // Morph this Smi load field into an int32 load field. | |
2204 access.machine_type = MachineType::Int32(); | |
2205 access.type = type_cache_.kInt32; | |
2206 #if V8_TARGET_LITTLE_ENDIAN | |
2207 access.offset += kPointerSize / 2; | |
2208 #endif | |
2209 NodeProperties::ChangeOp(node, | |
2210 jsgraph_->simplified()->LoadField(access)); | |
2211 } | |
2212 } else { | |
2213 VisitUnop(node, UseInfoForBasePointer(access), representation); | |
2214 } | |
2215 return; | 2194 return; |
2216 } | 2195 } |
2217 case IrOpcode::kStoreField: { | 2196 case IrOpcode::kStoreField: { |
2218 FieldAccess access = FieldAccessOf(node->op()); | 2197 FieldAccess access = FieldAccessOf(node->op()); |
2219 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( | 2198 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( |
2220 access.base_is_tagged, access.machine_type.representation(), | 2199 access.base_is_tagged, access.machine_type.representation(), |
2221 access.offset, access.type, node->InputAt(1)); | 2200 access.offset, access.type, node->InputAt(1)); |
2222 ProcessInput(node, 0, UseInfoForBasePointer(access)); | 2201 ProcessInput(node, 0, UseInfoForBasePointer(access)); |
2223 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( | 2202 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( |
2224 access.machine_type.representation())); | 2203 access.machine_type.representation())); |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3358 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3337 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3359 Operator::kNoProperties); | 3338 Operator::kNoProperties); |
3360 to_number_operator_.set(common()->Call(desc)); | 3339 to_number_operator_.set(common()->Call(desc)); |
3361 } | 3340 } |
3362 return to_number_operator_.get(); | 3341 return to_number_operator_.get(); |
3363 } | 3342 } |
3364 | 3343 |
3365 } // namespace compiler | 3344 } // namespace compiler |
3366 } // namespace internal | 3345 } // namespace internal |
3367 } // namespace v8 | 3346 } // namespace v8 |
OLD | NEW |