OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 old_capacity = new_space->Capacity(); | 1283 old_capacity = new_space->Capacity(); |
1284 new_space->Grow(); | 1284 new_space->Grow(); |
1285 new_capacity = new_space->Capacity(); | 1285 new_capacity = new_space->Capacity(); |
1286 CHECK(2 * old_capacity == new_capacity); | 1286 CHECK(2 * old_capacity == new_capacity); |
1287 FillUpNewSpace(new_space); | 1287 FillUpNewSpace(new_space); |
1288 HEAP->CollectAllAvailableGarbage(); | 1288 HEAP->CollectAllAvailableGarbage(); |
1289 new_capacity = new_space->Capacity(); | 1289 new_capacity = new_space->Capacity(); |
1290 CHECK(old_capacity == new_capacity); | 1290 CHECK(old_capacity == new_capacity); |
1291 } | 1291 } |
1292 | 1292 |
1293 | 1293 // This just checks the contract of the IdleNotification() function, |
| 1294 // and does not verify that it does reasonable work. |
1294 TEST(IdleNotificationAdvancesIncrementalMarking) { | 1295 TEST(IdleNotificationAdvancesIncrementalMarking) { |
1295 if (!FLAG_incremental_marking || !FLAG_incremental_marking_steps) return; | 1296 if (!FLAG_incremental_marking || !FLAG_incremental_marking_steps) return; |
1296 InitializeVM(); | 1297 InitializeVM(); |
1297 v8::HandleScope scope; | 1298 v8::HandleScope scope; |
1298 const char* source = "function binom(n, m) {" | 1299 const char* source = "function binom(n, m) {" |
1299 " var C = [[1]];" | 1300 " var C = [[1]];" |
1300 " for (var i = 1; i <= n; ++i) {" | 1301 " for (var i = 1; i <= n; ++i) {" |
1301 " C[i] = [1];" | 1302 " C[i] = [1];" |
1302 " for (var j = 1; j < i; ++j) {" | 1303 " for (var j = 1; j < i; ++j) {" |
1303 " C[i][j] = C[i-1][j-1] + C[i-1][j];" | 1304 " C[i][j] = C[i-1][j-1] + C[i-1][j];" |
1304 " }" | 1305 " }" |
1305 " C[i][i] = 1;" | 1306 " C[i][i] = 1;" |
1306 " }" | 1307 " }" |
1307 " return C[n][m];" | 1308 " return C[n][m];" |
1308 "};" | 1309 "};" |
1309 "binom(1000, 500)"; | 1310 "binom(1000, 500)"; |
1310 { | 1311 { |
1311 AlwaysAllocateScope aa_scope; | 1312 AlwaysAllocateScope aa_scope; |
1312 CompileRun(source); | 1313 CompileRun(source); |
1313 } | 1314 } |
1314 intptr_t old_size = HEAP->SizeOfObjects(); | 1315 intptr_t old_size = HEAP->SizeOfObjects(); |
1315 bool no_idle_work = v8::V8::IdleNotification(900); | 1316 bool no_idle_work = v8::V8::IdleNotification(900); |
1316 while (!v8::V8::IdleNotification(900)) ; | 1317 while (!v8::V8::IdleNotification(900)) ; |
1317 intptr_t new_size = HEAP->SizeOfObjects(); | 1318 intptr_t new_size = HEAP->SizeOfObjects(); |
1318 CHECK(no_idle_work || new_size < 3 * old_size / 4); | 1319 CHECK(no_idle_work || new_size < old_size); |
1319 } | 1320 } |
OLD | NEW |