| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 447cd261ce9daba049a74c8cb4797641f2a246fb..74d1a021a549afe17612412740edec7cfcb30200 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -14844,6 +14844,7 @@ TEST(PreCompileDeserializationError) {
|
|
|
| // Attempts to deserialize bad data.
|
| TEST(PreCompileInvalidPreparseDataError) {
|
| + fprintf(stderr, "Test 1\n");
|
| v8::V8::Initialize();
|
| v8::Isolate* isolate = CcTest::isolate();
|
| LocalContext context;
|
| @@ -14851,9 +14852,11 @@ TEST(PreCompileInvalidPreparseDataError) {
|
|
|
| const char* script = "function foo(){ return 5;}\n"
|
| "function bar(){ return 6 + 7;} foo();";
|
| + fprintf(stderr, "Test 2\n");
|
| v8::ScriptData* sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
|
| isolate, script, v8::String::kNormalString, i::StrLength(script)));
|
| CHECK(!sd->HasError());
|
| + fprintf(stderr, "Test 3\n");
|
| // ScriptDataImpl private implementation details
|
| const int kHeaderSize = i::PreparseDataConstants::kHeaderSize;
|
| const int kFunctionEntrySize = i::FunctionEntry::kSize;
|
| @@ -14862,32 +14865,43 @@ TEST(PreCompileInvalidPreparseDataError) {
|
| unsigned* sd_data =
|
| reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
|
|
|
| + fprintf(stderr, "Test 4\n");
|
| // Overwrite function bar's end position with 0.
|
| sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0;
|
| + fprintf(stderr, "Test 5\n");
|
| v8::TryCatch try_catch;
|
|
|
| + fprintf(stderr, "Test 6\n");
|
| Local<String> source = String::NewFromUtf8(isolate, script);
|
| + fprintf(stderr, "Test 6b\n");
|
| Local<Script> compiled_script = Script::New(source, NULL, sd);
|
| + fprintf(stderr, "Test 7\n");
|
| CHECK(try_catch.HasCaught());
|
| String::Utf8Value exception_value(try_catch.Message()->Get());
|
| CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
|
| *exception_value);
|
|
|
| try_catch.Reset();
|
| + fprintf(stderr, "Test 8\n");
|
| delete sd;
|
| + fprintf(stderr, "Test 9\n");
|
|
|
| // 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.
|
| sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
|
| isolate, script, v8::String::kNormalString, i::StrLength(script)));
|
| + fprintf(stderr, "Test 10\n");
|
| sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
|
| sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
|
| 200;
|
| + fprintf(stderr, "Test 11\n");
|
| compiled_script = Script::New(source, NULL, sd);
|
| CHECK(!try_catch.HasCaught());
|
|
|
| + fprintf(stderr, "Test 12\n");
|
| delete sd;
|
| + fprintf(stderr, "Test 13\n");
|
| }
|
|
|
|
|
| @@ -21965,3 +21979,16 @@ TEST(TestFunctionCallOptimization) {
|
| checker.Run(true, false);
|
| checker.Run(false, false);
|
| }
|
| +
|
| +void DoStuff(i::Vector<const char*> args) {
|
| + fprintf(stderr, "len is %d\n", args.length());
|
| +}
|
| +
|
| +
|
| +TEST(Foo) {
|
| + const char* element[1] = { "foo" };
|
| + i::Vector<const char*> args(element, 1);
|
| + fprintf(stderr, "len is %d\n", args.length());
|
| + DoStuff(args);
|
| + CHECK(false);
|
| +}
|
|
|