Reviewers: Benedikt Meurer,
Message:
Committed patchset #1 manually as r22749 (tree was closed).
Description:
More memory leak fixes.
[email protected]
Committed: https://code.google.com/p/v8/source/detail?r=22749
Please review this at https://codereview.chromium.org/437523002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+31, -27 lines):
M test/cctest/compiler/test-instruction.cc
M test/cctest/compiler/test-js-typed-lowering.cc
Index: test/cctest/compiler/test-instruction.cc
diff --git a/test/cctest/compiler/test-instruction.cc
b/test/cctest/compiler/test-instruction.cc
index
865adcc228ee723574b48a7be617fc3177612032..e3a89e475b1c217ca2c015086a98dc5203008cfe
100644
--- a/test/cctest/compiler/test-instruction.cc
+++ b/test/cctest/compiler/test-instruction.cc
@@ -35,6 +35,8 @@ class InstructionTester : public HandleAndZoneScope {
machine(zone(), kMachineWord32),
code(NULL) {}
+ ~InstructionTester() { delete code; }
+
Isolate* isolate;
Graph graph;
Schedule schedule;
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;
}
};
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.