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<const 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<const char[]>( |
75 const_cast<const char*>(StrDup(os.str().c_str()))); | |
Igor Sheludko
2016/07/25 08:56:44
Unnecessary const_cast and probably constness of a
jochen (gone - plz use gerrit)
2016/07/25 09:14:48
done
| |
75 } | 76 } |
76 | 77 |
77 | 78 |
78 TEST(TestOperator_Print) { | 79 TEST(TestOperator_Print) { |
79 Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0); | 80 Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0); |
80 Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0); | 81 Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0); |
81 | 82 |
82 CHECK_EQ(0, strcmp("Another1", OperatorToString(&op1a).get())); | 83 CHECK_EQ(0, strcmp("Another1", OperatorToString(&op1a).get())); |
83 CHECK_EQ(0, strcmp("Another2", OperatorToString(&op1b).get())); | 84 CHECK_EQ(0, strcmp("Another2", OperatorToString(&op1b).get())); |
84 | 85 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 CHECK_EQ(33, op.ControlInputCount()); | 278 CHECK_EQ(33, op.ControlInputCount()); |
278 | 279 |
279 CHECK_EQ(44, op.ValueOutputCount()); | 280 CHECK_EQ(44, op.ValueOutputCount()); |
280 CHECK_EQ(55, op.EffectOutputCount()); | 281 CHECK_EQ(55, op.EffectOutputCount()); |
281 CHECK_EQ(66, op.ControlOutputCount()); | 282 CHECK_EQ(66, op.ControlOutputCount()); |
282 } | 283 } |
283 | 284 |
284 } // namespace compiler | 285 } // namespace compiler |
285 } // namespace internal | 286 } // namespace internal |
286 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |