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

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

Issue 2632003: Flushing of code from functions that we expect not to use again.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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-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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 return; 950 return;
951 } 951 }
952 CHECK(Heap::old_pointer_space()->Contains(clone->address())); 952 CHECK(Heap::old_pointer_space()->Contains(clone->address()));
953 953
954 // Step 5: verify validity of region dirty marks. 954 // Step 5: verify validity of region dirty marks.
955 Address clone_addr = clone->address(); 955 Address clone_addr = clone->address();
956 Page* page = Page::FromAddress(clone_addr); 956 Page* page = Page::FromAddress(clone_addr);
957 // Check that region covering inobject property 1 is marked dirty. 957 // Check that region covering inobject property 1 is marked dirty.
958 CHECK(page->IsRegionDirty(clone_addr + (object_size - kPointerSize))); 958 CHECK(page->IsRegionDirty(clone_addr + (object_size - kPointerSize)));
959 } 959 }
960
961 TEST(TestCodeFlushing) {
962 i::FLAG_allow_natives_syntax = true;
963 InitializeVM();
964 v8::HandleScope scope;
965 const char* source = "function foo() {"
966 " var x = 42;"
967 " var y = 42;"
968 " var z = x + y;"
969 "};"
970 "foo()";
971 Handle<String> foo_name = Factory::LookupAsciiSymbol("foo");
972
973 // This compile will add the code to the compilation cache.
974 CompileRun(source);
975
976 // Check function is compiled.
977 Object* func_value = Top::context()->global()->GetProperty(*foo_name);
978 CHECK(func_value->IsJSFunction());
979 Handle<JSFunction> function(JSFunction::cast(func_value));
980 CHECK(function->shared()->is_compiled());
981
982 Heap::CollectAllGarbage(true);
983 Heap::CollectAllGarbage(true);
984
985 // foo should still be in the compilation cache and therefore not
986 // have been removed.
987 CHECK(function->shared()->is_compiled());
988 Heap::CollectAllGarbage(true);
989 Heap::CollectAllGarbage(true);
990 Heap::CollectAllGarbage(true);
991 Heap::CollectAllGarbage(true);
992
993 // foo should no longer be in the compilation cache
994 CHECK(!function->shared()->is_compiled());
995 // Call foo to get it recompiled.
996 CompileRun("foo()");
997 CHECK(function->shared()->is_compiled());
998 }
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698