Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 5f82bd7f2e7ee184975588e4de3e6b7fcebbe325..d76d8ba9e3f00591e9be9121728854a776d84d89 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -2748,6 +2748,25 @@ THREADED_TEST(IdentityHash) { |
} |
+THREADED_TEST(GlobalProxyIdentityHash) { |
+ LocalContext env; |
+ v8::Isolate* isolate = env->GetIsolate(); |
+ v8::HandleScope scope(isolate); |
+ Handle<Object> global_proxy = env->Global(); |
+ int hash1 = global_proxy->GetIdentityHash(); |
+ // Hash should be retained after being detached. |
+ env->DetachGlobal(); |
+ int hash2 = global_proxy->GetIdentityHash(); |
+ CHECK_EQ(hash1, hash2); |
+ { |
+ // Re-attach global proxy to a new context, hash should stay the same. |
+ LocalContext env2(NULL, Handle<ObjectTemplate>(), global_proxy); |
+ int hash3 = global_proxy->GetIdentityHash(); |
+ CHECK_EQ(hash1, hash3); |
+ } |
+} |
+ |
+ |
THREADED_TEST(SymbolProperties) { |
i::FLAG_harmony_symbols = true; |