Reviewers: Yang,
Description:
Version 4.5.60.1 (cherry-pick)
Merged 22160e7c3945ef5290266dbb628fb8daba5436fd
Revert of Serializer: clear string hash for code serializer. (patchset #1
id:1
of https://codereview.chromium.org/1183483006/)
BUG=v8:4179
LOG=N
[email protected]
Please review this at https://codereview.chromium.org/1190943002/
Base URL: https://chromium.googlesource.com/v8/[email protected]
Affected files (+16, -24 lines):
M include/v8-version.h
M src/snapshot/serialize.h
M src/snapshot/serialize.cc
Index: include/v8-version.h
diff --git a/include/v8-version.h b/include/v8-version.h
index
077c3f8888ea4156822645032e3143fab126c920..c5e934ed36ffb13be7e770d220de12f7ff7102ab
100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 5
#define V8_BUILD_NUMBER 60
-#define V8_PATCH_LEVEL 0
+#define V8_PATCH_LEVEL 1
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index
026d60221dcc8fe0e22f134e3c9a861dca8279f9..fe33c3e8b2d71e86aa6322ab5ff69700baa7b298
100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -714,16 +714,20 @@ class StringTableInsertionKey : public HashTableKey {
HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space)
{
if (deserializing_user_code()) {
- if (obj->IsInternalizedString()) {
- // Canonicalize the internalized string. If it already exists in the
- // string table, set it to forward to the existing one.
- DisallowHeapAllocation no_gc;
+ if (obj->IsString()) {
String* string = String::cast(obj);
- HandleScope scope(isolate_);
- StringTableInsertionKey key(string);
- String* canonical = *StringTable::LookupKey(isolate_, &key);
- string->SetForwardedInternalizedString(canonical);
- return canonical;
+ // Uninitialize hash field as the hash seed may have changed.
+ string->set_hash_field(String::kEmptyHashField);
+ if (string->IsInternalizedString()) {
+ // Canonicalize the internalized string. If it already exists in
the
+ // string table, set it to forward to the existing one.
+ DisallowHeapAllocation no_gc;
+ HandleScope scope(isolate_);
+ StringTableInsertionKey key(string);
+ String* canonical = *StringTable::LookupKey(isolate_, &key);
+ string->SetForwardedInternalizedString(canonical);
+ return canonical;
+ }
} else if (obj->IsScript()) {
// Assign a new script id to avoid collision.
Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
@@ -2314,24 +2318,12 @@ void CodeSerializer::SerializeObject(HeapObject*
obj, HowToCode how_to_code,
void CodeSerializer::SerializeGeneric(HeapObject* heap_object,
HowToCode how_to_code,
WhereToPoint where_to_point) {
- int string_hash = String::kEmptyHashField;
- if (heap_object->IsString()) {
- String* string = String::cast(heap_object);
- if (string->IsInternalizedString()) num_internalized_strings_++;
- // Temporarily clear string hash.
- string_hash = string->hash_field();
- string->set_hash_field(String::kEmptyHashField);
- }
+ if (heap_object->IsInternalizedString()) num_internalized_strings_++;
// Object has not yet been serialized. Serialize it here.
ObjectSerializer serializer(this, heap_object, sink_, how_to_code,
where_to_point);
serializer.Serialize();
-
- if (string_hash != String::kEmptyHashField) {
- // Restore string hash.
- String::cast(heap_object)->set_hash_field(String::kEmptyHashField);
- }
}
Index: src/snapshot/serialize.h
diff --git a/src/snapshot/serialize.h b/src/snapshot/serialize.h
index
2a426a94f587de9e239fc87950afaec447e12f86..341338515672e98515aa315c9e2c5aa620db4b75
100644
--- a/src/snapshot/serialize.h
+++ b/src/snapshot/serialize.h
@@ -307,7 +307,7 @@ class SerializerDeserializer: public ObjectVisitor {
protected:
static bool CanBeDeferred(HeapObject* o) {
- return !o->IsInternalizedString() && !o->IsScript();
+ return !o->IsString() && !o->IsScript();
}
// ---------- byte code range 0x00..0x7f ----------
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.