OLD | NEW |
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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 | 1022 |
1023 // Create a number of global contests which gets linked together. | 1023 // Create a number of global contests which gets linked together. |
1024 for (int i = 0; i < kNumTestContexts; i++) { | 1024 for (int i = 0; i < kNumTestContexts; i++) { |
1025 ctx[i] = v8::Context::New(); | 1025 ctx[i] = v8::Context::New(); |
1026 CHECK_EQ(i + 1, CountGlobalContexts()); | 1026 CHECK_EQ(i + 1, CountGlobalContexts()); |
1027 | 1027 |
1028 ctx[i]->Enter(); | 1028 ctx[i]->Enter(); |
1029 ctx[i]->Exit(); | 1029 ctx[i]->Exit(); |
1030 } | 1030 } |
1031 | 1031 |
| 1032 // Force compilation cache cleanup. |
| 1033 Heap::CollectAllGarbage(true); |
| 1034 |
1032 // Dispose the global contexts one by one. | 1035 // Dispose the global contexts one by one. |
1033 for (int i = 0; i < kNumTestContexts; i++) { | 1036 for (int i = 0; i < kNumTestContexts; i++) { |
1034 ctx[i].Dispose(); | 1037 ctx[i].Dispose(); |
1035 ctx[i].Clear(); | 1038 ctx[i].Clear(); |
1036 | 1039 |
1037 // Scavenge treats these references as strong. | 1040 // Scavenge treats these references as strong. |
1038 for (int j = 0; j < 10; j++) { | 1041 for (int j = 0; j < 10; j++) { |
1039 Heap::PerformScavenge(); | 1042 Heap::PerformScavenge(); |
1040 CHECK_EQ(kNumTestContexts - i, CountGlobalContexts()); | 1043 CHECK_EQ(kNumTestContexts - i, CountGlobalContexts()); |
1041 } | 1044 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 // with and without GCs while iterating the list. | 1079 // with and without GCs while iterating the list. |
1077 for (int i = 0; i < kNumTestContexts; i++) { | 1080 for (int i = 0; i < kNumTestContexts; i++) { |
1078 ctx[i] = v8::Context::New(); | 1081 ctx[i] = v8::Context::New(); |
1079 CHECK_EQ(i + 1, CountGlobalContexts()); | 1082 CHECK_EQ(i + 1, CountGlobalContexts()); |
1080 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); | 1083 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); |
1081 | 1084 |
1082 ctx[i]->Enter(); | 1085 ctx[i]->Enter(); |
1083 ctx[i]->Exit(); | 1086 ctx[i]->Exit(); |
1084 } | 1087 } |
1085 } | 1088 } |
OLD | NEW |