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

Unified Diff: test/cctest/test-api.cc

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
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index fbb6e56e9270e2651dad911d2f10f91b47cb042a..472a38c3f00cc9049f9f8aac21f0478a7879b3b0 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -14842,8 +14842,13 @@ TEST(PreCompileInvalidPreparseDataError) {
sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0;
v8::TryCatch try_catch;
- Local<String> source = String::NewFromUtf8(isolate, script);
- Local<Script> compiled_script = Script::New(source, NULL, sd);
+ v8::ScriptCompiler::Source script_source(
+ String::NewFromUtf8(isolate, script),
+ v8::ScriptCompiler::CachedData(
+ reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
+ Local<v8::ContextUnboundScript> compiled_script =
+ v8::ScriptCompiler::CompileContextUnbound(isolate, script_source);
+
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Message()->Get());
CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
@@ -14860,7 +14865,12 @@ TEST(PreCompileInvalidPreparseDataError) {
sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
200;
- compiled_script = Script::New(source, NULL, sd);
+ v8::ScriptCompiler::Source script_source2(
+ String::NewFromUtf8(isolate, script),
+ v8::ScriptCompiler::CachedData(
+ reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
+ compiled_script =
+ v8::ScriptCompiler::CompileContextUnbound(isolate, script_source2);
CHECK(!try_catch.HasCaught());
delete sd;
@@ -16974,8 +16984,10 @@ THREADED_TEST(ScriptContextDependence) {
const char *source = "foo";
v8::Handle<v8::Script> dep =
v8_compile(source);
- v8::Handle<v8::Script> indep =
- v8::Script::New(v8::String::NewFromUtf8(c1->GetIsolate(), source));
+ v8::Handle<v8::ContextUnboundScript> indep =
+ v8::ScriptCompiler::CompileContextUnbound(
+ c1->GetIsolate(), v8::ScriptCompiler::Source(v8::String::NewFromUtf8(
+ c1->GetIsolate(), source)));
c1->Global()->Set(v8::String::NewFromUtf8(c1->GetIsolate(), "foo"),
v8::Integer::New(c1->GetIsolate(), 100));
CHECK_EQ(dep->Run()->Int32Value(), 100);
@@ -16997,7 +17009,9 @@ THREADED_TEST(StackTrace) {
v8::String::NewFromUtf8(context->GetIsolate(), source);
v8::Handle<v8::String> origin =
v8::String::NewFromUtf8(context->GetIsolate(), "stack-trace-test");
- v8::Script::New(src, origin)->Run();
+ v8::ScriptCompiler::CompileContextUnbound(
+ context->GetIsolate(),
+ v8::ScriptCompiler::Source(src, v8::ScriptOrigin(origin)))->Run();
CHECK(try_catch.HasCaught());
v8::String::Utf8Value stack(try_catch.StackTrace());
CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL);
@@ -17104,7 +17118,9 @@ TEST(CaptureStackTrace) {
v8::Handle<v8::String> overview_src =
v8::String::NewFromUtf8(isolate, overview_source);
v8::Handle<Value> overview_result(
- v8::Script::New(overview_src, origin)->Run());
+ v8::ScriptCompiler::CompileContextUnbound(
+ isolate, v8::ScriptCompiler::Source(
+ overview_src, v8::ScriptOrigin(origin)))->Run());
CHECK(!overview_result.IsEmpty());
CHECK(overview_result->IsObject());
@@ -17123,8 +17139,9 @@ TEST(CaptureStackTrace) {
v8::Handle<v8::Integer> line_offset = v8::Integer::New(isolate, 3);
v8::Handle<v8::Integer> column_offset = v8::Integer::New(isolate, 5);
v8::ScriptOrigin detailed_origin(origin, line_offset, column_offset);
- v8::Handle<v8::Script> detailed_script(
- v8::Script::New(detailed_src, &detailed_origin));
+ v8::Handle<v8::ContextUnboundScript> detailed_script(
+ v8::ScriptCompiler::CompileContextUnbound(
+ isolate, v8::ScriptCompiler::Source(detailed_src, detailed_origin)));
v8::Handle<Value> detailed_result(detailed_script->Run());
CHECK(!detailed_result.IsEmpty());
CHECK(detailed_result->IsObject());
« src/api.h ('K') | « test/cctest/cctest.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698