| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 3c461853228e2166468b3f4bcf60ae475d7a745a..52c4c27b056aae33900190d97209ee8161512e2d 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -14841,14 +14841,12 @@ TEST(PreCompileSerialization) {
|
| i::OS::MemCopy(serialized_data, cd->data, cd->length);
|
|
|
| // Deserialize.
|
| - v8::ScriptData* deserialized =
|
| - v8::ScriptData::New(serialized_data, cd->length);
|
| + i::ScriptDataImpl deserialized(serialized_data, cd->length);
|
|
|
| // Verify that the original is the same as the deserialized.
|
| - CHECK_EQ(cd->length, deserialized->Length());
|
| - CHECK_EQ(0, memcmp(cd->data, deserialized->Data(), cd->length));
|
| + CHECK_EQ(cd->length, deserialized.Length());
|
| + CHECK_EQ(0, memcmp(cd->data, deserialized.Data(), cd->length));
|
|
|
| - delete deserialized;
|
| i::DeleteArray(serialized_data);
|
| }
|
|
|
| @@ -14858,11 +14856,8 @@ TEST(PreCompileDeserializationError) {
|
| v8::V8::Initialize();
|
| const char* data = "DONT CARE";
|
| int invalid_size = 3;
|
| - v8::ScriptData* sd = v8::ScriptData::New(data, invalid_size);
|
| -
|
| - CHECK_EQ(0, sd->Length());
|
| -
|
| - delete sd;
|
| + i::ScriptDataImpl sd(data, invalid_size);
|
| + CHECK_EQ(0, sd.Length());
|
| }
|
|
|
|
|
| @@ -14883,16 +14878,15 @@ TEST(CompileWithInvalidCachedData) {
|
| // want to modify the data before passing it back.
|
| const v8::ScriptCompiler::CachedData* cd = source.GetCachedData();
|
| // ScriptData does not take ownership of the buffers passed to it.
|
| - v8::ScriptData* sd =
|
| - v8::ScriptData::New(reinterpret_cast<const char*>(cd->data), cd->length);
|
| - CHECK(!sd->HasError());
|
| + i::ScriptDataImpl sd(reinterpret_cast<const char*>(cd->data), cd->length);
|
| + CHECK(!sd.HasError());
|
| // ScriptDataImpl private implementation details
|
| const int kHeaderSize = i::PreparseDataConstants::kHeaderSize;
|
| const int kFunctionEntrySize = i::FunctionEntry::kSize;
|
| const int kFunctionEntryStartOffset = 0;
|
| const int kFunctionEntryEndOffset = 1;
|
| unsigned* sd_data =
|
| - reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
|
| + reinterpret_cast<unsigned*>(const_cast<char*>(sd.Data()));
|
|
|
| // Overwrite function bar's end position with 0.
|
| sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0;
|
| @@ -14907,7 +14901,7 @@ TEST(CompileWithInvalidCachedData) {
|
| // CachedData doesn't take ownership of the buffers, Source takes
|
| // ownership of CachedData.
|
| new v8::ScriptCompiler::CachedData(
|
| - reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
|
| + reinterpret_cast<const uint8_t*>(sd.Data()), sd.Length()));
|
| Local<v8::UnboundScript> compiled_script =
|
| v8::ScriptCompiler::CompileUnbound(isolate, &source2);
|
|
|
| @@ -14917,14 +14911,13 @@ TEST(CompileWithInvalidCachedData) {
|
| *exception_value);
|
|
|
| try_catch.Reset();
|
| - delete sd;
|
|
|
| // Overwrite function bar's start position with 200. The function entry
|
| // will not be found when searching for it by position and we should fall
|
| // back on eager compilation.
|
| // ScriptData does not take ownership of the buffers passed to it.
|
| - sd = v8::ScriptData::New(reinterpret_cast<const char*>(cd->data), cd->length);
|
| - sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
|
| + i::ScriptDataImpl sd2(reinterpret_cast<const char*>(cd->data), cd->length);
|
| + sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd2.Data()));
|
| sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
|
| 200;
|
| const char* script3 = "function foo(){ return 7;}\n"
|
| @@ -14932,11 +14925,10 @@ TEST(CompileWithInvalidCachedData) {
|
| v8::ScriptCompiler::Source source3(
|
| v8_str(script3),
|
| new v8::ScriptCompiler::CachedData(
|
| - reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
|
| + reinterpret_cast<const uint8_t*>(sd2.Data()), sd2.Length()));
|
| compiled_script =
|
| v8::ScriptCompiler::CompileUnbound(isolate, &source3);
|
| CHECK(!try_catch.HasCaught());
|
| - delete sd;
|
| }
|
|
|
|
|
|
|