OLD | NEW |
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 11642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11653 CHECK_EQ(42, script->Run()->Int32Value()); | 11653 CHECK_EQ(42, script->Run()->Int32Value()); |
11654 } | 11654 } |
11655 } | 11655 } |
11656 | 11656 |
11657 | 11657 |
11658 static int GetGlobalObjectsCount() { | 11658 static int GetGlobalObjectsCount() { |
11659 int count = 0; | 11659 int count = 0; |
11660 i::HeapIterator it(CcTest::heap()); | 11660 i::HeapIterator it(CcTest::heap()); |
11661 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) | 11661 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) |
11662 if (object->IsJSGlobalObject()) count++; | 11662 if (object->IsJSGlobalObject()) count++; |
11663 return count; | 11663 // Subtract one to compensate for the code stub context that is always present |
| 11664 return count - 1; |
11664 } | 11665 } |
11665 | 11666 |
11666 | 11667 |
11667 static void CheckSurvivingGlobalObjectsCount(int expected) { | 11668 static void CheckSurvivingGlobalObjectsCount(int expected) { |
11668 // We need to collect all garbage twice to be sure that everything | 11669 // We need to collect all garbage twice to be sure that everything |
11669 // has been collected. This is because inline caches are cleared in | 11670 // has been collected. This is because inline caches are cleared in |
11670 // the first garbage collection but some of the maps have already | 11671 // the first garbage collection but some of the maps have already |
11671 // been marked at that point. Therefore some of the maps are not | 11672 // been marked at that point. Therefore some of the maps are not |
11672 // collected until the second garbage collection. | 11673 // collected until the second garbage collection. |
11673 CcTest::heap()->CollectAllGarbage(); | 11674 CcTest::heap()->CollectAllGarbage(); |
(...skipping 10174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21848 " fake.age;\n" | 21849 " fake.age;\n" |
21849 " result = 1;\n" | 21850 " result = 1;\n" |
21850 " } catch (e) {\n" | 21851 " } catch (e) {\n" |
21851 " }\n" | 21852 " }\n" |
21852 " test(d+1);\n" | 21853 " test(d+1);\n" |
21853 "}\n" | 21854 "}\n" |
21854 "test(0);\n" | 21855 "test(0);\n" |
21855 "result;\n", | 21856 "result;\n", |
21856 0); | 21857 0); |
21857 } | 21858 } |
OLD | NEW |