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 13200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13211 int count = 0; | 13211 int count = 0; |
13212 i::HeapIterator it(CcTest::heap()); | 13212 i::HeapIterator it(CcTest::heap()); |
13213 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) | 13213 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) |
13214 if (object->IsJSGlobalObject()) { | 13214 if (object->IsJSGlobalObject()) { |
13215 i::JSGlobalObject* g = i::JSGlobalObject::cast(object); | 13215 i::JSGlobalObject* g = i::JSGlobalObject::cast(object); |
13216 // Skip dummy global object. | 13216 // Skip dummy global object. |
13217 if (i::GlobalDictionary::cast(g->properties())->NumberOfElements() != 0) { | 13217 if (i::GlobalDictionary::cast(g->properties())->NumberOfElements() != 0) { |
13218 count++; | 13218 count++; |
13219 } | 13219 } |
13220 } | 13220 } |
13221 // Subtract one to compensate for the code stub context that is always present | 13221 // Subtract one to compensate for the code stub context that is always present |
Michael Starzinger
2015/12/01 18:06:53
nit: Comment is out of date, I think we can just d
danno
2015/12/02 07:00:19
Done.
| |
13222 return count - 1; | 13222 return count; |
13223 } | 13223 } |
13224 | 13224 |
13225 | 13225 |
13226 static void CheckSurvivingGlobalObjectsCount(int expected) { | 13226 static void CheckSurvivingGlobalObjectsCount(int expected) { |
13227 // We need to collect all garbage twice to be sure that everything | 13227 // We need to collect all garbage twice to be sure that everything |
13228 // has been collected. This is because inline caches are cleared in | 13228 // has been collected. This is because inline caches are cleared in |
13229 // the first garbage collection but some of the maps have already | 13229 // the first garbage collection but some of the maps have already |
13230 // been marked at that point. Therefore some of the maps are not | 13230 // been marked at that point. Therefore some of the maps are not |
13231 // collected until the second garbage collection. | 13231 // collected until the second garbage collection. |
13232 CcTest::heap()->CollectAllGarbage(); | 13232 CcTest::heap()->CollectAllGarbage(); |
(...skipping 10596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
23829 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); | 23829 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); |
23830 ExpectString("typeof obj2.values", "function"); | 23830 ExpectString("typeof obj2.values", "function"); |
23831 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 23831 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
23832 | 23832 |
23833 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 23833 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
23834 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 23834 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
23835 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 23835 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
23836 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 23836 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
23837 } | 23837 } |
23838 } | 23838 } |
OLD | NEW |