Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2140553002: [turbofan] Lower Smi field loads to Word32 field loads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_Comparison_Signedness
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 } 1864 }
1865 1865
1866 case IrOpcode::kAllocate: { 1866 case IrOpcode::kAllocate: {
1867 ProcessInput(node, 0, UseInfo::TruncatingWord32()); 1867 ProcessInput(node, 0, UseInfo::TruncatingWord32());
1868 ProcessRemainingInputs(node, 1); 1868 ProcessRemainingInputs(node, 1);
1869 SetOutput(node, MachineRepresentation::kTagged); 1869 SetOutput(node, MachineRepresentation::kTagged);
1870 return; 1870 return;
1871 } 1871 }
1872 case IrOpcode::kLoadField: { 1872 case IrOpcode::kLoadField: {
1873 FieldAccess access = FieldAccessOf(node->op()); 1873 FieldAccess access = FieldAccessOf(node->op());
1874 ProcessInput(node, 0, UseInfoForBasePointer(access)); 1874 MachineRepresentation representation =
1875 ProcessRemainingInputs(node, 1); 1875 access.machine_type.representation();
1876 SetOutput(node, access.machine_type.representation()); 1876 // If we are loading from a Smi field and truncate the result to Word32,
1877 // we can instead just load the high word on 64-bit architectures, which
1878 // is exactly the Word32 we are looking for, and therefore avoid a nasty
1879 // right shift afterwards.
1880 // TODO(bmeurer): Introduce an appropriate tagged-signed machine rep.
1881 if (truncation.TruncatesToWord32() &&
1882 representation == MachineRepresentation::kTagged &&
1883 access.type->Is(Type::TaggedSigned()) && SmiValuesAre32Bits()) {
1884 VisitUnop(node, UseInfoForBasePointer(access),
1885 MachineRepresentation::kWord32);
1886 if (lower()) {
1887 // Morph this Smi load field into an int32 load field.
1888 access.machine_type = MachineType::Int32();
1889 access.type = type_cache_.kInt32;
1890 #if V8_TARGET_LITTLE_ENDIAN
1891 access.offset += kPointerSize / 2;
1892 #endif
1893 NodeProperties::ChangeOp(node,
1894 jsgraph_->simplified()->LoadField(access));
1895 }
1896 } else {
1897 VisitUnop(node, UseInfoForBasePointer(access), representation);
1898 }
1877 return; 1899 return;
1878 } 1900 }
1879 case IrOpcode::kStoreField: { 1901 case IrOpcode::kStoreField: {
1880 FieldAccess access = FieldAccessOf(node->op()); 1902 FieldAccess access = FieldAccessOf(node->op());
1881 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( 1903 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
1882 access.base_is_tagged, access.machine_type.representation(), 1904 access.base_is_tagged, access.machine_type.representation(),
1883 access.offset, access.type, node->InputAt(1)); 1905 access.offset, access.type, node->InputAt(1));
1884 ProcessInput(node, 0, UseInfoForBasePointer(access)); 1906 ProcessInput(node, 0, UseInfoForBasePointer(access));
1885 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( 1907 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation(
1886 access.machine_type.representation())); 1908 access.machine_type.representation()));
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3285 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3264 Operator::kNoProperties); 3286 Operator::kNoProperties);
3265 to_number_operator_.set(common()->Call(desc)); 3287 to_number_operator_.set(common()->Call(desc));
3266 } 3288 }
3267 return to_number_operator_.get(); 3289 return to_number_operator_.get();
3268 } 3290 }
3269 3291
3270 } // namespace compiler 3292 } // namespace compiler
3271 } // namespace internal 3293 } // namespace internal
3272 } // namespace v8 3294 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698