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

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

Issue 661583004: Revert "Limit the number of transitions allowed per hidden class." Due to crashes in ClearMapTransi… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 2841
2842 // Count number of live transitions before marking. 2842 // Count number of live transitions before marking.
2843 int transitions_before = CountMapTransitions(root->map()); 2843 int transitions_before = CountMapTransitions(root->map());
2844 CHECK_EQ(transitions_count, transitions_before); 2844 CHECK_EQ(transitions_count, transitions_before);
2845 2845
2846 // Get rid of o 2846 // Get rid of o
2847 CompileRun("o = new F;" 2847 CompileRun("o = new F;"
2848 "root = new F"); 2848 "root = new F");
2849 root = GetByName("root"); 2849 root = GetByName("root");
2850 AddPropertyTo(2, root, "funny"); 2850 AddPropertyTo(2, root, "funny");
2851 CcTest::heap()->CollectGarbage(NEW_SPACE);
2852 2851
2853 // Count number of live transitions after marking. Note that one transition 2852 // Count number of live transitions after marking. Note that one transition
2854 // is left, because 'o' still holds an instance of one transition target. 2853 // is left, because 'o' still holds an instance of one transition target.
2855 int transitions_after = CountMapTransitions( 2854 int transitions_after = CountMapTransitions(
2856 Map::cast(root->map()->GetBackPointer())); 2855 Map::cast(root->map()->GetBackPointer()));
2857 CHECK_EQ(1, transitions_after); 2856 CHECK_EQ(1, transitions_after);
2858 } 2857 }
2859 2858
2860 2859
2861 TEST(TransitionArrayShrinksDuringAllocToOne) { 2860 TEST(TransitionArrayShrinksDuringAllocToOne) {
2862 i::FLAG_stress_compaction = false; 2861 i::FLAG_stress_compaction = false;
2863 i::FLAG_allow_natives_syntax = true; 2862 i::FLAG_allow_natives_syntax = true;
2864 CcTest::InitializeVM(); 2863 CcTest::InitializeVM();
2865 v8::HandleScope scope(CcTest::isolate()); 2864 v8::HandleScope scope(CcTest::isolate());
2866 static const int transitions_count = 10; 2865 static const int transitions_count = 10;
2867 CompileRun("function F() {}"); 2866 CompileRun("function F() {}");
2868 AddTransitions(transitions_count); 2867 AddTransitions(transitions_count);
2869 CompileRun("var root = new F;"); 2868 CompileRun("var root = new F;");
2870 Handle<JSObject> root = GetByName("root"); 2869 Handle<JSObject> root = GetByName("root");
2871 2870
2872 // Count number of live transitions before marking. 2871 // Count number of live transitions before marking.
2873 int transitions_before = CountMapTransitions(root->map()); 2872 int transitions_before = CountMapTransitions(root->map());
2874 CHECK_EQ(transitions_count, transitions_before); 2873 CHECK_EQ(transitions_count, transitions_before);
2875 2874
2876 root = GetByName("root"); 2875 root = GetByName("root");
2877 AddPropertyTo(2, root, "funny"); 2876 AddPropertyTo(2, root, "funny");
2878 CcTest::heap()->CollectGarbage(NEW_SPACE);
2879 2877
2880 // Count number of live transitions after marking. Note that one transition 2878 // Count number of live transitions after marking. Note that one transition
2881 // is left, because 'o' still holds an instance of one transition target. 2879 // is left, because 'o' still holds an instance of one transition target.
2882 int transitions_after = CountMapTransitions( 2880 int transitions_after = CountMapTransitions(
2883 Map::cast(root->map()->GetBackPointer())); 2881 Map::cast(root->map()->GetBackPointer()));
2884 CHECK_EQ(2, transitions_after); 2882 CHECK_EQ(2, transitions_after);
2885 } 2883 }
2886 2884
2887 2885
2888 TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) { 2886 TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) {
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
4613 #ifdef DEBUG 4611 #ifdef DEBUG
4614 TEST(PathTracer) { 4612 TEST(PathTracer) {
4615 CcTest::InitializeVM(); 4613 CcTest::InitializeVM();
4616 v8::HandleScope scope(CcTest::isolate()); 4614 v8::HandleScope scope(CcTest::isolate());
4617 4615
4618 v8::Local<v8::Value> result = CompileRun("'abc'"); 4616 v8::Local<v8::Value> result = CompileRun("'abc'");
4619 Handle<Object> o = v8::Utils::OpenHandle(*result); 4617 Handle<Object> o = v8::Utils::OpenHandle(*result);
4620 CcTest::i_isolate()->heap()->TracePathToObject(*o); 4618 CcTest::i_isolate()->heap()->TracePathToObject(*o);
4621 } 4619 }
4622 #endif // DEBUG 4620 #endif // DEBUG
OLDNEW
« no previous file with comments | « src/transitions-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698