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

Unified Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 437523002: More memory leak fixes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-instruction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-js-typed-lowering.cc
diff --git a/test/cctest/compiler/test-js-typed-lowering.cc b/test/cctest/compiler/test-js-typed-lowering.cc
index 1bbc76ea1a5a1a8151ccededcc00231ff999ec57..cfecf4d7e892231ece1c40f901dbb1eadc5b442d 100644
--- a/test/cctest/compiler/test-js-typed-lowering.cc
+++ b/test/cctest/compiler/test-js-typed-lowering.cc
@@ -260,22 +260,23 @@ static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) {
class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
public:
static const int kNumberOps = 6;
- Operator** ops;
- bool* signedness;
+ Operator* ops[kNumberOps];
+ bool signedness[kNumberOps];
JSBitwiseShiftTypedLoweringTester() {
- Operator* o[] = {javascript.ShiftLeft(), machine.Word32Shl(),
- javascript.ShiftRight(), machine.Word32Sar(),
- javascript.ShiftRightLogical(), machine.Word32Shr()};
-
- ops = static_cast<Operator**>(malloc(sizeof(o)));
- memcpy(ops, o, sizeof(o));
-
- // Expected signedness of left and right conversions above.
- bool s[] = {true, false, true, false, false, false};
+ int i = 0;
+ set(i++, javascript.ShiftLeft(), true);
+ set(i++, machine.Word32Shl(), false);
+ set(i++, javascript.ShiftRight(), true);
+ set(i++, machine.Word32Sar(), false);
+ set(i++, javascript.ShiftRightLogical(), false);
+ set(i++, machine.Word32Shr(), false);
+ }
- signedness = static_cast<bool*>(malloc(sizeof(s)));
- memcpy(signedness, s, sizeof(s));
+ private:
+ void set(int idx, Operator* op, bool s) {
+ ops[idx] = op;
+ signedness[idx] = s;
}
};
@@ -319,22 +320,23 @@ TEST(Int32BitwiseShifts) {
class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester {
public:
static const int kNumberOps = 6;
- Operator** ops;
- bool* signedness;
+ Operator* ops[kNumberOps];
+ bool signedness[kNumberOps];
JSBitwiseTypedLoweringTester() {
- Operator* o[] = {javascript.BitwiseOr(), machine.Word32Or(),
- javascript.BitwiseXor(), machine.Word32Xor(),
- javascript.BitwiseAnd(), machine.Word32And()};
-
- ops = static_cast<Operator**>(malloc(sizeof(o)));
- memcpy(ops, o, sizeof(o));
-
- // Expected signedness of left and right conversions above.
- bool s[] = {true, true, true, true, true, true};
-
- signedness = static_cast<bool*>(malloc(sizeof(s)));
- memcpy(signedness, s, sizeof(s));
+ int i = 0;
+ set(i++, javascript.BitwiseOr(), true);
+ set(i++, machine.Word32Or(), true);
+ set(i++, javascript.BitwiseXor(), true);
+ set(i++, machine.Word32Xor(), true);
+ set(i++, javascript.BitwiseAnd(), true);
+ set(i++, machine.Word32And(), true);
+ }
+
+ private:
+ void set(int idx, Operator* op, bool s) {
+ ops[idx] = op;
+ signedness[idx] = s;
}
};
« no previous file with comments | « test/cctest/compiler/test-instruction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698