| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 4890b80d259cbbf9293e8507f2081a8b22c3e792..f2e5d6f87d4b7e4e151d60deed74b0f5181af0a2 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -2259,12 +2259,24 @@ THREADED_TEST(IdentityHash) {
|
| }
|
|
|
|
|
| -THREADED_TEST(GlobalProxyIdentityHash) {
|
| +void GlobalProxyIdentityHash(bool set_in_js) {
|
| LocalContext env;
|
| v8::Isolate* isolate = env->GetIsolate();
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| v8::HandleScope scope(isolate);
|
| Handle<Object> global_proxy = env->Global();
|
| - int hash1 = global_proxy->GetIdentityHash();
|
| + i::Handle<i::Object> i_global_proxy = v8::Utils::OpenHandle(*global_proxy);
|
| + env->Global()->Set(v8_str("global"), global_proxy);
|
| + i::Handle<i::Object> original_hash;
|
| + if (set_in_js) {
|
| + CompileRun("var m = new Set(); m.add(global);");
|
| + original_hash = i::Handle<i::Object>(i_global_proxy->GetHash(), i_isolate);
|
| + } else {
|
| + original_hash = i::Handle<i::Object>(
|
| + i::Object::GetOrCreateHash(i_isolate, i_global_proxy));
|
| + }
|
| + CHECK(original_hash->IsSmi());
|
| + int32_t hash1 = i::Handle<i::Smi>::cast(original_hash)->value();
|
| // Hash should be retained after being detached.
|
| env->DetachGlobal();
|
| int hash2 = global_proxy->GetIdentityHash();
|
| @@ -2278,6 +2290,12 @@ THREADED_TEST(GlobalProxyIdentityHash) {
|
| }
|
|
|
|
|
| +THREADED_TEST(GlobalProxyIdentityHash) {
|
| + GlobalProxyIdentityHash(true);
|
| + GlobalProxyIdentityHash(false);
|
| +}
|
| +
|
| +
|
| TEST(SymbolIdentityHash) {
|
| LocalContext env;
|
| v8::Isolate* isolate = env->GetIsolate();
|
|
|