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

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

Issue 11543015: Add regression test for r13195. (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 | « no previous file | 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 1b857cd1b504b9494edd228f0f9d5f34c6d12057..030f1f8720eecc6fe3ecb7f69727f05deb6a498b 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2571,3 +2571,48 @@ TEST(Regress159140) {
// 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');");
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698