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 13894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13905 } | 13905 } |
13906 | 13906 |
13907 | 13907 |
13908 static void CheckSurvivingGlobalObjectsCount(int expected) { | 13908 static void CheckSurvivingGlobalObjectsCount(int expected) { |
13909 // We need to collect all garbage twice to be sure that everything | 13909 // We need to collect all garbage twice to be sure that everything |
13910 // has been collected. This is because inline caches are cleared in | 13910 // has been collected. This is because inline caches are cleared in |
13911 // the first garbage collection but some of the maps have already | 13911 // the first garbage collection but some of the maps have already |
13912 // been marked at that point. Therefore some of the maps are not | 13912 // been marked at that point. Therefore some of the maps are not |
13913 // collected until the second garbage collection. | 13913 // collected until the second garbage collection. |
13914 CcTest::heap()->CollectAllGarbage(); | 13914 CcTest::heap()->CollectAllGarbage(); |
13915 CcTest::heap()->CollectAllGarbage(); | 13915 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); |
13916 int count = GetGlobalObjectsCount(); | 13916 int count = GetGlobalObjectsCount(); |
13917 #ifdef DEBUG | 13917 #ifdef DEBUG |
13918 if (count != expected) CcTest::heap()->TracePathToGlobal(); | 13918 if (count != expected) CcTest::heap()->TracePathToGlobal(); |
13919 #endif | 13919 #endif |
13920 CHECK_EQ(expected, count); | 13920 CHECK_EQ(expected, count); |
13921 } | 13921 } |
13922 | 13922 |
13923 | 13923 |
13924 TEST(DontLeakGlobalObjects) { | 13924 TEST(DontLeakGlobalObjects) { |
13925 // Regression test for issues 1139850 and 1174891. | 13925 // Regression test for issues 1139850 and 1174891. |
(...skipping 11107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25033 } | 25033 } |
25034 | 25034 |
25035 TEST(PrivateForApiIsNumber) { | 25035 TEST(PrivateForApiIsNumber) { |
25036 LocalContext context; | 25036 LocalContext context; |
25037 v8::Isolate* isolate = CcTest::isolate(); | 25037 v8::Isolate* isolate = CcTest::isolate(); |
25038 v8::HandleScope scope(isolate); | 25038 v8::HandleScope scope(isolate); |
25039 | 25039 |
25040 // Shouldn't crash. | 25040 // Shouldn't crash. |
25041 v8::Private::ForApi(isolate, v8_str("42")); | 25041 v8::Private::ForApi(isolate, v8_str("42")); |
25042 } | 25042 } |
OLD | NEW |