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