| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index a24be6eab0e63e31be8c4be7f999d07e3d245216..c26c4455d606d41ec1da60269f400f0faf9d51ea 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -14003,9 +14003,10 @@ TEST(PreCompile) {
|
| // TODO(155): This test would break without the initialization of V8. This is
|
| // a workaround for now to make this test not fail.
|
| v8::V8::Initialize();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| const char* script = "function foo(a) { return a+1; }";
|
| v8::ScriptData* sd =
|
| - v8::ScriptData::PreCompile(script, i::StrLength(script));
|
| + v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
|
| CHECK_NE(sd->Length(), 0);
|
| CHECK_NE(sd->Data(), NULL);
|
| CHECK(!sd->HasError());
|
| @@ -14015,9 +14016,10 @@ TEST(PreCompile) {
|
|
|
| TEST(PreCompileWithError) {
|
| v8::V8::Initialize();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| const char* script = "function foo(a) { return 1 * * 2; }";
|
| v8::ScriptData* sd =
|
| - v8::ScriptData::PreCompile(script, i::StrLength(script));
|
| + v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
|
| CHECK(sd->HasError());
|
| delete sd;
|
| }
|
| @@ -14025,9 +14027,10 @@ TEST(PreCompileWithError) {
|
|
|
| TEST(Regress31661) {
|
| v8::V8::Initialize();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| const char* script = " The Definintive Guide";
|
| v8::ScriptData* sd =
|
| - v8::ScriptData::PreCompile(script, i::StrLength(script));
|
| + v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
|
| CHECK(sd->HasError());
|
| delete sd;
|
| }
|
| @@ -14036,9 +14039,10 @@ TEST(Regress31661) {
|
| // Tests that ScriptData can be serialized and deserialized.
|
| TEST(PreCompileSerialization) {
|
| v8::V8::Initialize();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| const char* script = "function foo(a) { return a+1; }";
|
| v8::ScriptData* sd =
|
| - v8::ScriptData::PreCompile(script, i::StrLength(script));
|
| + v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
|
|
|
| // Serialize.
|
| int serialized_data_length = sd->Length();
|
| @@ -14075,13 +14079,14 @@ TEST(PreCompileDeserializationError) {
|
| // Attempts to deserialize bad data.
|
| TEST(PreCompileInvalidPreparseDataError) {
|
| v8::V8::Initialize();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| LocalContext context;
|
| v8::HandleScope scope(context->GetIsolate());
|
|
|
| const char* script = "function foo(){ return 5;}\n"
|
| "function bar(){ return 6 + 7;} foo();";
|
| v8::ScriptData* sd =
|
| - v8::ScriptData::PreCompile(script, i::StrLength(script));
|
| + v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
|
| CHECK(!sd->HasError());
|
| // ScriptDataImpl private implementation details
|
| const int kHeaderSize = i::PreparseDataConstants::kHeaderSize;
|
| @@ -14107,7 +14112,7 @@ TEST(PreCompileInvalidPreparseDataError) {
|
| // 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(script, i::StrLength(script));
|
| + sd = v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
|
| sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
|
| sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
|
| 200;
|
| @@ -14122,12 +14127,13 @@ TEST(PreCompileInvalidPreparseDataError) {
|
| // the same results (at least for one trivial case).
|
| TEST(PreCompileAPIVariationsAreSame) {
|
| v8::V8::Initialize();
|
| - v8::HandleScope scope(CcTest::isolate());
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| + v8::HandleScope scope(isolate);
|
|
|
| const char* cstring = "function foo(a) { return a+1; }";
|
|
|
| v8::ScriptData* sd_from_cstring =
|
| - v8::ScriptData::PreCompile(cstring, i::StrLength(cstring));
|
| + v8::ScriptData::PreCompile(isolate, cstring, i::StrLength(cstring));
|
|
|
| TestAsciiResource* resource = new TestAsciiResource(cstring);
|
| v8::ScriptData* sd_from_external_string = v8::ScriptData::PreCompile(
|
|
|