| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "src/api.h" | 28 #include "src/api.h" |
| 29 #include "src/factory.h" | 29 #include "src/factory.h" |
| 30 #include "src/global-handles.h" | 30 #include "src/global-handles.h" |
| 31 #include "src/isolate.h" | 31 #include "src/isolate.h" |
| 32 #include "src/objects-inl.h" | 32 #include "src/objects-inl.h" |
| 33 #include "src/objects.h" | 33 #include "src/objects.h" |
| 34 #include "test/cctest/cctest.h" | 34 #include "test/cctest/cctest.h" |
| 35 | 35 |
| 36 using namespace v8::internal; | 36 using namespace v8::internal; |
| 37 using v8::UniqueId; | |
| 38 | 37 |
| 39 TEST(EternalHandles) { | 38 TEST(EternalHandles) { |
| 40 CcTest::InitializeVM(); | 39 CcTest::InitializeVM(); |
| 41 Isolate* isolate = CcTest::i_isolate(); | 40 Isolate* isolate = CcTest::i_isolate(); |
| 42 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 41 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 43 EternalHandles* eternal_handles = isolate->eternal_handles(); | 42 EternalHandles* eternal_handles = isolate->eternal_handles(); |
| 44 | 43 |
| 45 // Create a number of handles that will not be on a block boundary | 44 // Create a number of handles that will not be on a block boundary |
| 46 const int kArrayLength = 2048-1; | 45 const int kArrayLength = 2048-1; |
| 47 int indices[kArrayLength]; | 46 int indices[kArrayLength]; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 g1.SetWeak(); | 176 g1.SetWeak(); |
| 178 g2.Reset(isolate, v8::Object::New(isolate)); | 177 g2.Reset(isolate, v8::Object::New(isolate)); |
| 179 g2.SetWeak(); | 178 g2.SetWeak(); |
| 180 } | 179 } |
| 181 | 180 |
| 182 CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); | 181 CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); |
| 183 CcTest::CollectAllAvailableGarbage(); | 182 CcTest::CollectAllAvailableGarbage(); |
| 184 CHECK_EQ(2u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); | 183 CHECK_EQ(2u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); |
| 185 CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); | 184 CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); |
| 186 } | 185 } |
| OLD | NEW |