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

Unified Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 968773004: [turbofan] Use the typer to statically detect Smis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/typer.cc ('k') | test/unittests/compiler/change-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-simplified-lowering.cc
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc
index 2bd3eec46345aac02699d52451fe287d1490e09d..a2412e94d297d25bfb2358e88a9485ebdafb06ba 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -1441,39 +1441,41 @@ TEST(LowerLoadField_to_load) {
TEST(LowerStoreField_to_store) {
- TestingGraph t(Type::Any(), Type::Signed32());
+ {
+ TestingGraph t(Type::Any(), Type::Signed32());
- for (size_t i = 0; i < arraysize(kMachineReps); i++) {
- FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
- Handle<Name>::null(), Type::Any(), kMachineReps[i]};
+ for (size_t i = 0; i < arraysize(kMachineReps); i++) {
+ FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
+ Handle<Name>::null(), Type::Any(), kMachineReps[i]};
- Node* val = t.ExampleWithOutput(kMachineReps[i]);
- Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
- val, t.start, t.start);
- t.Effect(store);
- t.Lower();
- CHECK_EQ(IrOpcode::kStore, store->opcode());
- CHECK_EQ(val, store->InputAt(2));
- CheckFieldAccessArithmetic(access, store);
+ Node* val = t.ExampleWithOutput(kMachineReps[i]);
+ Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
+ val, t.start, t.start);
+ t.Effect(store);
+ t.Lower();
+ CHECK_EQ(IrOpcode::kStore, store->opcode());
+ CHECK_EQ(val, store->InputAt(2));
+ CheckFieldAccessArithmetic(access, store);
- StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
- if (kMachineReps[i] & kRepTagged) {
- CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind());
+ StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
+ if (kMachineReps[i] & kRepTagged) {
+ CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind());
+ }
+ CHECK_EQ(kMachineReps[i], rep.machine_type());
}
- CHECK_EQ(kMachineReps[i], rep.machine_type());
}
-
- if (t.machine()->Is64()) {
+ {
+ TestingGraph t(Type::Any(),
+ Type::Intersect(Type::SignedSmall(), Type::TaggedSigned()));
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(), kMachAnyTagged};
- Node* val = t.graph()->NewNode(t.simplified()->ChangeInt32ToTagged(), t.p0);
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
- val, t.start, t.start);
+ t.p1, t.start, t.start);
t.Effect(store);
t.Lower();
CHECK_EQ(IrOpcode::kStore, store->opcode());
- CHECK_EQ(val, store->InputAt(2));
+ CHECK_EQ(t.p1, store->InputAt(2));
StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind());
}
@@ -1503,26 +1505,42 @@ TEST(LowerLoadElement_to_load) {
TEST(LowerStoreElement_to_store) {
- TestingGraph t(Type::Any(), Type::Signed32());
+ {
+ TestingGraph t(Type::Any(), Type::Signed32());
- for (size_t i = 0; i < arraysize(kMachineReps); i++) {
- ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
- Type::Any(), kMachineReps[i]};
+ for (size_t i = 0; i < arraysize(kMachineReps); i++) {
+ ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
+ Type::Any(), kMachineReps[i]};
+
+ Node* val = t.ExampleWithOutput(kMachineReps[i]);
+ Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access),
+ t.p0, t.p1, val, t.start, t.start);
+ t.Effect(store);
+ t.Lower();
+ CHECK_EQ(IrOpcode::kStore, store->opcode());
+ CHECK_EQ(val, store->InputAt(2));
+ CheckElementAccessArithmetic(access, store);
- Node* val = t.ExampleWithOutput(kMachineReps[i]);
+ StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
+ if (kMachineReps[i] & kRepTagged) {
+ CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind());
+ }
+ CHECK_EQ(kMachineReps[i], rep.machine_type());
+ }
+ }
+ {
+ TestingGraph t(Type::Any(), Type::Signed32(),
+ Type::Intersect(Type::SignedSmall(), Type::TaggedSigned()));
+ ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
+ Type::Any(), kMachAnyTagged};
Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0,
- t.p1, val, t.start, t.start);
+ t.p1, t.p2, t.start, t.start);
t.Effect(store);
t.Lower();
CHECK_EQ(IrOpcode::kStore, store->opcode());
- CHECK_EQ(val, store->InputAt(2));
- CheckElementAccessArithmetic(access, store);
-
+ CHECK_EQ(t.p2, store->InputAt(2));
StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
- if (kMachineReps[i] & kRepTagged) {
- CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind());
- }
- CHECK_EQ(kMachineReps[i], rep.machine_type());
+ CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind());
}
}
« no previous file with comments | « src/compiler/typer.cc ('k') | test/unittests/compiler/change-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698