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

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

Issue 22384003: expose eternal handle api (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added uninitialized constant 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/global-handles.cc ('k') | no next file » | 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 10a1d7986e1459c34ccf586ab1fc0132f32eda40..07b4b4c39a6d1a639321c637dff37f2047034943 100644
--- a/test/cctest/test-global-handles.cc
+++ b/test/cctest/test-global-handles.cc
@@ -484,21 +484,36 @@ TEST(EternalHandles) {
CHECK_EQ(0, eternals->NumberOfHandles());
for (int i = 0; i < kArrayLength; i++) {
HandleScope scope(isolate);
- v8::Handle<v8::Object> object = v8::Object::New();
+ v8::Local<v8::Object> object = v8::Object::New();
object->Set(i, v8::Integer::New(i, v8_isolate));
- indices[i] = eternals->Create(isolate, *v8::Utils::OpenHandle(*object));
+ if (i % 2 == 0) {
+ // Create with internal api
+ indices[i] = eternals->Create(isolate, *v8::Utils::OpenHandle(*object));
+ } else {
+ // Create with external api
+ indices[i] = object.Eternalize(v8_isolate);
+ }
}
isolate->heap()->CollectAllAvailableGarbage();
for (int i = 0; i < kArrayLength; i++) {
- HandleScope scope(isolate);
- v8::Handle<v8::Value> local =
- v8::Utils::ToLocal(eternals->Get(indices[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());
+ for (int j = 0; j < 2; j++) {
+ HandleScope scope(isolate);
+ v8::Local<v8::Object> object;
+ if (j == 0) {
+ // Test internal api
+ v8::Local<v8::Value> local =
+ v8::Utils::ToLocal(eternals->Get(indices[i]));
+ object = v8::Handle<v8::Object>::Cast(local);
+ } else {
+ // Test external api
+ object = v8::Local<v8::Object>::GetEternal(v8_isolate, indices[i]);
+ }
+ v8::Local<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/global-handles.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698