| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <memory> |
| 5 #include <sstream> | 6 #include <sstream> |
| 6 | 7 |
| 7 #include "src/compiler/operator.h" | 8 #include "src/compiler/operator.h" |
| 8 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
| 9 | 10 |
| 10 namespace v8 { | 11 namespace v8 { |
| 11 namespace internal { | 12 namespace internal { |
| 12 namespace compiler { | 13 namespace compiler { |
| 13 | 14 |
| 14 #define NONE Operator::kNoProperties | 15 #define NONE Operator::kNoProperties |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 CHECK(!op1a.Equals(&op2b)); | 61 CHECK(!op1a.Equals(&op2b)); |
| 61 CHECK(!op1b.Equals(&op2a)); | 62 CHECK(!op1b.Equals(&op2a)); |
| 62 CHECK(!op1b.Equals(&op2b)); | 63 CHECK(!op1b.Equals(&op2b)); |
| 63 | 64 |
| 64 CHECK(!op2a.Equals(&op1a)); | 65 CHECK(!op2a.Equals(&op1a)); |
| 65 CHECK(!op2a.Equals(&op1b)); | 66 CHECK(!op2a.Equals(&op1b)); |
| 66 CHECK(!op2b.Equals(&op1a)); | 67 CHECK(!op2b.Equals(&op1a)); |
| 67 CHECK(!op2b.Equals(&op1b)); | 68 CHECK(!op2b.Equals(&op1b)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 | 71 static std::unique_ptr<char[]> OperatorToString(Operator* op) { |
| 71 static v8::base::SmartArrayPointer<const char> OperatorToString(Operator* op) { | |
| 72 std::ostringstream os; | 72 std::ostringstream os; |
| 73 os << *op; | 73 os << *op; |
| 74 return v8::base::SmartArrayPointer<const char>(StrDup(os.str().c_str())); | 74 return std::unique_ptr<char[]>(StrDup(os.str().c_str())); |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 TEST(TestOperator_Print) { | 78 TEST(TestOperator_Print) { |
| 79 Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0); | 79 Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0); |
| 80 Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0); | 80 Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0); |
| 81 | 81 |
| 82 CHECK_EQ(0, strcmp("Another1", OperatorToString(&op1a).get())); | 82 CHECK_EQ(0, strcmp("Another1", OperatorToString(&op1a).get())); |
| 83 CHECK_EQ(0, strcmp("Another2", OperatorToString(&op1b).get())); | 83 CHECK_EQ(0, strcmp("Another2", OperatorToString(&op1b).get())); |
| 84 | 84 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 CHECK_EQ(33, op.ControlInputCount()); | 277 CHECK_EQ(33, op.ControlInputCount()); |
| 278 | 278 |
| 279 CHECK_EQ(44, op.ValueOutputCount()); | 279 CHECK_EQ(44, op.ValueOutputCount()); |
| 280 CHECK_EQ(55, op.EffectOutputCount()); | 280 CHECK_EQ(55, op.EffectOutputCount()); |
| 281 CHECK_EQ(66, op.ControlOutputCount()); | 281 CHECK_EQ(66, op.ControlOutputCount()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace compiler | 284 } // namespace compiler |
| 285 } // namespace internal | 285 } // namespace internal |
| 286 } // namespace v8 | 286 } // namespace v8 |
| OLD | NEW |