Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: test/cctest/test-heap.cc

Issue 9903019: Reset function info counters after context disposal in incremental marking step. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 // clearing correctly records slots in prototype transition array. 1586 // clearing correctly records slots in prototype transition array.
1587 i::FLAG_always_compact = true; 1587 i::FLAG_always_compact = true;
1588 Handle<Map> map(baseObject->map()); 1588 Handle<Map> map(baseObject->map());
1589 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); 1589 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address()));
1590 CHECK(space->LastPage()->Contains(prototype->address())); 1590 CHECK(space->LastPage()->Contains(prototype->address()));
1591 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); 1591 baseObject->SetPrototype(*prototype, false)->ToObjectChecked();
1592 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1592 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1593 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1593 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1594 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1594 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1595 } 1595 }
1596
1597
1598 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
1599 i::FLAG_allow_natives_syntax = true;
1600 #ifdef DEBUG
1601 i::FLAG_verify_heap = true;
1602 #endif
1603 InitializeVM();
1604 if (!i::V8::UseCrankshaft()) return;
1605 v8::HandleScope outer_scope;
1606
1607 {
1608 v8::HandleScope scope;
1609 CompileRun(
1610 "function f () {"
1611 " var s = 0;"
1612 " for (var i = 0; i < 100; i++) s += i;"
1613 " return s;"
1614 "}"
1615 "f(); f();"
1616 "%OptimizeFunctionOnNextCall(f);"
1617 "f();");
1618 }
1619 Handle<JSFunction> f =
1620 v8::Utils::OpenHandle(
1621 *v8::Handle<v8::Function>::Cast(
1622 v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
1623 CHECK(f->IsOptimized());
1624
1625 IncrementalMarking* marking = HEAP->incremental_marking();
1626 marking->Abort();
1627 marking->Start();
1628
1629 // The following two calls will increment HEAP->global_ic_age().
1630 const int kLongIdlePauseInMs = 1000;
1631 v8::V8::ContextDisposedNotification();
1632 v8::V8::IdleNotification(kLongIdlePauseInMs);
1633
1634 while (!marking->IsStopped() && !marking->IsComplete()) {
1635 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
1636 }
1637
1638 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age());
1639 CHECK_EQ(0, f->shared()->opt_count());
1640 CHECK_EQ(0, f->shared()->code()->profiler_ticks());
1641 }
1642
1643
1644 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
1645 i::FLAG_allow_natives_syntax = true;
1646 #ifdef DEBUG
1647 i::FLAG_verify_heap = true;
1648 #endif
1649 InitializeVM();
1650 if (!i::V8::UseCrankshaft()) return;
1651 v8::HandleScope outer_scope;
1652
1653 {
1654 v8::HandleScope scope;
1655 CompileRun(
1656 "function f () {"
1657 " var s = 0;"
1658 " for (var i = 0; i < 100; i++) s += i;"
1659 " return s;"
1660 "}"
1661 "f(); f();"
1662 "%OptimizeFunctionOnNextCall(f);"
1663 "f();");
1664 }
1665 Handle<JSFunction> f =
1666 v8::Utils::OpenHandle(
1667 *v8::Handle<v8::Function>::Cast(
1668 v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
1669 CHECK(f->IsOptimized());
1670
1671 HEAP->incremental_marking()->Abort();
1672
1673 // The following two calls will increment HEAP->global_ic_age().
1674 // Since incremental marking is off, IdleNotification will do full GC.
1675 const int kLongIdlePauseInMs = 1000;
1676 v8::V8::ContextDisposedNotification();
1677 v8::V8::IdleNotification(kLongIdlePauseInMs);
1678
1679 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age());
1680 CHECK_EQ(0, f->shared()->opt_count());
1681 CHECK_EQ(0, f->shared()->code()->profiler_ticks());
1682 }
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698