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 "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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 old_capacity = new_space->Capacity(); | 1321 old_capacity = new_space->Capacity(); |
1322 new_space->Grow(); | 1322 new_space->Grow(); |
1323 new_capacity = new_space->Capacity(); | 1323 new_capacity = new_space->Capacity(); |
1324 CHECK(2 * old_capacity == new_capacity); | 1324 CHECK(2 * old_capacity == new_capacity); |
1325 FillUpNewSpace(new_space); | 1325 FillUpNewSpace(new_space); |
1326 HEAP->CollectAllAvailableGarbage(); | 1326 HEAP->CollectAllAvailableGarbage(); |
1327 new_capacity = new_space->Capacity(); | 1327 new_capacity = new_space->Capacity(); |
1328 CHECK(old_capacity == new_capacity); | 1328 CHECK(old_capacity == new_capacity); |
1329 } | 1329 } |
1330 | 1330 |
1331 // This just checks the contract of the IdleNotification() function, | |
1332 // and does not verify that it does reasonable work. | |
1333 TEST(IdleNotificationAdvancesIncrementalMarking) { | |
1334 if (!FLAG_incremental_marking || !FLAG_incremental_marking_steps) return; | |
1335 InitializeVM(); | |
1336 v8::HandleScope scope; | |
1337 const char* source = "function binom(n, m) {" | |
1338 " var C = [[1]];" | |
1339 " for (var i = 1; i <= n; ++i) {" | |
1340 " C[i] = [1];" | |
1341 " for (var j = 1; j < i; ++j) {" | |
1342 " C[i][j] = C[i-1][j-1] + C[i-1][j];" | |
1343 " }" | |
1344 " C[i][i] = 1;" | |
1345 " }" | |
1346 " return C[n][m];" | |
1347 "};" | |
1348 "binom(1000, 500)"; | |
1349 { | |
1350 AlwaysAllocateScope aa_scope; | |
1351 CompileRun(source); | |
1352 } | |
1353 intptr_t old_size = HEAP->SizeOfObjects(); | |
1354 bool no_idle_work = v8::V8::IdleNotification(900); | |
1355 while (!v8::V8::IdleNotification(900)) ; | |
1356 intptr_t new_size = HEAP->SizeOfObjects(); | |
1357 CHECK(no_idle_work || new_size < old_size); | |
1358 } | |
1359 | |
1360 | 1331 |
1361 static int NumberOfGlobalObjects() { | 1332 static int NumberOfGlobalObjects() { |
1362 int count = 0; | 1333 int count = 0; |
1363 HeapIterator iterator; | 1334 HeapIterator iterator; |
1364 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1335 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1365 if (obj->IsGlobalObject()) count++; | 1336 if (obj->IsGlobalObject()) count++; |
1366 } | 1337 } |
1367 return count; | 1338 return count; |
1368 } | 1339 } |
1369 | 1340 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 // clearing correctly records slots in prototype transition array. | 1590 // clearing correctly records slots in prototype transition array. |
1620 i::FLAG_always_compact = true; | 1591 i::FLAG_always_compact = true; |
1621 Handle<Map> map(baseObject->map()); | 1592 Handle<Map> map(baseObject->map()); |
1622 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); | 1593 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); |
1623 CHECK(space->LastPage()->Contains(prototype->address())); | 1594 CHECK(space->LastPage()->Contains(prototype->address())); |
1624 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); | 1595 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); |
1625 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); | 1596 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1626 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1597 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1627 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); | 1598 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1628 } | 1599 } |
OLD | NEW |