| 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 "src/compiler/opcodes.h" | 5 #include "src/compiler/opcodes.h" |
| 6 #include "src/compiler/operator.h" | 6 #include "src/compiler/operator.h" |
| 7 #include "src/compiler/operator-properties.h" | 7 #include "src/compiler/operator-properties.h" |
| 8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
| 9 #include "src/types.h" | 9 #include "src/types.h" |
| 10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 EXPECT_EQ(simplified1.StoreBuffer(access), simplified2.StoreBuffer(access)); | 149 EXPECT_EQ(simplified1.StoreBuffer(access), simplified2.StoreBuffer(access)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 TEST_P(SimplifiedBufferAccessOperatorTest, LoadBuffer) { | 153 TEST_P(SimplifiedBufferAccessOperatorTest, LoadBuffer) { |
| 154 SimplifiedOperatorBuilder simplified(zone()); | 154 SimplifiedOperatorBuilder simplified(zone()); |
| 155 BufferAccess const access(GetParam()); | 155 BufferAccess const access(GetParam()); |
| 156 const Operator* op = simplified.LoadBuffer(access); | 156 const Operator* op = simplified.LoadBuffer(access); |
| 157 | 157 |
| 158 EXPECT_EQ(IrOpcode::kLoadBuffer, op->opcode()); | 158 EXPECT_EQ(IrOpcode::kLoadBuffer, op->opcode()); |
| 159 EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties()); | 159 EXPECT_EQ(Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, |
| 160 op->properties()); |
| 160 EXPECT_EQ(access, BufferAccessOf(op)); | 161 EXPECT_EQ(access, BufferAccessOf(op)); |
| 161 | 162 |
| 162 EXPECT_EQ(3, op->ValueInputCount()); | 163 EXPECT_EQ(3, op->ValueInputCount()); |
| 163 EXPECT_EQ(1, op->EffectInputCount()); | 164 EXPECT_EQ(1, op->EffectInputCount()); |
| 164 EXPECT_EQ(1, op->ControlInputCount()); | 165 EXPECT_EQ(1, op->ControlInputCount()); |
| 165 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op)); | 166 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op)); |
| 166 | 167 |
| 167 EXPECT_EQ(1, op->ValueOutputCount()); | 168 EXPECT_EQ(1, op->ValueOutputCount()); |
| 168 EXPECT_EQ(1, op->EffectOutputCount()); | 169 EXPECT_EQ(1, op->EffectOutputCount()); |
| 169 EXPECT_EQ(0, op->ControlOutputCount()); | 170 EXPECT_EQ(0, op->ControlOutputCount()); |
| 170 } | 171 } |
| 171 | 172 |
| 172 | 173 |
| 173 TEST_P(SimplifiedBufferAccessOperatorTest, StoreBuffer) { | 174 TEST_P(SimplifiedBufferAccessOperatorTest, StoreBuffer) { |
| 174 SimplifiedOperatorBuilder simplified(zone()); | 175 SimplifiedOperatorBuilder simplified(zone()); |
| 175 BufferAccess const access(GetParam()); | 176 BufferAccess const access(GetParam()); |
| 176 const Operator* op = simplified.StoreBuffer(access); | 177 const Operator* op = simplified.StoreBuffer(access); |
| 177 | 178 |
| 178 EXPECT_EQ(IrOpcode::kStoreBuffer, op->opcode()); | 179 EXPECT_EQ(IrOpcode::kStoreBuffer, op->opcode()); |
| 179 EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties()); | 180 EXPECT_EQ(Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, |
| 181 op->properties()); |
| 180 EXPECT_EQ(access, BufferAccessOf(op)); | 182 EXPECT_EQ(access, BufferAccessOf(op)); |
| 181 | 183 |
| 182 EXPECT_EQ(4, op->ValueInputCount()); | 184 EXPECT_EQ(4, op->ValueInputCount()); |
| 183 EXPECT_EQ(1, op->EffectInputCount()); | 185 EXPECT_EQ(1, op->EffectInputCount()); |
| 184 EXPECT_EQ(1, op->ControlInputCount()); | 186 EXPECT_EQ(1, op->ControlInputCount()); |
| 185 EXPECT_EQ(6, OperatorProperties::GetTotalInputCount(op)); | 187 EXPECT_EQ(6, OperatorProperties::GetTotalInputCount(op)); |
| 186 | 188 |
| 187 EXPECT_EQ(0, op->ValueOutputCount()); | 189 EXPECT_EQ(0, op->ValueOutputCount()); |
| 188 EXPECT_EQ(1, op->EffectOutputCount()); | 190 EXPECT_EQ(1, op->EffectOutputCount()); |
| 189 EXPECT_EQ(0, op->ControlOutputCount()); | 191 EXPECT_EQ(0, op->ControlOutputCount()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 : public TestWithZone, | 253 : public TestWithZone, |
| 252 public ::testing::WithParamInterface<ElementAccess> {}; | 254 public ::testing::WithParamInterface<ElementAccess> {}; |
| 253 | 255 |
| 254 | 256 |
| 255 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { | 257 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { |
| 256 SimplifiedOperatorBuilder simplified(zone()); | 258 SimplifiedOperatorBuilder simplified(zone()); |
| 257 const ElementAccess& access = GetParam(); | 259 const ElementAccess& access = GetParam(); |
| 258 const Operator* op = simplified.LoadElement(access); | 260 const Operator* op = simplified.LoadElement(access); |
| 259 | 261 |
| 260 EXPECT_EQ(IrOpcode::kLoadElement, op->opcode()); | 262 EXPECT_EQ(IrOpcode::kLoadElement, op->opcode()); |
| 261 EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties()); | 263 EXPECT_EQ(Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, |
| 264 op->properties()); |
| 262 EXPECT_EQ(access, ElementAccessOf(op)); | 265 EXPECT_EQ(access, ElementAccessOf(op)); |
| 263 | 266 |
| 264 EXPECT_EQ(2, op->ValueInputCount()); | 267 EXPECT_EQ(2, op->ValueInputCount()); |
| 265 EXPECT_EQ(1, op->EffectInputCount()); | 268 EXPECT_EQ(1, op->EffectInputCount()); |
| 266 EXPECT_EQ(1, op->ControlInputCount()); | 269 EXPECT_EQ(1, op->ControlInputCount()); |
| 267 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op)); | 270 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op)); |
| 268 | 271 |
| 269 EXPECT_EQ(1, op->ValueOutputCount()); | 272 EXPECT_EQ(1, op->ValueOutputCount()); |
| 270 EXPECT_EQ(1, op->EffectOutputCount()); | 273 EXPECT_EQ(1, op->EffectOutputCount()); |
| 271 EXPECT_EQ(0, op->ControlOutputCount()); | 274 EXPECT_EQ(0, op->ControlOutputCount()); |
| 272 } | 275 } |
| 273 | 276 |
| 274 | 277 |
| 275 TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) { | 278 TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) { |
| 276 SimplifiedOperatorBuilder simplified(zone()); | 279 SimplifiedOperatorBuilder simplified(zone()); |
| 277 const ElementAccess& access = GetParam(); | 280 const ElementAccess& access = GetParam(); |
| 278 const Operator* op = simplified.StoreElement(access); | 281 const Operator* op = simplified.StoreElement(access); |
| 279 | 282 |
| 280 EXPECT_EQ(IrOpcode::kStoreElement, op->opcode()); | 283 EXPECT_EQ(IrOpcode::kStoreElement, op->opcode()); |
| 281 EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties()); | 284 EXPECT_EQ(Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, |
| 285 op->properties()); |
| 282 EXPECT_EQ(access, ElementAccessOf(op)); | 286 EXPECT_EQ(access, ElementAccessOf(op)); |
| 283 | 287 |
| 284 EXPECT_EQ(3, op->ValueInputCount()); | 288 EXPECT_EQ(3, op->ValueInputCount()); |
| 285 EXPECT_EQ(1, op->EffectInputCount()); | 289 EXPECT_EQ(1, op->EffectInputCount()); |
| 286 EXPECT_EQ(1, op->ControlInputCount()); | 290 EXPECT_EQ(1, op->ControlInputCount()); |
| 287 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op)); | 291 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op)); |
| 288 | 292 |
| 289 EXPECT_EQ(0, op->ValueOutputCount()); | 293 EXPECT_EQ(0, op->ValueOutputCount()); |
| 290 EXPECT_EQ(1, op->EffectOutputCount()); | 294 EXPECT_EQ(1, op->EffectOutputCount()); |
| 291 EXPECT_EQ(0, op->ControlOutputCount()); | 295 EXPECT_EQ(0, op->ControlOutputCount()); |
| 292 } | 296 } |
| 293 | 297 |
| 294 | 298 |
| 295 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, | 299 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, |
| 296 SimplifiedElementAccessOperatorTest, | 300 SimplifiedElementAccessOperatorTest, |
| 297 ::testing::ValuesIn(kElementAccesses)); | 301 ::testing::ValuesIn(kElementAccesses)); |
| 298 | 302 |
| 299 } // namespace compiler | 303 } // namespace compiler |
| 300 } // namespace internal | 304 } // namespace internal |
| 301 } // namespace v8 | 305 } // namespace v8 |
| OLD | NEW |