OLD | NEW |
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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 CHECK(!function->is_compiled() || function->IsOptimized()); | 996 CHECK(!function->is_compiled() || function->IsOptimized()); |
997 // Call foo to get it recompiled. | 997 // Call foo to get it recompiled. |
998 CompileRun("foo()"); | 998 CompileRun("foo()"); |
999 CHECK(function->shared()->is_compiled()); | 999 CHECK(function->shared()->is_compiled()); |
1000 CHECK(function->is_compiled()); | 1000 CHECK(function->is_compiled()); |
1001 } | 1001 } |
1002 | 1002 |
1003 | 1003 |
1004 TEST(TestCodeFlushingIncremental) { | 1004 TEST(TestCodeFlushingIncremental) { |
1005 // If we do not flush code this test is invalid. | 1005 // If we do not flush code this test is invalid. |
1006 if (!FLAG_flush_code) return; | 1006 if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return; |
1007 i::FLAG_allow_natives_syntax = true; | 1007 i::FLAG_allow_natives_syntax = true; |
1008 InitializeVM(); | 1008 InitializeVM(); |
1009 v8::HandleScope scope; | 1009 v8::HandleScope scope; |
1010 const char* source = "function foo() {" | 1010 const char* source = "function foo() {" |
1011 " var x = 42;" | 1011 " var x = 42;" |
1012 " var y = 42;" | 1012 " var y = 42;" |
1013 " var z = x + y;" | 1013 " var z = x + y;" |
1014 "};" | 1014 "};" |
1015 "foo()"; | 1015 "foo()"; |
1016 Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo"); | 1016 Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo"); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 | 1064 |
1065 // Simulate one final GC to make sure the candidate queue is sane. | 1065 // Simulate one final GC to make sure the candidate queue is sane. |
1066 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1066 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1067 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); | 1067 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); |
1068 CHECK(function->is_compiled() || !function->IsOptimized()); | 1068 CHECK(function->is_compiled() || !function->IsOptimized()); |
1069 } | 1069 } |
1070 | 1070 |
1071 | 1071 |
1072 TEST(TestCodeFlushingIncrementalScavenge) { | 1072 TEST(TestCodeFlushingIncrementalScavenge) { |
1073 // If we do not flush code this test is invalid. | 1073 // If we do not flush code this test is invalid. |
1074 if (!FLAG_flush_code) return; | 1074 if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return; |
1075 i::FLAG_allow_natives_syntax = true; | 1075 i::FLAG_allow_natives_syntax = true; |
1076 InitializeVM(); | 1076 InitializeVM(); |
1077 v8::HandleScope scope; | 1077 v8::HandleScope scope; |
1078 const char* source = "var foo = function() {" | 1078 const char* source = "var foo = function() {" |
1079 " var x = 42;" | 1079 " var x = 42;" |
1080 " var y = 42;" | 1080 " var y = 42;" |
1081 " var z = x + y;" | 1081 " var z = x + y;" |
1082 "};" | 1082 "};" |
1083 "foo();" | 1083 "foo();" |
1084 "var bar = function() {" | 1084 "var bar = function() {" |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 Handle<Object> call_function(call); | 2434 Handle<Object> call_function(call); |
2435 | 2435 |
2436 // Now we are ready to mess up the heap. | 2436 // Now we are ready to mess up the heap. |
2437 HEAP->CollectAllGarbage(Heap::kReduceMemoryFootprintMask); | 2437 HEAP->CollectAllGarbage(Heap::kReduceMemoryFootprintMask); |
2438 | 2438 |
2439 // Either heap verification caught the problem already or we go kaboom once | 2439 // Either heap verification caught the problem already or we go kaboom once |
2440 // the CallIC is executed the next time. | 2440 // the CallIC is executed the next time. |
2441 USE(global->SetProperty(*name, *call_function, NONE, kNonStrictMode)); | 2441 USE(global->SetProperty(*name, *call_function, NONE, kNonStrictMode)); |
2442 CompileRun("call();"); | 2442 CompileRun("call();"); |
2443 } | 2443 } |
OLD | NEW |