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

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

Issue 11451038: Fix candidate eviction in code flusher. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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/mark-compact.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-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index dc5247d19709ceb93d759af578a722c84cd1cf86..a0237dc538eb52135e35022442e515f717b1ad9a 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2508,3 +2508,63 @@ TEST(Regression144230) {
USE(global->SetProperty(*name, *call_function, NONE, kNonStrictMode));
CompileRun("call();");
}
+
+
+TEST(Regress159140) {
+ i::FLAG_allow_natives_syntax = true;
+ i::FLAG_flush_code_incrementally = true;
+ InitializeVM();
+ v8::HandleScope scope;
+
+ // Perform one initial GC to enable code flushing.
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+
+ // Prepare several closures that are all eligible for code flushing
+ // because all reachable ones are not optimized. Make sure that the
+ // optimized code object is directly reachable through a handle so
+ // that it is marked black during incremental marking.
+ Handle<Code> code;
+ {
+ HandleScope inner_scope;
+ CompileRun("function h(x) {}"
+ "function mkClosure() {"
+ " return function(x) { return x + 1; };"
+ "}"
+ "var f = mkClosure();"
+ "var g = mkClosure();"
+ "f(1); f(2);"
+ "g(1); g(2);"
+ "h(1); h(2);"
+ "%OptimizeFunctionOnNextCall(f); f(3);"
+ "%OptimizeFunctionOnNextCall(h); h(3);");
+
+ Handle<JSFunction> f =
+ v8::Utils::OpenHandle(
+ *v8::Handle<v8::Function>::Cast(
+ v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
+ CHECK(f->is_compiled());
+ CompileRun("f = null;");
+
+ Handle<JSFunction> g =
+ v8::Utils::OpenHandle(
+ *v8::Handle<v8::Function>::Cast(
+ v8::Context::GetCurrent()->Global()->Get(v8_str("g"))));
+ CHECK(g->is_compiled());
+ const int kAgingThreshold = 6;
+ for (int i = 0; i < kAgingThreshold; i++) {
+ g->code()->MakeOlder(static_cast<MarkingParity>(i % 2));
+ }
+
+ code = inner_scope.CloseAndEscape(Handle<Code>(f->code()));
+ }
+
+ // Simulate incremental marking so that the functions are enqueued as
+ // code flushing candidates. Then optimize oneo function. Finally
+ // finish the GC to complete code flushing.
+ SimulateIncrementalMarking();
+ CompileRun("%OptimizeFunctionOnNextCall(g); g(3);");
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+
+ // Unoptimized code is missing and the deoptimizer will go ballistic.
+ CompileRun("g('bozo');");
+}
« no previous file with comments | « src/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698