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

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

Issue 10442015: Rollback of r11638, r11636 on trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 7 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/stub-cache-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 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 // Allocate the object. 666 // Allocate the object.
667 Handle<JSObject> object = FACTORY->NewJSObject(function); 667 Handle<JSObject> object = FACTORY->NewJSObject(function);
668 Handle<JSArray> array = Handle<JSArray>::cast(object); 668 Handle<JSArray> array = Handle<JSArray>::cast(object);
669 // We just initialized the VM, no heap allocation failure yet. 669 // We just initialized the VM, no heap allocation failure yet.
670 array->Initialize(0)->ToObjectChecked(); 670 array->Initialize(0)->ToObjectChecked();
671 671
672 // Set array length to 0. 672 // Set array length to 0.
673 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); 673 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked();
674 CHECK_EQ(Smi::FromInt(0), array->length()); 674 CHECK_EQ(Smi::FromInt(0), array->length());
675 // Must be in fast mode. 675 // Must be in fast mode.
676 CHECK(array->HasFastSmiOrObjectElements()); 676 CHECK(array->HasFastTypeElements());
677 677
678 // array[length] = name. 678 // array[length] = name.
679 array->SetElement(0, *name, NONE, kNonStrictMode)->ToObjectChecked(); 679 array->SetElement(0, *name, NONE, kNonStrictMode)->ToObjectChecked();
680 CHECK_EQ(Smi::FromInt(1), array->length()); 680 CHECK_EQ(Smi::FromInt(1), array->length());
681 CHECK_EQ(array->GetElement(0), *name); 681 CHECK_EQ(array->GetElement(0), *name);
682 682
683 // Set array length with larger than smi value. 683 // Set array length with larger than smi value.
684 Handle<Object> length = 684 Handle<Object> length =
685 FACTORY->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1); 685 FACTORY->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1);
686 array->SetElementsLength(*length)->ToObjectChecked(); 686 array->SetElementsLength(*length)->ToObjectChecked();
(...skipping 117 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, 814 objs[next_objs_index++] = FACTORY->NewJSArray(10, FAST_ELEMENTS, TENURED);
815 FAST_HOLEY_ELEMENTS,
816 TENURED);
817 815
818 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE 816 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE
819 objs[next_objs_index++] = 817 objs[next_objs_index++] =
820 FACTORY->NewStringFromAscii(CStrVector("abcdefghij")); 818 FACTORY->NewStringFromAscii(CStrVector("abcdefghij"));
821 objs[next_objs_index++] = 819 objs[next_objs_index++] =
822 FACTORY->NewStringFromAscii(CStrVector("abcdefghij"), TENURED); 820 FACTORY->NewStringFromAscii(CStrVector("abcdefghij"), TENURED);
823 821
824 // Allocate a large string (for large object space). 822 // Allocate a large string (for large object space).
825 int large_size = Page::kMaxNonCodeHeapObjectSize + 1; 823 int large_size = Page::kMaxNonCodeHeapObjectSize + 1;
826 char* str = new char[large_size]; 824 char* str = new char[large_size];
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 int j = Map::kProtoTransitionHeaderSize + 1588 int j = Map::kProtoTransitionHeaderSize +
1591 i * Map::kProtoTransitionElementsPerEntry; 1589 i * Map::kProtoTransitionElementsPerEntry;
1592 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap()); 1590 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap());
1593 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject()); 1591 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject());
1594 } 1592 }
1595 1593
1596 // Make sure next prototype is placed on an old-space evacuation candidate. 1594 // Make sure next prototype is placed on an old-space evacuation candidate.
1597 Handle<JSObject> prototype; 1595 Handle<JSObject> prototype;
1598 PagedSpace* space = HEAP->old_pointer_space(); 1596 PagedSpace* space = HEAP->old_pointer_space();
1599 do { 1597 do {
1600 prototype = FACTORY->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED); 1598 prototype = FACTORY->NewJSArray(32 * KB, FAST_ELEMENTS, TENURED);
1601 } while (space->FirstPage() == space->LastPage() || 1599 } while (space->FirstPage() == space->LastPage() ||
1602 !space->LastPage()->Contains(prototype->address())); 1600 !space->LastPage()->Contains(prototype->address()));
1603 1601
1604 // Add a prototype on an evacuation candidate and verify that transition 1602 // Add a prototype on an evacuation candidate and verify that transition
1605 // clearing correctly records slots in prototype transition array. 1603 // clearing correctly records slots in prototype transition array.
1606 i::FLAG_always_compact = true; 1604 i::FLAG_always_compact = true;
1607 Handle<Map> map(baseObject->map()); 1605 Handle<Map> map(baseObject->map());
1608 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); 1606 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address()));
1609 CHECK(space->LastPage()->Contains(prototype->address())); 1607 CHECK(space->LastPage()->Contains(prototype->address()));
1610 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); 1608 baseObject->SetPrototype(*prototype, false)->ToObjectChecked();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 CHECK(marking->IsComplete()); 1785 CHECK(marking->IsComplete());
1788 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1786 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1789 CHECK(marking->IsStopped()); 1787 CHECK(marking->IsStopped());
1790 1788
1791 // Count number of live transitions after marking. Note that one transition 1789 // Count number of live transitions after marking. Note that one transition
1792 // is left, because 'o' still holds an instance of one transition target. 1790 // is left, because 'o' still holds an instance of one transition target.
1793 int transitions_after = CountMapTransitions(root->map()); 1791 int transitions_after = CountMapTransitions(root->map());
1794 CompileRun("%DebugPrint(root);"); 1792 CompileRun("%DebugPrint(root);");
1795 CHECK_EQ(1, transitions_after); 1793 CHECK_EQ(1, transitions_after);
1796 } 1794 }
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | test/mjsunit/array-construct-transition.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698