Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: test/cctest/test-global-handles.cc

Issue 21133006: introduce eternal handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: returns handles, added tests Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.cc ('k') | tools/v8heapconst.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-global-handles.cc
diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc
index a274d7546cb0bf8508ab9a277532fa39651bb248..a1a8061f92eb975404599f302e9b0d79ff9e3927 100644
--- a/test/cctest/test-global-handles.cc
+++ b/test/cctest/test-global-handles.cc
@@ -315,3 +315,36 @@ TEST(ImplicitReferences) {
ASSERT(implicit_refs->at(1)->length == 1);
ASSERT(implicit_refs->at(1)->children[0] == g2c1.location());
}
+
+
+TEST(EternalHandles) {
+ CcTest::InitializeVM();
+ Isolate* isolate = Isolate::Current();
+ v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
+ EternalHandles* eternals = isolate->eternal_handles();
+
+ // Create a number of handles that will not be on a block boundary
+ const int kArrayLength = 2048-1;
+ int indices[kArrayLength];
+
+ CHECK_EQ(0, eternals->NumberOfHandles());
+ for (int i = 0; i < kArrayLength; i++) {
+ HandleScope scope(isolate);
+ v8::Handle<v8::Object> object = v8::Object::New();
+ object->Set(i, v8::Integer::New(i, v8_isolate));
+ indices[i] = eternals->Create(isolate, *v8::Utils::OpenHandle(*object));
+ }
+
+ isolate->heap()->CollectAllAvailableGarbage();
+
+ for (int i = 0; i < kArrayLength; i++) {
+ HandleScope scope(isolate);
+ v8::Handle<v8::Value> local = v8::Utils::ToLocal(eternals->Get(i));
+ v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(local);
+ v8::Handle<v8::Value> value = object->Get(i);
+ CHECK(value->IsInt32());
+ CHECK_EQ(i, value->Int32Value());
+ }
+
+ CHECK_EQ(kArrayLength, eternals->NumberOfHandles());
+}
« no previous file with comments | « src/serialize.cc ('k') | tools/v8heapconst.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698