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

Unified Diff: test/cctest/cctest.h

Issue 186723005: New Compilation API, part 1 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . 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/profile-generator-inl.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 c4066d0bde192efbbd7b52c0dbe7d6695cbd90aa..93195102d4a99d2b5fa7c40dbb8ee90e7098f0c4 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -313,17 +313,23 @@ static inline v8::Local<v8::Script> v8_compile(v8::Local<v8::String> x) {
}
-static inline v8::Local<v8::Script> CompileWithOrigin(const char* source,
- const char* origin_url) {
- v8::ScriptOrigin origin(v8_str(origin_url));
- return v8::Script::Compile(v8_str(source), &origin);
+static inline v8::Local<v8::Script> CompileWithOrigin(
+ v8::Local<v8::String> source, v8::Local<v8::String> origin_url) {
+ v8::ScriptOrigin origin(origin_url);
+ return v8::ScriptCompiler::Compile(
+ v8::Isolate::GetCurrent(), v8::ScriptCompiler::Source(source, origin));
}
static inline v8::Local<v8::Script> CompileWithOrigin(
v8::Local<v8::String> source, const char* origin_url) {
- v8::ScriptOrigin origin(v8_str(origin_url));
- return v8::Script::Compile(source, &origin);
+ return CompileWithOrigin(source, v8_str(origin_url));
+}
+
+
+static inline v8::Local<v8::Script> CompileWithOrigin(const char* source,
+ const char* origin_url) {
+ return CompileWithOrigin(v8_str(source), v8_str(origin_url));
}
@@ -339,11 +345,16 @@ static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) {
static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) {
- v8::Local<v8::String> script_source =
- v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), source);
- v8::ScriptData* preparse = v8::ScriptData::PreCompile(script_source);
- v8::Local<v8::Script> script =
- v8::Script::Compile(script_source, NULL, preparse);
+ 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, v8::ScriptCompiler::CachedData(
+ reinterpret_cast<const uint8_t*>(preparse->Data()),
+ preparse->Length()));
+ v8::Local<v8::Script> script = v8::ScriptCompiler::Compile(
+ isolate, v8::ScriptCompiler::Source(script_source));
v8::Local<v8::Value> result = script->Run();
delete preparse;
return result;
@@ -359,14 +370,24 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source,
v8::ScriptOrigin origin(v8_str(origin_url),
v8::Integer::New(isolate, line_number),
v8::Integer::New(isolate, column_number));
- return v8::Script::Compile(v8_str(source), &origin)->Run();
+ return v8::ScriptCompiler::Compile(
+ isolate, v8::ScriptCompiler::Source(v8_str(source), origin))
+ ->Run();
}
static inline v8::Local<v8::Value> CompileRunWithOrigin(
- const char* source, const char* origin_url) {
+ v8::Local<v8::String> source, const char* origin_url) {
v8::ScriptOrigin origin(v8_str(origin_url));
- return v8::Script::Compile(v8_str(source), &origin)->Run();
+ return v8::ScriptCompiler::Compile(
+ v8::Isolate::GetCurrent(),
+ v8::ScriptCompiler::Source(source, origin))->Run();
+}
+
+
+static inline v8::Local<v8::Value> CompileRunWithOrigin(
+ const char* source, const char* origin_url) {
+ return CompileRunWithOrigin(v8_str(source), origin_url);
}
« no previous file with comments | « src/profile-generator-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698