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

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

Issue 465026: Push bleeding_edge revision 3387, 3390 to trunk in order to fix test.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 years 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/version.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 3407)
+++ test/cctest/test-api.cc (working copy)
@@ -8416,13 +8416,8 @@
v8::internal::HeapIterator it;
while (it.has_next()) {
v8::internal::HeapObject* object = it.next();
- if (object->IsJSGlobalObject()) {
- count++;
- }
+ if (object->IsJSGlobalObject()) count++;
}
-#ifdef DEBUG
- if (count > 0) v8::internal::Heap::TracePathToGlobal();
-#endif
return count;
}
@@ -8432,10 +8427,16 @@
v8::HandleScope scope;
v8::Persistent<Context> context;
+ v8::Persistent<Context> other_context;
int gc_count;
+ // Create a context used to keep the code from aging in the compilation
+ // cache.
+ other_context = Context::New();
+
// Context-dependent context data creates reference from the compilation
// cache to the global object.
+ const char* source_simple = "1";
context = Context::New();
{
v8::HandleScope scope;
@@ -8443,44 +8444,52 @@
context->Enter();
Local<v8::String> obj = v8::String::New("");
context->SetData(obj);
- CompileRun("1");
+ CompileRun(source_simple);
context->Exit();
}
context.Dispose();
for (gc_count = 1; gc_count < 10; gc_count++) {
+ other_context->Enter();
+ CompileRun(source_simple);
+ other_context->Exit();
v8::internal::Heap::CollectAllGarbage(false);
- if (GetGlobalObjectsCount() == 0) break;
+ if (GetGlobalObjectsCount() == 1) break;
}
- CHECK_EQ(0, GetGlobalObjectsCount());
- CHECK_EQ(2, gc_count);
+ CHECK_GE(2, gc_count);
+ CHECK_EQ(1, GetGlobalObjectsCount());
// Eval in a function creates reference from the compilation cache to the
// global object.
+ const char* source_eval = "function f(){eval('1')}; f()";
context = Context::New();
{
v8::HandleScope scope;
context->Enter();
- CompileRun("function f(){eval('1')}; f()");
+ CompileRun(source_eval);
context->Exit();
}
context.Dispose();
for (gc_count = 1; gc_count < 10; gc_count++) {
+ other_context->Enter();
+ CompileRun(source_eval);
+ other_context->Exit();
v8::internal::Heap::CollectAllGarbage(false);
- if (GetGlobalObjectsCount() == 0) break;
+ if (GetGlobalObjectsCount() == 1) break;
}
- CHECK_GE(2, gc_count);
+ CHECK(gc_count <= 2);
CHECK_EQ(1, GetGlobalObjectsCount());
// Looking up the line number for an exception creates reference from the
// compilation cache to the global object.
+ const char* source_exception = "function f(){throw 1;} f()";
context = Context::New();
{
v8::HandleScope scope;
context->Enter();
v8::TryCatch try_catch;
- CompileRun("function f(){throw 1;}; f()");
+ CompileRun(source_exception);
CHECK(try_catch.HasCaught());
v8::Handle<v8::Message> message = try_catch.Message();
CHECK(!message.IsEmpty());
@@ -8489,9 +8498,14 @@
}
context.Dispose();
for (gc_count = 1; gc_count < 10; gc_count++) {
+ other_context->Enter();
+ CompileRun(source_exception);
+ other_context->Exit();
v8::internal::Heap::CollectAllGarbage(false);
- if (GetGlobalObjectsCount() == 0) break;
+ if (GetGlobalObjectsCount() == 1) break;
}
- CHECK_EQ(0, GetGlobalObjectsCount());
- CHECK_EQ(2, gc_count);
+ CHECK_GE(2, gc_count);
+ CHECK_EQ(1, GetGlobalObjectsCount());
+
+ other_context.Dispose();
}
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698