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

Side by Side Diff: test/cctest/test-heap.cc

Issue 12040042: Merged r13480, r13481 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 11 months 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 | « test/cctest/test-global-object.cc ('k') | 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 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 2771
2772 // Give the array a name, making sure not to allocate strings. 2772 // Give the array a name, making sure not to allocate strings.
2773 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); 2773 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array);
2774 v8::Context::GetCurrent()->Global()->Set(array_name, array_obj); 2774 v8::Context::GetCurrent()->Global()->Set(array_name, array_obj);
2775 2775
2776 // This should crash with a protection violation if we are running a build 2776 // This should crash with a protection violation if we are running a build
2777 // with the bug. 2777 // with the bug.
2778 AlwaysAllocateScope aa_scope; 2778 AlwaysAllocateScope aa_scope;
2779 v8::Script::Compile(mote_code_string)->Run(); 2779 v8::Script::Compile(mote_code_string)->Run();
2780 } 2780 }
2781
2782
2783 TEST(Regress168801) {
2784 i::FLAG_always_compact = true;
2785 i::FLAG_cache_optimized_code = false;
2786 i::FLAG_allow_natives_syntax = true;
2787 i::FLAG_flush_code_incrementally = true;
2788 InitializeVM();
2789 v8::HandleScope scope;
2790
2791 // Perform one initial GC to enable code flushing.
2792 HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
2793
2794 // Ensure the code ends up on an evacuation candidate.
2795 SimulateFullSpace(HEAP->code_space());
2796
2797 // Prepare an unoptimized function that is eligible for code flushing.
2798 Handle<JSFunction> function;
2799 {
2800 HandleScope inner_scope;
2801 CompileRun("function mkClosure() {"
2802 " return function(x) { return x + 1; };"
2803 "}"
2804 "var f = mkClosure();"
2805 "f(1); f(2);");
2806
2807 Handle<JSFunction> f =
2808 v8::Utils::OpenHandle(
2809 *v8::Handle<v8::Function>::Cast(
2810 v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
2811 CHECK(f->is_compiled());
2812 const int kAgingThreshold = 6;
2813 for (int i = 0; i < kAgingThreshold; i++) {
2814 f->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2));
2815 }
2816
2817 function = inner_scope.CloseAndEscape(handle(*f, ISOLATE));
2818 }
2819
2820 // Simulate incremental marking so that unoptimized function is enqueued as a
2821 // candidate for code flushing. The shared function info however will not be
2822 // explicitly enqueued.
2823 SimulateIncrementalMarking();
2824
2825 // Now optimize the function so that it is taken off the candidate list.
2826 {
2827 HandleScope inner_scope;
2828 CompileRun("%OptimizeFunctionOnNextCall(f); f(3);");
2829 }
2830
2831 // This cycle will bust the heap and subsequent cycles will go ballistic.
2832 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
2833 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
2834 }
OLDNEW
« no previous file with comments | « test/cctest/test-global-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698