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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 LocalContext context2(CcTest::isolate()); | 609 LocalContext context2(CcTest::isolate()); |
610 context2->SetSecurityToken(foo); | 610 context2->SetSecurityToken(foo); |
611 context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"), | 611 context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"), |
612 instance); | 612 instance); |
613 CHECK(CompileRun("Object.getNotifier(obj)")->IsObject()); | 613 CHECK(CompileRun("Object.getNotifier(obj)")->IsObject()); |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
617 | 617 |
618 static int GetGlobalObjectsCount() { | 618 static int GetGlobalObjectsCount() { |
619 CcTest::heap()->EnsureHeapIsIterable(); | |
620 int count = 0; | 619 int count = 0; |
621 i::HeapIterator it(CcTest::heap()); | 620 i::HeapIterator it(CcTest::heap()); |
622 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) | 621 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) |
623 if (object->IsJSGlobalObject()) count++; | 622 if (object->IsJSGlobalObject()) count++; |
624 return count; | 623 return count; |
625 } | 624 } |
626 | 625 |
627 | 626 |
628 static void CheckSurvivingGlobalObjectsCount(int expected) { | 627 static void CheckSurvivingGlobalObjectsCount(int expected) { |
629 // We need to collect all garbage twice to be sure that everything | 628 // We need to collect all garbage twice to be sure that everything |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 notifier); | 702 notifier); |
704 CompileRun("var obj2 = {};" | 703 CompileRun("var obj2 = {};" |
705 "var notifier2 = Object.getNotifier(obj2);" | 704 "var notifier2 = Object.getNotifier(obj2);" |
706 "notifier2.performChange.call(" | 705 "notifier2.performChange.call(" |
707 "notifier, 'foo', function(){})"); | 706 "notifier, 'foo', function(){})"); |
708 } | 707 } |
709 | 708 |
710 v8::V8::ContextDisposedNotification(); | 709 v8::V8::ContextDisposedNotification(); |
711 CheckSurvivingGlobalObjectsCount(1); | 710 CheckSurvivingGlobalObjectsCount(1); |
712 } | 711 } |
OLD | NEW |