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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "compilation-cache.h" 7 #include "compilation-cache.h"
8 #include "execution.h" 8 #include "execution.h"
9 #include "factory.h" 9 #include "factory.h"
10 #include "macro-assembler.h" 10 #include "macro-assembler.h"
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 // Simulate incremental marking so that the functions are enqueued as 2564 // Simulate incremental marking so that the functions are enqueued as
2565 // code flushing candidates. Then optimize one function. Finally 2565 // code flushing candidates. Then optimize one function. Finally
2566 // finish the GC to complete code flushing. 2566 // finish the GC to complete code flushing.
2567 SimulateIncrementalMarking(); 2567 SimulateIncrementalMarking();
2568 CompileRun("%OptimizeFunctionOnNextCall(g); g(3);"); 2568 CompileRun("%OptimizeFunctionOnNextCall(g); g(3);");
2569 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 2569 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
2570 2570
2571 // Unoptimized code is missing and the deoptimizer will go ballistic. 2571 // Unoptimized code is missing and the deoptimizer will go ballistic.
2572 CompileRun("g('bozo');"); 2572 CompileRun("g('bozo');");
2573 } 2573 }
2574
2575
2576 TEST(Regress165495) {
2577 i::FLAG_allow_natives_syntax = true;
2578 i::FLAG_flush_code_incrementally = true;
2579 InitializeVM();
2580 v8::HandleScope scope;
2581
2582 // Perform one initial GC to enable code flushing.
2583 HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
2584
2585 // Prepare an optimized closure that the optimized code map will get
2586 // populated. Then age the unoptimized code to trigger code flushing
2587 // but make sure the optimized code is unreachable.
2588 {
2589 HandleScope inner_scope;
2590 CompileRun("function mkClosure() {"
2591 " return function(x) { return x + 1; };"
2592 "}"
2593 "var f = mkClosure();"
2594 "f(1); f(2);"
2595 "%OptimizeFunctionOnNextCall(f); f(3);");
2596
2597 Handle<JSFunction> f =
2598 v8::Utils::OpenHandle(
2599 *v8::Handle<v8::Function>::Cast(
2600 v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
2601 CHECK(f->is_compiled());
2602 const int kAgingThreshold = 6;
2603 for (int i = 0; i < kAgingThreshold; i++) {
2604 f->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2));
2605 }
2606
2607 CompileRun("f = null;");
2608 }
2609
2610 // Simulate incremental marking so that unoptimized code is flushed
2611 // even though it still is cached in the optimized code map.
2612 SimulateIncrementalMarking();
2613 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
2614
2615 // Make a new closure that will get code installed from the code map.
2616 // Unoptimized code is missing and the deoptimizer will go ballistic.
2617 CompileRun("var g = mkClosure(); g('bozo');");
2618 }
OLDNEW
« 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