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

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

Issue 10383182: Revert r11556 and r11558 to allow roll. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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/mark-compact-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 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 "f(1); f(2); f(3);" 1728 "f(1); f(2); f(3);"
1729 "%OptimizeFunctionOnNextCall(f);" 1729 "%OptimizeFunctionOnNextCall(f);"
1730 "f(4);"); 1730 "f(4);");
1731 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); 1731 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value());
1732 1732
1733 Handle<JSObject> o = 1733 Handle<JSObject> o =
1734 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 1734 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
1735 1735
1736 CHECK(HEAP->InNewSpace(*o)); 1736 CHECK(HEAP->InNewSpace(*o));
1737 } 1737 }
1738
1739
1740 static int CountMapTransitions(Map* map) {
1741 int result = 0;
1742 DescriptorArray* descs = map->instance_descriptors();
1743 for (int i = 0; i < descs->number_of_descriptors(); i++) {
1744 if (descs->IsTransitionOnly(i)) {
1745 result++;
1746 }
1747 }
1748 return result;
1749 }
1750
1751
1752 // Test that map transitions are cleared and maps are collected with
1753 // incremental marking as well.
1754 TEST(Regress1465) {
1755 i::FLAG_allow_natives_syntax = true;
1756 i::FLAG_trace_incremental_marking = true;
1757 InitializeVM();
1758 v8::HandleScope scope;
1759
1760 #define TRANSITION_COUNT 256
1761 for (int i = 0; i < TRANSITION_COUNT; i++) {
1762 EmbeddedVector<char, 64> buffer;
1763 OS::SNPrintF(buffer, "var o = new Object; o.prop%d = %d;", i, i);
1764 CompileRun(buffer.start());
1765 }
1766 CompileRun("var root = new Object;");
1767 Handle<JSObject> root =
1768 v8::Utils::OpenHandle(
1769 *v8::Handle<v8::Object>::Cast(
1770 v8::Context::GetCurrent()->Global()->Get(v8_str("root"))));
1771
1772 // Count number of live transitions before marking.
1773 int transitions_before = CountMapTransitions(root->map());
1774 CompileRun("%DebugPrint(root);");
1775 CHECK_EQ(TRANSITION_COUNT, transitions_before);
1776
1777 // Go through all incremental marking steps in one swoop.
1778 IncrementalMarking* marking = HEAP->incremental_marking();
1779 CHECK(marking->IsStopped());
1780 marking->Start();
1781 CHECK(marking->IsMarking());
1782 while (!marking->IsComplete()) {
1783 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
1784 }
1785 CHECK(marking->IsComplete());
1786 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1787 CHECK(marking->IsStopped());
1788
1789 // Count number of live transitions after marking. Note that one transition
1790 // is left, because 'o' still holds an instance of one transition target.
1791 int transitions_after = CountMapTransitions(root->map());
1792 CompileRun("%DebugPrint(root);");
1793 CHECK_EQ(1, transitions_after);
1794 }
OLDNEW
« no previous file with comments | « src/mark-compact-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698