Reviewers: Kasper Lund, Description: Add an API test for v8::ScriptData::PreCompile() to make sure that v8::V8::Initialize() does not have to be called to allow pre-compilation. Currently this test would fail, which is why a workaround has been applied and a bug filed.
Please review this at http://codereview.chromium.org/11441 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M test/cctest/test-api.cc Index: test/cctest/test-api.cc =================================================================== --- test/cctest/test-api.cc (revision 778) +++ test/cctest/test-api.cc (working copy) @@ -5274,3 +5274,17 @@ value = CompileRun("obj.externalSymbol722 = 42"); v8::V8::SetExternalSymbolCallback(NULL); } + + +// This test verifies that pre-compilation (aka preparsing) can be called +// without initializing the whole VM. Thus we cannot run this test in a +// multi-threaded setup. +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(); + const char *script = "function foo(a) { return a+1; }"; + v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script)); + CHECK_NE(sd->Length(), 0); + CHECK_NE(sd->Data(), NULL); +} --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
