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

Unified Diff: test/cctest/test-api.cc

Issue 254433002: Store JSGlobalProxy's identity hash directly on the proxy itself (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged to trunk, removed Object.observe workaround Created 6 years, 8 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/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698