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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 HEAP->CollectAllAvailableGarbage(); | 1513 HEAP->CollectAllAvailableGarbage(); |
1514 CHECK_EQ(2, NumberOfGlobalObjects()); | 1514 CHECK_EQ(2, NumberOfGlobalObjects()); |
1515 ctx2.Dispose(); | 1515 ctx2.Dispose(); |
1516 HEAP->CollectAllAvailableGarbage(); | 1516 HEAP->CollectAllAvailableGarbage(); |
1517 CHECK_EQ(0, NumberOfGlobalObjects()); | 1517 CHECK_EQ(0, NumberOfGlobalObjects()); |
1518 } | 1518 } |
1519 | 1519 |
1520 | 1520 |
1521 TEST(InstanceOfStubWriteBarrier) { | 1521 TEST(InstanceOfStubWriteBarrier) { |
1522 i::FLAG_allow_natives_syntax = true; | 1522 i::FLAG_allow_natives_syntax = true; |
1523 #ifdef DEBUG | |
1524 i::FLAG_verify_heap = true; | 1523 i::FLAG_verify_heap = true; |
1525 #endif | 1524 |
1526 InitializeVM(); | 1525 InitializeVM(); |
1527 if (!i::V8::UseCrankshaft()) return; | 1526 if (!i::V8::UseCrankshaft()) return; |
1528 v8::HandleScope outer_scope; | 1527 v8::HandleScope outer_scope; |
1529 | 1528 |
1530 { | 1529 { |
1531 v8::HandleScope scope; | 1530 v8::HandleScope scope; |
1532 CompileRun( | 1531 CompileRun( |
1533 "function foo () { }" | 1532 "function foo () { }" |
1534 "function mkbar () { return new (new Function(\"\")) (); }" | 1533 "function mkbar () { return new (new Function(\"\")) (); }" |
1535 "function f (x) { return (x instanceof foo); }" | 1534 "function f (x) { return (x instanceof foo); }" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 CHECK(space->LastPage()->Contains(prototype->address())); | 1623 CHECK(space->LastPage()->Contains(prototype->address())); |
1625 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); | 1624 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); |
1626 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); | 1625 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1627 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1626 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1628 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); | 1627 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1629 } | 1628 } |
1630 | 1629 |
1631 | 1630 |
1632 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { | 1631 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { |
1633 i::FLAG_allow_natives_syntax = true; | 1632 i::FLAG_allow_natives_syntax = true; |
1634 #ifdef DEBUG | |
1635 i::FLAG_verify_heap = true; | 1633 i::FLAG_verify_heap = true; |
1636 #endif | 1634 |
1637 InitializeVM(); | 1635 InitializeVM(); |
1638 if (!i::V8::UseCrankshaft()) return; | 1636 if (!i::V8::UseCrankshaft()) return; |
1639 v8::HandleScope outer_scope; | 1637 v8::HandleScope outer_scope; |
1640 | 1638 |
1641 { | 1639 { |
1642 v8::HandleScope scope; | 1640 v8::HandleScope scope; |
1643 CompileRun( | 1641 CompileRun( |
1644 "function f () {" | 1642 "function f () {" |
1645 " var s = 0;" | 1643 " var s = 0;" |
1646 " for (var i = 0; i < 100; i++) s += i;" | 1644 " for (var i = 0; i < 100; i++) s += i;" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 } | 1677 } |
1680 | 1678 |
1681 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age()); | 1679 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age()); |
1682 CHECK_EQ(0, f->shared()->opt_count()); | 1680 CHECK_EQ(0, f->shared()->opt_count()); |
1683 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 1681 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
1684 } | 1682 } |
1685 | 1683 |
1686 | 1684 |
1687 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { | 1685 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { |
1688 i::FLAG_allow_natives_syntax = true; | 1686 i::FLAG_allow_natives_syntax = true; |
1689 #ifdef DEBUG | |
1690 i::FLAG_verify_heap = true; | 1687 i::FLAG_verify_heap = true; |
1691 #endif | 1688 |
1692 InitializeVM(); | 1689 InitializeVM(); |
1693 if (!i::V8::UseCrankshaft()) return; | 1690 if (!i::V8::UseCrankshaft()) return; |
1694 v8::HandleScope outer_scope; | 1691 v8::HandleScope outer_scope; |
1695 | 1692 |
1696 { | 1693 { |
1697 v8::HandleScope scope; | 1694 v8::HandleScope scope; |
1698 CompileRun( | 1695 CompileRun( |
1699 "function f () {" | 1696 "function f () {" |
1700 " var s = 0;" | 1697 " var s = 0;" |
1701 " for (var i = 0; i < 100; i++) s += i;" | 1698 " for (var i = 0; i < 100; i++) s += i;" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 Handle<Object> call_function(call); | 2295 Handle<Object> call_function(call); |
2299 | 2296 |
2300 // Now we are ready to mess up the heap. | 2297 // Now we are ready to mess up the heap. |
2301 HEAP->CollectAllGarbage(Heap::kReduceMemoryFootprintMask); | 2298 HEAP->CollectAllGarbage(Heap::kReduceMemoryFootprintMask); |
2302 | 2299 |
2303 // Either heap verification caught the problem already or we go kaboom once | 2300 // Either heap verification caught the problem already or we go kaboom once |
2304 // the CallIC is executed the next time. | 2301 // the CallIC is executed the next time. |
2305 USE(global->SetProperty(*name, *call_function, NONE, kNonStrictMode)); | 2302 USE(global->SetProperty(*name, *call_function, NONE, kNonStrictMode)); |
2306 CompileRun("call();"); | 2303 CompileRun("call();"); |
2307 } | 2304 } |
OLD | NEW |