| OLD | NEW |
| 1 // Copyright 2011 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" |
| 11 #include "cctest.h" | 11 #include "cctest.h" |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1063 |
| 1064 v8::HandleScope scope; | 1064 v8::HandleScope scope; |
| 1065 v8::Persistent<v8::Context> ctx[kNumTestContexts]; | 1065 v8::Persistent<v8::Context> ctx[kNumTestContexts]; |
| 1066 | 1066 |
| 1067 CHECK_EQ(0, CountGlobalContexts()); | 1067 CHECK_EQ(0, CountGlobalContexts()); |
| 1068 | 1068 |
| 1069 // Create a number of global contests which gets linked together. | 1069 // Create a number of global contests which gets linked together. |
| 1070 for (int i = 0; i < kNumTestContexts; i++) { | 1070 for (int i = 0; i < kNumTestContexts; i++) { |
| 1071 ctx[i] = v8::Context::New(); | 1071 ctx[i] = v8::Context::New(); |
| 1072 | 1072 |
| 1073 bool opt = (FLAG_always_opt && !i::FLAG_always_full_compiler); | 1073 bool opt = (FLAG_always_opt && i::V8::UseCrankshaft()); |
| 1074 | 1074 |
| 1075 CHECK_EQ(i + 1, CountGlobalContexts()); | 1075 CHECK_EQ(i + 1, CountGlobalContexts()); |
| 1076 | 1076 |
| 1077 ctx[i]->Enter(); | 1077 ctx[i]->Enter(); |
| 1078 | 1078 |
| 1079 // Create a handle scope so no function objects get stuch in the outer | 1079 // Create a handle scope so no function objects get stuch in the outer |
| 1080 // handle scope | 1080 // handle scope |
| 1081 v8::HandleScope scope; | 1081 v8::HandleScope scope; |
| 1082 const char* source = "function f1() { };" | 1082 const char* source = "function f1() { };" |
| 1083 "function f2() { };" | 1083 "function f2() { };" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 CHECK_EQ(0, CountGlobalContexts()); | 1197 CHECK_EQ(0, CountGlobalContexts()); |
| 1198 | 1198 |
| 1199 // Create an number of contexts and check the length of the weak list both | 1199 // Create an number of contexts and check the length of the weak list both |
| 1200 // with and without GCs while iterating the list. | 1200 // with and without GCs while iterating the list. |
| 1201 for (int i = 0; i < kNumTestContexts; i++) { | 1201 for (int i = 0; i < kNumTestContexts; i++) { |
| 1202 ctx[i] = v8::Context::New(); | 1202 ctx[i] = v8::Context::New(); |
| 1203 CHECK_EQ(i + 1, CountGlobalContexts()); | 1203 CHECK_EQ(i + 1, CountGlobalContexts()); |
| 1204 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); | 1204 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 bool opt = (FLAG_always_opt && !i::FLAG_always_full_compiler); | 1207 bool opt = (FLAG_always_opt && i::V8::UseCrankshaft()); |
| 1208 | 1208 |
| 1209 // Compile a number of functions the length of the weak list of optimized | 1209 // Compile a number of functions the length of the weak list of optimized |
| 1210 // functions both with and without GCs while iterating the list. | 1210 // functions both with and without GCs while iterating the list. |
| 1211 ctx[0]->Enter(); | 1211 ctx[0]->Enter(); |
| 1212 const char* source = "function f1() { };" | 1212 const char* source = "function f1() { };" |
| 1213 "function f2() { };" | 1213 "function f2() { };" |
| 1214 "function f3() { };" | 1214 "function f3() { };" |
| 1215 "function f4() { };" | 1215 "function f4() { };" |
| 1216 "function f5() { };"; | 1216 "function f5() { };"; |
| 1217 CompileRun(source); | 1217 CompileRun(source); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 CHECK(helper.b_found()); | 1318 CHECK(helper.b_found()); |
| 1319 } | 1319 } |
| 1320 // ...but is now unreachable. | 1320 // ...but is now unreachable. |
| 1321 { | 1321 { |
| 1322 HeapIteratorTestHelper helper(a_saved, *b); | 1322 HeapIteratorTestHelper helper(a_saved, *b); |
| 1323 helper.IterateHeap(HeapIterator::kFilterUnreachable); | 1323 helper.IterateHeap(HeapIterator::kFilterUnreachable); |
| 1324 CHECK(!helper.a_found()); | 1324 CHECK(!helper.a_found()); |
| 1325 CHECK(helper.b_found()); | 1325 CHECK(helper.b_found()); |
| 1326 } | 1326 } |
| 1327 } | 1327 } |
| OLD | NEW |