| 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/change-lowering.h" | 9 #include "src/compiler/change-lowering.h" |
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
| (...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1343 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1344 val, t.start, t.start); | 1344 val, t.start, t.start); |
| 1345 t.Effect(store); | 1345 t.Effect(store); |
| 1346 t.LowerAllNodesAndLowerChanges(); | 1346 t.LowerAllNodesAndLowerChanges(); |
| 1347 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1347 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1348 CHECK_EQ(val, store->InputAt(2)); | 1348 CHECK_EQ(val, store->InputAt(2)); |
| 1349 CheckFieldAccessArithmetic(access, store); | 1349 CheckFieldAccessArithmetic(access, store); |
| 1350 | 1350 |
| 1351 StoreRepresentation rep = StoreRepresentationOf(store->op()); | 1351 StoreRepresentation rep = StoreRepresentationOf(store->op()); |
| 1352 if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { | 1352 if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { |
| 1353 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); | 1353 CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); |
| 1354 } | 1354 } |
| 1355 CHECK_EQ(kMachineReps[i].representation(), rep.representation()); | 1355 CHECK_EQ(kMachineReps[i].representation(), rep.representation()); |
| 1356 } | 1356 } |
| 1357 } | 1357 } |
| 1358 { | 1358 { |
| 1359 HandleAndZoneScope scope; | 1359 HandleAndZoneScope scope; |
| 1360 Zone* z = scope.main_zone(); | 1360 Zone* z = scope.main_zone(); |
| 1361 TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(), | 1361 TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(), |
| 1362 Type::TaggedSigned(), z)); | 1362 Type::TaggedSigned(), z)); |
| 1363 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1363 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
| 1364 Handle<Name>::null(), Type::Any(), | 1364 Handle<Name>::null(), Type::Any(), |
| 1365 MachineType::AnyTagged()}; | 1365 MachineType::AnyTagged()}; |
| 1366 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1366 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1367 t.p1, t.start, t.start); | 1367 t.p1, t.start, t.start); |
| 1368 t.Effect(store); | 1368 t.Effect(store); |
| 1369 t.LowerAllNodesAndLowerChanges(); | 1369 t.LowerAllNodesAndLowerChanges(); |
| 1370 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1370 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1371 CHECK_EQ(t.p1, store->InputAt(2)); | 1371 CHECK_EQ(t.p1, store->InputAt(2)); |
| 1372 StoreRepresentation rep = StoreRepresentationOf(store->op()); | 1372 StoreRepresentation rep = StoreRepresentationOf(store->op()); |
| 1373 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); | 1373 CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); |
| 1374 } | 1374 } |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 | 1377 |
| 1378 TEST(LowerLoadElement_to_load) { | 1378 TEST(LowerLoadElement_to_load) { |
| 1379 for (size_t i = 0; i < arraysize(kMachineReps); i++) { | 1379 for (size_t i = 0; i < arraysize(kMachineReps); i++) { |
| 1380 TestingGraph t(Type::Any(), Type::Signed32()); | 1380 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1381 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1381 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
| 1382 Type::Any(), kMachineReps[i]}; | 1382 Type::Any(), kMachineReps[i]}; |
| 1383 | 1383 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1408 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), | 1408 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), |
| 1409 t.p0, t.p1, val, t.start, t.start); | 1409 t.p0, t.p1, val, t.start, t.start); |
| 1410 t.Effect(store); | 1410 t.Effect(store); |
| 1411 t.LowerAllNodesAndLowerChanges(); | 1411 t.LowerAllNodesAndLowerChanges(); |
| 1412 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1412 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1413 CHECK_EQ(val, store->InputAt(2)); | 1413 CHECK_EQ(val, store->InputAt(2)); |
| 1414 CheckElementAccessArithmetic(access, store); | 1414 CheckElementAccessArithmetic(access, store); |
| 1415 | 1415 |
| 1416 StoreRepresentation rep = StoreRepresentationOf(store->op()); | 1416 StoreRepresentation rep = StoreRepresentationOf(store->op()); |
| 1417 if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { | 1417 if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { |
| 1418 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); | 1418 CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); |
| 1419 } | 1419 } |
| 1420 CHECK_EQ(kMachineReps[i].representation(), rep.representation()); | 1420 CHECK_EQ(kMachineReps[i].representation(), rep.representation()); |
| 1421 } | 1421 } |
| 1422 } | 1422 } |
| 1423 { | 1423 { |
| 1424 HandleAndZoneScope scope; | 1424 HandleAndZoneScope scope; |
| 1425 Zone* z = scope.main_zone(); | 1425 Zone* z = scope.main_zone(); |
| 1426 TestingGraph t( | 1426 TestingGraph t( |
| 1427 Type::Any(), Type::Signed32(), | 1427 Type::Any(), Type::Signed32(), |
| 1428 Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z)); | 1428 Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z)); |
| 1429 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1429 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
| 1430 Type::Any(), MachineType::AnyTagged()}; | 1430 Type::Any(), MachineType::AnyTagged()}; |
| 1431 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, | 1431 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, |
| 1432 t.p1, t.p2, t.start, t.start); | 1432 t.p1, t.p2, t.start, t.start); |
| 1433 t.Effect(store); | 1433 t.Effect(store); |
| 1434 t.LowerAllNodesAndLowerChanges(); | 1434 t.LowerAllNodesAndLowerChanges(); |
| 1435 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1435 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1436 CHECK_EQ(t.p2, store->InputAt(2)); | 1436 CHECK_EQ(t.p2, store->InputAt(2)); |
| 1437 StoreRepresentation rep = StoreRepresentationOf(store->op()); | 1437 StoreRepresentation rep = StoreRepresentationOf(store->op()); |
| 1438 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); | 1438 CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); |
| 1439 } | 1439 } |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 | 1442 |
| 1443 TEST(InsertChangeForLoadElementIndex) { | 1443 TEST(InsertChangeForLoadElementIndex) { |
| 1444 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged, length) => | 1444 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged, length) => |
| 1445 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) | 1445 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) |
| 1446 TestingGraph t(Type::Any(), Type::Signed32()); | 1446 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1447 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), | 1447 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), |
| 1448 MachineType::AnyTagged()}; | 1448 MachineType::AnyTagged()}; |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 t.Return(use); | 1939 t.Return(use); |
| 1940 t.Lower(); | 1940 t.Lower(); |
| 1941 | 1941 |
| 1942 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); | 1942 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); |
| 1943 } | 1943 } |
| 1944 } | 1944 } |
| 1945 | 1945 |
| 1946 } // namespace compiler | 1946 } // namespace compiler |
| 1947 } // namespace internal | 1947 } // namespace internal |
| 1948 } // namespace v8 | 1948 } // namespace v8 |
| OLD | NEW |