Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1078)

Unified Diff: test/cctest/cctest.h

Issue 225743002: Update tests to use the new compilation API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 6359835235c069d8e2807ce667151775381aa7f1..b4e31f26df5e3a1fe7976a49f7c654b34e5c084c 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -346,19 +346,13 @@ static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) {
static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) {
+ // Compile once just to get the preparse data, then compile the second time
+ // using the data.
v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::Local<v8::String> source_string =
- v8::String::NewFromUtf8(isolate, source);
- v8::ScriptData* preparse = v8::ScriptData::PreCompile(source_string);
- v8::ScriptCompiler::Source script_source(
- source_string, new v8::ScriptCompiler::CachedData(
- reinterpret_cast<const uint8_t*>(preparse->Data()),
- preparse->Length()));
- v8::Local<v8::Script> script =
- v8::ScriptCompiler::Compile(isolate, &script_source);
- v8::Local<v8::Value> result = script->Run();
- delete preparse;
- return result;
+ v8::ScriptCompiler::Source script_source(v8_str(source));
+ v8::ScriptCompiler::Compile(isolate, &script_source,
+ v8::ScriptCompiler::kProduceDataToCache);
+ return v8::ScriptCompiler::Compile(isolate, &script_source)->Run();
}
« no previous file with comments | « src/parser.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698