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

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

Issue 9073007: Store transitioned JSArray maps in global context (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 8 years, 11 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/x64/macro-assembler-x64.cc ('k') | test/mjsunit/array-construct-transition.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 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"
11 #include "cctest.h" 11 #include "cctest.h"
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 InitializeVM(); 804 InitializeVM();
805 v8::HandleScope scope; 805 v8::HandleScope scope;
806 806
807 // Array of objects to scan haep for. 807 // Array of objects to scan haep for.
808 const int objs_count = 6; 808 const int objs_count = 6;
809 Handle<Object> objs[objs_count]; 809 Handle<Object> objs[objs_count];
810 int next_objs_index = 0; 810 int next_objs_index = 0;
811 811
812 // Allocate a JS array to OLD_POINTER_SPACE and NEW_SPACE 812 // Allocate a JS array to OLD_POINTER_SPACE and NEW_SPACE
813 objs[next_objs_index++] = FACTORY->NewJSArray(10); 813 objs[next_objs_index++] = FACTORY->NewJSArray(10);
814 objs[next_objs_index++] = FACTORY->NewJSArray(10, TENURED); 814 objs[next_objs_index++] = FACTORY->NewJSArray(10, FAST_ELEMENTS, TENURED);
815 815
816 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE 816 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE
817 objs[next_objs_index++] = 817 objs[next_objs_index++] =
818 FACTORY->NewStringFromAscii(CStrVector("abcdefghij")); 818 FACTORY->NewStringFromAscii(CStrVector("abcdefghij"));
819 objs[next_objs_index++] = 819 objs[next_objs_index++] =
820 FACTORY->NewStringFromAscii(CStrVector("abcdefghij"), TENURED); 820 FACTORY->NewStringFromAscii(CStrVector("abcdefghij"), TENURED);
821 821
822 // Allocate a large string (for large object space). 822 // Allocate a large string (for large object space).
823 int large_size = HEAP->MaxObjectSizeInPagedSpace() + 1; 823 int large_size = HEAP->MaxObjectSizeInPagedSpace() + 1;
824 char* str = new char[large_size]; 824 char* str = new char[large_size];
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 int j = Map::kProtoTransitionHeaderSize + 1604 int j = Map::kProtoTransitionHeaderSize +
1605 i * Map::kProtoTransitionElementsPerEntry; 1605 i * Map::kProtoTransitionElementsPerEntry;
1606 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap()); 1606 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap());
1607 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject()); 1607 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject());
1608 } 1608 }
1609 1609
1610 // Make sure next prototype is placed on an old-space evacuation candidate. 1610 // Make sure next prototype is placed on an old-space evacuation candidate.
1611 Handle<JSObject> prototype; 1611 Handle<JSObject> prototype;
1612 PagedSpace* space = HEAP->old_pointer_space(); 1612 PagedSpace* space = HEAP->old_pointer_space();
1613 do { 1613 do {
1614 prototype = FACTORY->NewJSArray(32 * KB, TENURED); 1614 prototype = FACTORY->NewJSArray(32 * KB, FAST_ELEMENTS, TENURED);
1615 } while (space->FirstPage() == space->LastPage() || 1615 } while (space->FirstPage() == space->LastPage() ||
1616 !space->LastPage()->Contains(prototype->address())); 1616 !space->LastPage()->Contains(prototype->address()));
1617 1617
1618 // Add a prototype on an evacuation candidate and verify that transition 1618 // Add a prototype on an evacuation candidate and verify that transition
1619 // clearing correctly records slots in prototype transition array. 1619 // clearing correctly records slots in prototype transition array.
1620 i::FLAG_always_compact = true; 1620 i::FLAG_always_compact = true;
1621 Handle<Map> map(baseObject->map()); 1621 Handle<Map> map(baseObject->map());
1622 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); 1622 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address()));
1623 CHECK(space->LastPage()->Contains(prototype->address())); 1623 CHECK(space->LastPage()->Contains(prototype->address()));
1624 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); 1624 baseObject->SetPrototype(*prototype, false)->ToObjectChecked();
1625 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1625 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1626 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1626 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1627 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1627 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1628 } 1628 }
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/mjsunit/array-construct-transition.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698