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

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

Issue 10823082: Make incremental marking clear type feedback cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | « src/objects-visiting-inl.h ('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 "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 CompileRun(source); 1978 CompileRun(source);
1979 Handle<JSFunction> g = 1979 Handle<JSFunction> g =
1980 v8::Utils::OpenHandle( 1980 v8::Utils::OpenHandle(
1981 *v8::Handle<v8::Function>::Cast( 1981 *v8::Handle<v8::Function>::Cast(
1982 v8::Context::GetCurrent()->Global()->Get(v8_str("g")))); 1982 v8::Context::GetCurrent()->Global()->Get(v8_str("g"))));
1983 1983
1984 AssertNoAllocation no_alloc; 1984 AssertNoAllocation no_alloc;
1985 g->shared()->PrintLn(); 1985 g->shared()->PrintLn();
1986 } 1986 }
1987 #endif // OBJECT_PRINT 1987 #endif // OBJECT_PRINT
1988
1989
1990 TEST(IncrementalMarkingClearsTypeFeedbackCells) {
1991 if (i::FLAG_always_opt) return;
1992 InitializeVM();
1993 v8::HandleScope scope;
1994 v8::Local<v8::Value> fun1, fun2;
1995
1996 {
1997 LocalContext env;
1998 CompileRun("function fun() {};");
1999 fun1 = env->Global()->Get(v8_str("fun"));
2000 }
2001
2002 {
2003 LocalContext env;
2004 CompileRun("function fun() {};");
2005 fun2 = env->Global()->Get(v8_str("fun"));
2006 }
2007
2008 // Prepare function f that contains type feedback for closures
2009 // originating from two different global contexts.
2010 v8::Context::GetCurrent()->Global()->Set(v8_str("fun1"), fun1);
2011 v8::Context::GetCurrent()->Global()->Set(v8_str("fun2"), fun2);
2012 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);");
2013 Handle<JSFunction> f =
2014 v8::Utils::OpenHandle(
2015 *v8::Handle<v8::Function>::Cast(
2016 v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
2017 Handle<TypeFeedbackCells> cells(TypeFeedbackInfo::cast(
2018 f->shared()->code()->type_feedback_info())->type_feedback_cells());
2019
2020 CHECK_EQ(2, cells->CellCount());
2021 CHECK(cells->Cell(0)->value()->IsJSFunction());
2022 CHECK(cells->Cell(1)->value()->IsJSFunction());
2023
2024 // Go through all incremental marking steps in one swoop.
2025 IncrementalMarking* marking = HEAP->incremental_marking();
2026 CHECK(marking->IsStopped());
2027 marking->Start();
2028 CHECK(marking->IsMarking());
2029 while (!marking->IsComplete()) {
2030 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
2031 }
2032 CHECK(marking->IsComplete());
2033 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
2034 CHECK(marking->IsStopped());
2035
2036 CHECK_EQ(2, cells->CellCount());
2037 CHECK(cells->Cell(0)->value()->IsTheHole());
2038 CHECK(cells->Cell(1)->value()->IsTheHole());
2039 }
OLDNEW
« no previous file with comments | « src/objects-visiting-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698