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 13983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13994 } | 13994 } |
13995 | 13995 |
13996 | 13996 |
13997 static void CheckSurvivingGlobalObjectsCount(int expected) { | 13997 static void CheckSurvivingGlobalObjectsCount(int expected) { |
13998 // We need to collect all garbage twice to be sure that everything | 13998 // We need to collect all garbage twice to be sure that everything |
13999 // has been collected. This is because inline caches are cleared in | 13999 // has been collected. This is because inline caches are cleared in |
14000 // the first garbage collection but some of the maps have already | 14000 // the first garbage collection but some of the maps have already |
14001 // been marked at that point. Therefore some of the maps are not | 14001 // been marked at that point. Therefore some of the maps are not |
14002 // collected until the second garbage collection. | 14002 // collected until the second garbage collection. |
14003 CcTest::heap()->CollectAllGarbage(); | 14003 CcTest::heap()->CollectAllGarbage(); |
14004 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); | 14004 CcTest::heap()->CollectAllGarbage(); |
14005 int count = GetGlobalObjectsCount(); | 14005 int count = GetGlobalObjectsCount(); |
14006 #ifdef DEBUG | 14006 #ifdef DEBUG |
14007 if (count != expected) CcTest::heap()->TracePathToGlobal(); | 14007 if (count != expected) CcTest::heap()->TracePathToGlobal(); |
14008 #endif | 14008 #endif |
14009 CHECK_EQ(expected, count); | 14009 CHECK_EQ(expected, count); |
14010 } | 14010 } |
14011 | 14011 |
14012 | 14012 |
14013 TEST(DontLeakGlobalObjects) { | 14013 TEST(DontLeakGlobalObjects) { |
14014 // Regression test for issues 1139850 and 1174891. | 14014 // Regression test for issues 1139850 and 1174891. |
(...skipping 11129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25144 } | 25144 } |
25145 | 25145 |
25146 TEST(PrivateForApiIsNumber) { | 25146 TEST(PrivateForApiIsNumber) { |
25147 LocalContext context; | 25147 LocalContext context; |
25148 v8::Isolate* isolate = CcTest::isolate(); | 25148 v8::Isolate* isolate = CcTest::isolate(); |
25149 v8::HandleScope scope(isolate); | 25149 v8::HandleScope scope(isolate); |
25150 | 25150 |
25151 // Shouldn't crash. | 25151 // Shouldn't crash. |
25152 v8::Private::ForApi(isolate, v8_str("42")); | 25152 v8::Private::ForApi(isolate, v8_str("42")); |
25153 } | 25153 } |
OLD | NEW |