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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/effect-control-linearizer.h" | 10 #include "src/compiler/effect-control-linearizer.h" |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 | 1231 |
1232 void CheckFieldAccessArithmetic(FieldAccess access, Node* load_or_store) { | 1232 void CheckFieldAccessArithmetic(FieldAccess access, Node* load_or_store) { |
1233 IntPtrMatcher mindex(load_or_store->InputAt(1)); | 1233 IntPtrMatcher mindex(load_or_store->InputAt(1)); |
1234 CHECK(mindex.Is(access.offset - access.tag())); | 1234 CHECK(mindex.Is(access.offset - access.tag())); |
1235 } | 1235 } |
1236 | 1236 |
1237 | 1237 |
1238 Node* CheckElementAccessArithmetic(ElementAccess access, Node* load_or_store) { | 1238 Node* CheckElementAccessArithmetic(ElementAccess access, Node* load_or_store) { |
1239 Node* index = load_or_store->InputAt(1); | 1239 Node* index = load_or_store->InputAt(1); |
1240 if (kPointerSize == 8) { | 1240 if (kPointerSize == 8) { |
| 1241 Int64BinopMatcher mindex(index); |
| 1242 CHECK_EQ(IrOpcode::kInt64Add, mindex.node()->opcode()); |
| 1243 CHECK(mindex.right().Is(access.header_size - access.tag())); |
| 1244 |
| 1245 const int element_size_shift = |
| 1246 ElementSizeLog2Of(access.machine_type.representation()); |
| 1247 Node* index; |
| 1248 if (element_size_shift) { |
| 1249 Int64BinopMatcher shl(mindex.left().node()); |
| 1250 CHECK_EQ(IrOpcode::kWord64Shl, shl.node()->opcode()); |
| 1251 CHECK(shl.right().Is(element_size_shift)); |
| 1252 index = shl.left().node(); |
| 1253 } else { |
| 1254 index = mindex.left().node(); |
| 1255 } |
1241 CHECK_EQ(IrOpcode::kChangeUint32ToUint64, index->opcode()); | 1256 CHECK_EQ(IrOpcode::kChangeUint32ToUint64, index->opcode()); |
1242 index = index->InputAt(0); | 1257 return index->InputAt(0); |
1243 } | 1258 } else { |
| 1259 Int32BinopMatcher mindex(index); |
| 1260 CHECK_EQ(IrOpcode::kInt32Add, mindex.node()->opcode()); |
| 1261 CHECK(mindex.right().Is(access.header_size - access.tag())); |
1244 | 1262 |
1245 Int32BinopMatcher mindex(index); | 1263 const int element_size_shift = |
1246 CHECK_EQ(IrOpcode::kInt32Add, mindex.node()->opcode()); | 1264 ElementSizeLog2Of(access.machine_type.representation()); |
1247 CHECK(mindex.right().Is(access.header_size - access.tag())); | 1265 if (element_size_shift) { |
1248 | 1266 Int32BinopMatcher shl(mindex.left().node()); |
1249 const int element_size_shift = | 1267 CHECK_EQ(IrOpcode::kWord32Shl, shl.node()->opcode()); |
1250 ElementSizeLog2Of(access.machine_type.representation()); | 1268 CHECK(shl.right().Is(element_size_shift)); |
1251 if (element_size_shift) { | 1269 return shl.left().node(); |
1252 Int32BinopMatcher shl(mindex.left().node()); | 1270 } else { |
1253 CHECK_EQ(IrOpcode::kWord32Shl, shl.node()->opcode()); | 1271 return mindex.left().node(); |
1254 CHECK(shl.right().Is(element_size_shift)); | 1272 } |
1255 return shl.left().node(); | |
1256 } else { | |
1257 return mindex.left().node(); | |
1258 } | 1273 } |
1259 } | 1274 } |
1260 | 1275 |
1261 | 1276 |
1262 const MachineType kMachineReps[] = { | 1277 const MachineType kMachineReps[] = { |
1263 MachineType::Int8(), MachineType::Int16(), MachineType::Int32(), | 1278 MachineType::Int8(), MachineType::Int16(), MachineType::Int32(), |
1264 MachineType::Uint32(), MachineType::Int64(), MachineType::Float64(), | 1279 MachineType::Uint32(), MachineType::Int64(), MachineType::Float64(), |
1265 MachineType::AnyTagged()}; | 1280 MachineType::AnyTagged()}; |
1266 | 1281 |
1267 } // namespace | 1282 } // namespace |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 t.Return(use); | 1916 t.Return(use); |
1902 t.Lower(); | 1917 t.Lower(); |
1903 | 1918 |
1904 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); | 1919 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); |
1905 } | 1920 } |
1906 } | 1921 } |
1907 | 1922 |
1908 } // namespace compiler | 1923 } // namespace compiler |
1909 } // namespace internal | 1924 } // namespace internal |
1910 } // namespace v8 | 1925 } // namespace v8 |
OLD | NEW |