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 13 matching lines...) Expand all Loading... |
24 IrOpcode::Value opcode; | 24 IrOpcode::Value opcode; |
25 Operator::Properties properties; | 25 Operator::Properties properties; |
26 int value_input_count; | 26 int value_input_count; |
27 }; | 27 }; |
28 | 28 |
29 | 29 |
30 std::ostream& operator<<(std::ostream& os, const PureOperator& pop) { | 30 std::ostream& operator<<(std::ostream& os, const PureOperator& pop) { |
31 return os << IrOpcode::Mnemonic(pop.opcode); | 31 return os << IrOpcode::Mnemonic(pop.opcode); |
32 } | 32 } |
33 | 33 |
34 | |
35 const PureOperator kPureOperators[] = { | 34 const PureOperator kPureOperators[] = { |
36 #define PURE(Name, properties, input_count) \ | 35 #define PURE(Name, properties, input_count) \ |
37 { \ | 36 { \ |
38 &SimplifiedOperatorBuilder::Name, IrOpcode::k##Name, \ | 37 &SimplifiedOperatorBuilder::Name, IrOpcode::k##Name, \ |
39 Operator::kPure | properties, input_count \ | 38 Operator::kPure | properties, input_count \ |
40 } | 39 } |
41 PURE(BooleanNot, Operator::kNoProperties, 1), | 40 PURE(BooleanNot, Operator::kNoProperties, 1), |
42 PURE(BooleanToNumber, Operator::kNoProperties, 1), | 41 PURE(BooleanToNumber, Operator::kNoProperties, 1), |
43 PURE(NumberEqual, Operator::kCommutative, 2), | 42 PURE(NumberEqual, Operator::kCommutative, 2), |
44 PURE(NumberLessThan, Operator::kNoProperties, 2), | 43 PURE(NumberLessThan, Operator::kNoProperties, 2), |
45 PURE(NumberLessThanOrEqual, Operator::kNoProperties, 2), | 44 PURE(NumberLessThanOrEqual, Operator::kNoProperties, 2), |
46 PURE(NumberAdd, Operator::kCommutative, 2), | 45 PURE(NumberAdd, Operator::kCommutative, 2), |
47 PURE(NumberSubtract, Operator::kNoProperties, 2), | 46 PURE(NumberSubtract, Operator::kNoProperties, 2), |
48 PURE(NumberMultiply, Operator::kCommutative, 2), | 47 PURE(NumberMultiply, Operator::kCommutative, 2), |
49 PURE(NumberDivide, Operator::kNoProperties, 2), | 48 PURE(NumberDivide, Operator::kNoProperties, 2), |
50 PURE(NumberModulus, Operator::kNoProperties, 2), | 49 PURE(NumberModulus, Operator::kNoProperties, 2), |
51 PURE(NumberBitwiseOr, Operator::kCommutative, 2), | 50 PURE(NumberBitwiseOr, Operator::kCommutative, 2), |
52 PURE(NumberBitwiseXor, Operator::kCommutative, 2), | 51 PURE(NumberBitwiseXor, Operator::kCommutative, 2), |
53 PURE(NumberBitwiseAnd, Operator::kCommutative, 2), | 52 PURE(NumberBitwiseAnd, Operator::kCommutative, 2), |
54 PURE(NumberShiftLeft, Operator::kNoProperties, 2), | 53 PURE(NumberShiftLeft, Operator::kNoProperties, 2), |
55 PURE(NumberShiftRight, Operator::kNoProperties, 2), | 54 PURE(NumberShiftRight, Operator::kNoProperties, 2), |
56 PURE(NumberShiftRightLogical, Operator::kNoProperties, 2), | 55 PURE(NumberShiftRightLogical, Operator::kNoProperties, 2), |
57 PURE(NumberToInt32, Operator::kNoProperties, 1), | 56 PURE(NumberToInt32, Operator::kNoProperties, 1), |
58 PURE(NumberToUint32, Operator::kNoProperties, 1), | 57 PURE(NumberToUint32, Operator::kNoProperties, 1), |
| 58 PURE(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1), |
59 PURE(ChangeTaggedToInt32, Operator::kNoProperties, 1), | 59 PURE(ChangeTaggedToInt32, Operator::kNoProperties, 1), |
60 PURE(ChangeTaggedToUint32, Operator::kNoProperties, 1), | 60 PURE(ChangeTaggedToUint32, Operator::kNoProperties, 1), |
61 PURE(ChangeTaggedToFloat64, Operator::kNoProperties, 1), | 61 PURE(ChangeTaggedToFloat64, Operator::kNoProperties, 1), |
62 PURE(ChangeInt32ToTagged, Operator::kNoProperties, 1), | 62 PURE(ChangeInt32ToTagged, Operator::kNoProperties, 1), |
63 PURE(ChangeUint32ToTagged, Operator::kNoProperties, 1), | 63 PURE(ChangeUint32ToTagged, Operator::kNoProperties, 1), |
64 PURE(ChangeFloat64ToTagged, Operator::kNoProperties, 1), | 64 PURE(ChangeFloat64ToTagged, Operator::kNoProperties, 1), |
65 PURE(ChangeBoolToBit, Operator::kNoProperties, 1), | 65 PURE(ChangeBoolToBit, Operator::kNoProperties, 1), |
66 PURE(ChangeBitToBool, Operator::kNoProperties, 1), | 66 PURE(ChangeBitToBool, Operator::kNoProperties, 1), |
| 67 PURE(TruncateTaggedToWord32, Operator::kNoProperties, 1), |
67 PURE(ObjectIsNumber, Operator::kNoProperties, 1), | 68 PURE(ObjectIsNumber, Operator::kNoProperties, 1), |
68 PURE(ObjectIsReceiver, Operator::kNoProperties, 1), | 69 PURE(ObjectIsReceiver, Operator::kNoProperties, 1), |
69 PURE(ObjectIsSmi, Operator::kNoProperties, 1) | 70 PURE(ObjectIsSmi, Operator::kNoProperties, 1) |
70 #undef PURE | 71 #undef PURE |
71 }; | 72 }; |
72 | 73 |
73 } // namespace | 74 } // namespace |
74 | 75 |
75 | 76 |
76 class SimplifiedPureOperatorTest | 77 class SimplifiedPureOperatorTest |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 285 } |
285 | 286 |
286 | 287 |
287 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, | 288 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, |
288 SimplifiedElementAccessOperatorTest, | 289 SimplifiedElementAccessOperatorTest, |
289 ::testing::ValuesIn(kElementAccesses)); | 290 ::testing::ValuesIn(kElementAccesses)); |
290 | 291 |
291 } // namespace compiler | 292 } // namespace compiler |
292 } // namespace internal | 293 } // namespace internal |
293 } // namespace v8 | 294 } // namespace v8 |
OLD | NEW |