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

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

Issue 10692026: Moving prototype transitions into the header of the transition array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments Created 8 years, 5 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
« src/transitions.h ('K') | « src/transitions-inl.h ('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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 *v8::Handle<v8::Object>::Cast( 1580 *v8::Handle<v8::Object>::Cast(
1581 v8::Context::GetCurrent()->Global()->Get(v8_str("base")))); 1581 v8::Context::GetCurrent()->Global()->Get(v8_str("base"))));
1582 1582
1583 // Verify that only dead prototype transitions are cleared. 1583 // Verify that only dead prototype transitions are cleared.
1584 CHECK_EQ(10, baseObject->map()->NumberOfProtoTransitions()); 1584 CHECK_EQ(10, baseObject->map()->NumberOfProtoTransitions());
1585 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1585 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1586 const int transitions = 10 - 3; 1586 const int transitions = 10 - 3;
1587 CHECK_EQ(transitions, baseObject->map()->NumberOfProtoTransitions()); 1587 CHECK_EQ(transitions, baseObject->map()->NumberOfProtoTransitions());
1588 1588
1589 // Verify that prototype transitions array was compacted. 1589 // Verify that prototype transitions array was compacted.
1590 FixedArray* trans = baseObject->map()->prototype_transitions(); 1590 FixedArray* trans = baseObject->map()->GetPrototypeTransitions();
1591 for (int i = 0; i < transitions; i++) { 1591 for (int i = 0; i < transitions; i++) {
1592 int j = Map::kProtoTransitionHeaderSize + 1592 int j = Map::kProtoTransitionHeaderSize +
1593 i * Map::kProtoTransitionElementsPerEntry; 1593 i * Map::kProtoTransitionElementsPerEntry;
1594 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap()); 1594 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap());
1595 Object* proto = trans->get(j + Map::kProtoTransitionPrototypeOffset); 1595 Object* proto = trans->get(j + Map::kProtoTransitionPrototypeOffset);
1596 CHECK(proto->IsTheHole() || proto->IsJSObject()); 1596 CHECK(proto->IsTheHole() || proto->IsJSObject());
1597 } 1597 }
1598 1598
1599 // Make sure next prototype is placed on an old-space evacuation candidate. 1599 // Make sure next prototype is placed on an old-space evacuation candidate.
1600 Handle<JSObject> prototype; 1600 Handle<JSObject> prototype;
1601 PagedSpace* space = HEAP->old_pointer_space(); 1601 PagedSpace* space = HEAP->old_pointer_space();
1602 do { 1602 do {
1603 prototype = FACTORY->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED); 1603 prototype = FACTORY->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED);
1604 } while (space->FirstPage() == space->LastPage() || 1604 } while (space->FirstPage() == space->LastPage() ||
1605 !space->LastPage()->Contains(prototype->address())); 1605 !space->LastPage()->Contains(prototype->address()));
1606 1606
1607 // Add a prototype on an evacuation candidate and verify that transition 1607 // Add a prototype on an evacuation candidate and verify that transition
1608 // clearing correctly records slots in prototype transition array. 1608 // clearing correctly records slots in prototype transition array.
1609 i::FLAG_always_compact = true; 1609 i::FLAG_always_compact = true;
1610 Handle<Map> map(baseObject->map()); 1610 Handle<Map> map(baseObject->map());
1611 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); 1611 CHECK(!space->LastPage()->Contains(
1612 map->GetPrototypeTransitions()->address()));
1612 CHECK(space->LastPage()->Contains(prototype->address())); 1613 CHECK(space->LastPage()->Contains(prototype->address()));
1613 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); 1614 baseObject->SetPrototype(*prototype, false)->ToObjectChecked();
1614 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1615 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1615 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1616 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1616 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1617 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1617 } 1618 }
1618 1619
1619 1620
1620 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { 1621 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
1621 i::FLAG_allow_natives_syntax = true; 1622 i::FLAG_allow_natives_syntax = true;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); 1925 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1");
1925 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); 1926 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages());
1926 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); 1927 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2");
1927 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); 1928 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2);
1928 1929
1929 // Triggering a last-resort GC should cause all pages to be released 1930 // Triggering a last-resort GC should cause all pages to be released
1930 // to the OS so that other processes can seize the memory. 1931 // to the OS so that other processes can seize the memory.
1931 HEAP->CollectAllAvailableGarbage("triggered really hard"); 1932 HEAP->CollectAllAvailableGarbage("triggered really hard");
1932 CHECK_EQ(1, old_pointer_space->CountTotalPages()); 1933 CHECK_EQ(1, old_pointer_space->CountTotalPages());
1933 } 1934 }
OLDNEW
« src/transitions.h ('K') | « src/transitions-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698