summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/v8/src/heap-inl.h1
-rw-r--r--tests/auto/v8/tst_v8.cpp6
-rw-r--r--tests/auto/v8/v8test.cpp48
-rw-r--r--tests/auto/v8/v8test.h1
4 files changed, 56 insertions, 0 deletions
diff --git a/src/3rdparty/v8/src/heap-inl.h b/src/3rdparty/v8/src/heap-inl.h
index d1f66a8..aa933b6 100644
--- a/src/3rdparty/v8/src/heap-inl.h
+++ b/src/3rdparty/v8/src/heap-inl.h
@@ -127,6 +127,7 @@ MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str,
String* answer = String::cast(result);
answer->set_length(str.length());
answer->set_hash_field(hash_field);
+ SeqString::cast(answer)->set_symbol_id(0);
ASSERT_EQ(size, answer->Size());
diff --git a/tests/auto/v8/tst_v8.cpp b/tests/auto/v8/tst_v8.cpp
index 3983f52..b8ad5d5 100644
--- a/tests/auto/v8/tst_v8.cpp
+++ b/tests/auto/v8/tst_v8.cpp
@@ -66,6 +66,7 @@ private slots:
void fallbackpropertyhandler_callbacks();
void fallbackpropertyhandler_in_prototype();
void fallbackpropertyhandler_nonempty();
+ void completehash();
};
void tst_v8::eval()
@@ -128,6 +129,11 @@ void tst_v8::fallbackpropertyhandler_nonempty()
QVERIFY(v8test_fallbackpropertyhandler_nonempty());
}
+void tst_v8::completehash()
+{
+ QVERIFY(v8test_completehash());
+}
+
int main(int argc, char *argv[])
{
V8::SetFlagsFromCommandLine(&argc, argv, true);
diff --git a/tests/auto/v8/v8test.cpp b/tests/auto/v8/v8test.cpp
index 9d59d89..09410a6 100644
--- a/tests/auto/v8/v8test.cpp
+++ b/tests/auto/v8/v8test.cpp
@@ -1041,3 +1041,51 @@ cleanup:
ENDTEST();
}
+
+bool v8test_completehash()
+{
+#define HASH_EQUALS(str1, str2) \
+{ \
+ String::CompleteHashData hash1 = str1->CompleteHash(); \
+ String::CompleteHashData hash2 = str2->CompleteHash(); \
+ VERIFY(hash1.length == hash2.length); \
+ VERIFY(hash1.symbol_id == hash2.symbol_id || (hash1.symbol_id == 0 || hash2.symbol_id == 0)); \
+ VERIFY(hash1.hash == hash2.hash); \
+};
+
+ BEGINTEST();
+
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ Local<String> str;
+ Local<String> str2;
+ uint16_t input[] = { 'I', 'n', 'p', 'u', 't', 0 };
+
+ str = String::New("Input");
+ str2 = String::New("Input");
+ HASH_EQUALS(str, str2);
+
+ str = String::New(input);
+ str2 = String::New(input);
+ HASH_EQUALS(str, str2);
+
+ str = String::NewSymbol("input");
+ str2 = String::NewSymbol("input");
+ HASH_EQUALS(str, str2);
+
+ str = CompileRun("var input = \"{ \\\"abc\\\": \\\"value\\\" }\"; input")->ToString();
+ str2 = CompileRun("var input2 = \"{ \\\"abc\\\": \\\"value\\\" }\"; input2")->ToString();
+ HASH_EQUALS(str, str2);
+
+ // SubStringAsciiSymbolKey is created via the built-in JSON parser for
+ // property names.
+ str = CompileRun("JSON.parse(input)")->ToObject()->GetOwnPropertyNames()->Get(0)->ToString();
+ str2 = CompileRun("JSON.parse(input2)")->ToObject()->GetOwnPropertyNames()->Get(0)->ToString();
+ HASH_EQUALS(str, str2);
+cleanup:
+ context.Dispose();
+
+ ENDTEST();
+}
diff --git a/tests/auto/v8/v8test.h b/tests/auto/v8/v8test.h
index 0b9a32b..c195b67 100644
--- a/tests/auto/v8/v8test.h
+++ b/tests/auto/v8/v8test.h
@@ -60,6 +60,7 @@ bool v8test_qtbug_24871();
bool v8test_fallbackpropertyhandler_callbacks();
bool v8test_fallbackpropertyhandler_in_prototype();
bool v8test_fallbackpropertyhandler_nonempty();
+bool v8test_completehash();
#endif // V8TEST_H