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

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

Issue 1933: Generalized the EvalCache into a CompilationCache and enabled... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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
===================================================================
--- test/cctest/test-api.cc (revision 268)
+++ test/cctest/test-api.cc (working copy)
@@ -4880,7 +4880,7 @@
"\n"
"Foo();\n");
v8::Handle<v8::Script> script =
- v8::Script::Compile(source, v8::String::New("test.js"));
+ v8::Script::Compile(source, v8::String::New("test.js"));
v8::TryCatch try_catch;
v8::Handle<v8::Value> result = script->Run();
CHECK(result.IsEmpty());
@@ -4897,3 +4897,20 @@
v8::String::AsciiValue name(message->GetScriptResourceName());
CHECK_EQ("test.js", *name);
}
+
+
+THREADED_TEST(CompilationCache) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::Handle<v8::String> source0 = v8::String::New("1234");
+ v8::Handle<v8::String> source1 = v8::String::New("1234");
+ v8::Handle<v8::Script> script0 =
+ v8::Script::Compile(source0, v8::String::New("test.js"));
+ v8::Handle<v8::Script> script1 =
+ v8::Script::Compile(source1, v8::String::New("test.js"));
+ v8::Handle<v8::Script> script2 =
+ v8::Script::Compile(source0); // different origin
+ CHECK_EQ(1234, script0->Run()->Int32Value());
+ CHECK_EQ(1234, script1->Run()->Int32Value());
+ CHECK_EQ(1234, script2->Run()->Int32Value());
+}

Powered by Google App Engine
This is Rietveld 408576698