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

Side by Side Diff: test/unittests/compiler/simplified-operator-unittest.cc

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « test/unittests/compiler/simplified-operator-reducer-unittest.cc ('k') | tools/gyp/v8.gyp » ('j') | 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-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/compiler/operator-properties-inl.h" 7 #include "src/compiler/operator-properties-inl.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, SimplifiedPureOperatorTest, 112 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, SimplifiedPureOperatorTest,
113 ::testing::ValuesIn(kPureOperators)); 113 ::testing::ValuesIn(kPureOperators));
114 114
115 115
116 // ----------------------------------------------------------------------------- 116 // -----------------------------------------------------------------------------
117 // Element access operators. 117 // Element access operators.
118 118
119 namespace { 119 namespace {
120 120
121 const ElementAccess kElementAccesses[] = { 121 const ElementAccess kElementAccesses[] = {
122 {kNoBoundsCheck, kTaggedBase, FixedArray::kHeaderSize, Type::Any(), 122 {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged},
123 kMachAnyTagged}, 123 {kUntaggedBase, 0, Type::Any(), kMachInt8},
124 {kNoBoundsCheck, kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, 124 {kUntaggedBase, 0, Type::Any(), kMachInt16},
125 Type::Any(), kMachInt8}, 125 {kUntaggedBase, 0, Type::Any(), kMachInt32},
126 {kNoBoundsCheck, kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, 126 {kUntaggedBase, 0, Type::Any(), kMachUint8},
127 Type::Any(), kMachInt16}, 127 {kUntaggedBase, 0, Type::Any(), kMachUint16},
128 {kNoBoundsCheck, kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, 128 {kUntaggedBase, 0, Type::Any(), kMachUint32},
129 Type::Any(), kMachInt32}, 129 {kUntaggedBase, 0, Type::Signed32(), kMachInt8},
130 {kNoBoundsCheck, kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, 130 {kUntaggedBase, 0, Type::Unsigned32(), kMachUint8},
131 Type::Any(), kMachUint8}, 131 {kUntaggedBase, 0, Type::Signed32(), kMachInt16},
132 {kNoBoundsCheck, kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, 132 {kUntaggedBase, 0, Type::Unsigned32(), kMachUint16},
133 Type::Any(), kMachUint16}, 133 {kUntaggedBase, 0, Type::Signed32(), kMachInt32},
134 {kNoBoundsCheck, kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, 134 {kUntaggedBase, 0, Type::Unsigned32(), kMachUint32},
135 Type::Any(), kMachUint32}, 135 {kUntaggedBase, 0, Type::Number(), kRepFloat32},
136 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Signed32(), kMachInt8}, 136 {kUntaggedBase, 0, Type::Number(), kRepFloat64},
137 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Unsigned32(), kMachUint8}, 137 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(),
138 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Signed32(), kMachInt16}, 138 kMachInt8},
139 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Unsigned32(), kMachUint16}, 139 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(),
140 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Signed32(), kMachInt32}, 140 kMachUint8},
141 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Unsigned32(), kMachUint32}, 141 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(),
142 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Number(), kRepFloat32}, 142 kMachInt16},
143 {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::Number(), kRepFloat64}, 143 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(),
144 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset, 144 kMachUint16},
145 Type::Signed32(), kMachInt8}, 145 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(),
146 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset, 146 kMachInt32},
147 Type::Unsigned32(), kMachUint8}, 147 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(),
148 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset, 148 kMachUint32},
149 Type::Signed32(), kMachInt16}, 149 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(),
150 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset, 150 kRepFloat32},
151 Type::Unsigned32(), kMachUint16}, 151 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(),
152 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset, 152 kRepFloat64}};
153 Type::Signed32(), kMachInt32},
154 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset,
155 Type::Unsigned32(), kMachUint32},
156 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset,
157 Type::Number(), kRepFloat32},
158 {kTypedArrayBoundsCheck, kTaggedBase, FixedTypedArrayBase::kDataOffset,
159 Type::Number(), kRepFloat64}};
160 153
161 } // namespace 154 } // namespace
162 155
163 156
164 class SimplifiedElementAccessOperatorTest 157 class SimplifiedElementAccessOperatorTest
165 : public TestWithZone, 158 : public TestWithZone,
166 public ::testing::WithParamInterface<ElementAccess> {}; 159 public ::testing::WithParamInterface<ElementAccess> {};
167 160
168 161
169 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { 162 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) {
170 SimplifiedOperatorBuilder simplified(zone()); 163 SimplifiedOperatorBuilder simplified(zone());
171 const ElementAccess& access = GetParam(); 164 const ElementAccess& access = GetParam();
172 const Operator* op = simplified.LoadElement(access); 165 const Operator* op = simplified.LoadElement(access);
173 166
174 EXPECT_EQ(IrOpcode::kLoadElement, op->opcode()); 167 EXPECT_EQ(IrOpcode::kLoadElement, op->opcode());
175 EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties()); 168 EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties());
176 EXPECT_EQ(access, ElementAccessOf(op)); 169 EXPECT_EQ(access, ElementAccessOf(op));
177 170
178 EXPECT_EQ(3, op->ValueInputCount()); 171 EXPECT_EQ(2, op->ValueInputCount());
179 EXPECT_EQ(1, op->EffectInputCount()); 172 EXPECT_EQ(1, op->EffectInputCount());
180 EXPECT_EQ(0, op->ControlInputCount()); 173 EXPECT_EQ(1, op->ControlInputCount());
181 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op)); 174 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
182 175
183 EXPECT_EQ(1, op->ValueOutputCount()); 176 EXPECT_EQ(1, op->ValueOutputCount());
184 EXPECT_EQ(1, op->EffectOutputCount()); 177 EXPECT_EQ(1, op->EffectOutputCount());
185 EXPECT_EQ(0, op->ControlOutputCount()); 178 EXPECT_EQ(0, op->ControlOutputCount());
186 } 179 }
187 180
188 181
189 TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) { 182 TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) {
190 SimplifiedOperatorBuilder simplified(zone()); 183 SimplifiedOperatorBuilder simplified(zone());
191 const ElementAccess& access = GetParam(); 184 const ElementAccess& access = GetParam();
192 const Operator* op = simplified.StoreElement(access); 185 const Operator* op = simplified.StoreElement(access);
193 186
194 EXPECT_EQ(IrOpcode::kStoreElement, op->opcode()); 187 EXPECT_EQ(IrOpcode::kStoreElement, op->opcode());
195 EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties()); 188 EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties());
196 EXPECT_EQ(access, ElementAccessOf(op)); 189 EXPECT_EQ(access, ElementAccessOf(op));
197 190
198 EXPECT_EQ(4, op->ValueInputCount()); 191 EXPECT_EQ(3, op->ValueInputCount());
199 EXPECT_EQ(1, op->EffectInputCount()); 192 EXPECT_EQ(1, op->EffectInputCount());
200 EXPECT_EQ(1, op->ControlInputCount()); 193 EXPECT_EQ(1, op->ControlInputCount());
201 EXPECT_EQ(6, OperatorProperties::GetTotalInputCount(op)); 194 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op));
202 195
203 EXPECT_EQ(0, op->ValueOutputCount()); 196 EXPECT_EQ(0, op->ValueOutputCount());
204 EXPECT_EQ(1, op->EffectOutputCount()); 197 EXPECT_EQ(1, op->EffectOutputCount());
205 EXPECT_EQ(0, op->ControlOutputCount()); 198 EXPECT_EQ(0, op->ControlOutputCount());
206 } 199 }
207 200
208 201
209 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, 202 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest,
210 SimplifiedElementAccessOperatorTest, 203 SimplifiedElementAccessOperatorTest,
211 ::testing::ValuesIn(kElementAccesses)); 204 ::testing::ValuesIn(kElementAccesses));
212 205
213 } // namespace compiler 206 } // namespace compiler
214 } // namespace internal 207 } // namespace internal
215 } // namespace v8 208 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/simplified-operator-reducer-unittest.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698