Reviewers: ulan,
Description:
Once again: Fixed some lifetime/ownership issues in cctest
* Fixed lifetime issue in
cctest/test-heap-profiler/HeapSnapshotJSONSerialization.
* Fixed ownership issue in cctest/test-api/ContainsOnlyOneByte.
Please review this at https://codereview.chromium.org/142553005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+10, -6 lines):
M test/cctest/test-api.cc
M test/cctest/test-heap-profiler.cc
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
48730001ae4684417daae5a847e6cc0d1f65ef15..afd19feecbe04d38b8a0d0bf5de23b7c78aa4d5c
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -18951,8 +18951,9 @@ TEST(ContainsOnlyOneByte) {
}
string_contents[length-1] = 0;
// Simple case.
- Handle<String> string;
- string = String::NewExternal(isolate, new TestResource(string_contents));
+ Handle<String> string =
+ String::NewExternal(isolate,
+ new TestResource(string_contents, NULL, false));
CHECK(!string->IsOneByte() && string->ContainsOnlyOneByte());
// Counter example.
string = String::NewFromTwoByte(isolate, string_contents);
@@ -18969,7 +18970,9 @@ TEST(ContainsOnlyOneByte) {
balanced = String::Concat(balanced, right);
Handle<String> cons_strings[] = {left, balanced, right};
Handle<String> two_byte =
- String::NewExternal(isolate, new TestResource(string_contents));
+ String::NewExternal(isolate,
+ new TestResource(string_contents, NULL, false));
+ USE(two_byte); USE(cons_strings);
for (size_t i = 0; i < ARRAY_SIZE(cons_strings); i++) {
// Base assumptions.
string = cons_strings[i];
@@ -18990,7 +18993,8 @@ TEST(ContainsOnlyOneByte) {
int shift = 8 + (i % 7);
string_contents[alignment + i] = 1 << shift;
string = String::NewExternal(
- isolate, new TestResource(string_contents + alignment));
+ isolate,
+ new TestResource(string_contents + alignment, NULL, false));
CHECK_EQ(size, string->Length());
CHECK(!string->ContainsOnlyOneByte());
string_contents[alignment + i] = 0x41;
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc
b/test/cctest/test-heap-profiler.cc
index
efb80453e02117724dd5a33b5c07d1fdb6eed7b9..a968c3c77265f082ee3d234863596cb2d7ce6787
100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -746,9 +746,9 @@ TEST(HeapSnapshotJSONSerialization) {
stream.WriteTo(json);
// Verify that snapshot string is valid JSON.
- AsciiResource json_res(json);
+ AsciiResource* json_res = new AsciiResource(json);
v8::Local<v8::String> json_string =
- v8::String::NewExternal(env->GetIsolate(), &json_res);
+ v8::String::NewExternal(env->GetIsolate(), json_res);
env->Global()->Set(v8_str("json_snapshot"), json_string);
v8::Local<v8::Value> snapshot_parse_result = CompileRun(
"var parsed = JSON.parse(json_snapshot); true;");
--
--
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/groups/opt_out.