Revision: 13204
Author: [email protected]
Date: Wed Dec 12 02:46:01 2012
Log: Add regression test for r13195.
This is a regression test for the fix in r13195 which made sure that we
correctly clear the optimized code map even when incremental marking is
running.
[email protected],[email protected]
BUG=chromium:165495
TEST=cctest/test-heap/Regress165495
Review URL: https://codereview.chromium.org/11543015
http://code.google.com/p/v8/source/detail?r=13204
Modified:
/branches/bleeding_edge/test/cctest/test-heap.cc
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Tue Dec 11 02:14:01
2012
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Wed Dec 12 02:46:01
2012
@@ -2571,3 +2571,48 @@
// Unoptimized code is missing and the deoptimizer will go ballistic.
CompileRun("g('bozo');");
}
+
+
+TEST(Regress165495) {
+ 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::kAbortIncrementalMarkingMask);
+
+ // Prepare an optimized closure that the optimized code map will get
+ // populated. Then age the unoptimized code to trigger code flushing
+ // but make sure the optimized code is unreachable.
+ {
+ HandleScope inner_scope;
+ CompileRun("function mkClosure() {"
+ " return function(x) { return x + 1; };"
+ "}"
+ "var f = mkClosure();"
+ "f(1); f(2);"
+ "%OptimizeFunctionOnNextCall(f); f(3);");
+
+ Handle<JSFunction> f =
+ v8::Utils::OpenHandle(
+ *v8::Handle<v8::Function>::Cast(
+ v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
+ CHECK(f->is_compiled());
+ const int kAgingThreshold = 6;
+ for (int i = 0; i < kAgingThreshold; i++) {
+ f->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2));
+ }
+
+ CompileRun("f = null;");
+ }
+
+ // Simulate incremental marking so that unoptimized code is flushed
+ // even though it still is cached in the optimized code map.
+ SimulateIncrementalMarking();
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+
+ // Make a new closure that will get code installed from the code map.
+ // Unoptimized code is missing and the deoptimizer will go ballistic.
+ CompileRun("var g = mkClosure(); g('bozo');");
+}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev