Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 0920178785e1664112f32c7c375c8c306ba7df64..716f5cbaf6cc2c1fb4c926b935d9b44ff2f8a25b 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -3033,6 +3033,40 @@ THREADED_TEST(GlobalProxyIdentityHash) { |
} |
+TEST(SymbolIdentityHash) { |
+ LocalContext env; |
+ v8::Isolate* isolate = env->GetIsolate(); |
+ v8::HandleScope scope(isolate); |
+ |
+ Local<v8::Symbol> symbol = v8::Symbol::New(isolate); |
+ int hash = symbol->GetIdentityHash(); |
+ int hash1 = symbol->GetIdentityHash(); |
+ CHECK_EQ(hash, hash1); |
+ CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
+ int hash3 = symbol->GetIdentityHash(); |
+ CHECK_EQ(hash, hash3); |
aandrey
2014/12/01 15:49:17
can you also test symbols from JS:
v8::Handle<Val
yurys
2014/12/02 08:42:30
Done.
|
+} |
+ |
+ |
+TEST(StringIdentityHash) { |
+ LocalContext env; |
+ v8::Isolate* isolate = env->GetIsolate(); |
+ v8::HandleScope scope(isolate); |
+ |
+ Local<v8::String> str = v8::String::NewFromUtf8(isolate, "str1"); |
+ int hash = str->GetIdentityHash(); |
+ int hash1 = str->GetIdentityHash(); |
+ CHECK_EQ(hash, hash1); |
+ CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
+ int hash3 = str->GetIdentityHash(); |
+ CHECK_EQ(hash, hash3); |
+ |
+ Local<v8::String> str2 = v8::String::NewFromUtf8(isolate, "str1"); |
+ int hash4 = str2->GetIdentityHash(); |
+ CHECK_EQ(hash, hash4); |
+} |
+ |
+ |
THREADED_TEST(SymbolProperties) { |
LocalContext env; |
v8::Isolate* isolate = env->GetIsolate(); |