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 11638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11649 "})();"); | 11649 "})();"); |
11650 CHECK_EQ(42, script->Run()->Int32Value()); | 11650 CHECK_EQ(42, script->Run()->Int32Value()); |
11651 } | 11651 } |
11652 } | 11652 } |
11653 | 11653 |
11654 | 11654 |
11655 static int GetGlobalObjectsCount() { | 11655 static int GetGlobalObjectsCount() { |
11656 int count = 0; | 11656 int count = 0; |
11657 i::HeapIterator it(CcTest::heap()); | 11657 i::HeapIterator it(CcTest::heap()); |
11658 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) | 11658 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) |
11659 if (object->IsJSGlobalObject()) count++; | 11659 if (object->IsJSGlobalObject()) { |
| 11660 i::JSGlobalObject* g = i::JSGlobalObject::cast(object); |
| 11661 // Skip dummy global object. |
| 11662 if (i::GlobalDictionary::cast(g->properties())->NumberOfElements() != 0) { |
| 11663 count++; |
| 11664 } |
| 11665 } |
11660 // Subtract one to compensate for the code stub context that is always present | 11666 // Subtract one to compensate for the code stub context that is always present |
11661 return count - 1; | 11667 return count - 1; |
11662 } | 11668 } |
11663 | 11669 |
11664 | 11670 |
11665 static void CheckSurvivingGlobalObjectsCount(int expected) { | 11671 static void CheckSurvivingGlobalObjectsCount(int expected) { |
11666 // We need to collect all garbage twice to be sure that everything | 11672 // We need to collect all garbage twice to be sure that everything |
11667 // has been collected. This is because inline caches are cleared in | 11673 // has been collected. This is because inline caches are cleared in |
11668 // the first garbage collection but some of the maps have already | 11674 // the first garbage collection but some of the maps have already |
11669 // been marked at that point. Therefore some of the maps are not | 11675 // been marked at that point. Therefore some of the maps are not |
(...skipping 10286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21956 env2->Global()->Set(v8_str("obj2"), object2); | 21962 env2->Global()->Set(v8_str("obj2"), object2); |
21957 ExpectString("typeof obj2.values", "function"); | 21963 ExpectString("typeof obj2.values", "function"); |
21958 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 21964 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
21959 | 21965 |
21960 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 21966 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
21961 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 21967 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
21962 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 21968 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
21963 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 21969 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
21964 } | 21970 } |
21965 } | 21971 } |
OLD | NEW |