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

Unified Diff: src/value-serializer.cc

Issue 2667553003: Revert of ValueSerializer: Distinguish between 'undefined' and an absent property. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | test/unittests/value-serializer-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/value-serializer.cc
diff --git a/src/value-serializer.cc b/src/value-serializer.cc
index 51fdf2212b4f2a5420fd22b7f98a9a8d4e7401cc..9dfaa4a857805abbf42a57856b86248b033a10d9 100644
--- a/src/value-serializer.cc
+++ b/src/value-serializer.cc
@@ -25,8 +25,7 @@
// Version 9: (imported from Blink)
// Version 10: one-byte (Latin-1) strings
-// Version 11: properly separate undefined from the hole in arrays
-static const uint32_t kLatestVersion = 11;
+static const uint32_t kLatestVersion = 10;
static const int kPretenureThreshold = 100 * KB;
@@ -50,7 +49,6 @@
// refTableSize:uint32_t (previously used for sanity checks; safe to ignore)
kVerifyObjectCount = '?',
// Oddballs (no data).
- kTheHole = '-',
kUndefined = '_',
kNull = '0',
kTrue = 'T',
@@ -540,6 +538,10 @@
if (should_serialize_densely) {
DCHECK_LE(length, static_cast<uint32_t>(FixedArray::kMaxLength));
+
+ // TODO(jbroman): Distinguish between undefined and a hole (this can happen
+ // if serializing one of the elements deletes another). This requires wire
+ // format changes.
WriteTag(SerializationTag::kBeginDenseJSArray);
WriteVarint<uint32_t>(length);
uint32_t i = 0;
@@ -587,13 +589,6 @@
// with.
Handle<Object> element;
LookupIterator it(isolate_, array, i, array, LookupIterator::OWN);
- if (!it.IsFound()) {
- // This can happen in the case where an array that was originally dense
- // became sparse during serialization. It's too late to switch to the
- // sparse format, but we can mark the elements as absent.
- WriteTag(SerializationTag::kTheHole);
- continue;
- }
if (!Object::GetProperty(&it).ToHandle(&element) ||
!WriteObject(element).FromMaybe(false)) {
return Nothing<bool>();
@@ -1325,20 +1320,10 @@
Handle<FixedArray> elements(FixedArray::cast(array->elements()), isolate_);
for (uint32_t i = 0; i < length; i++) {
- SerializationTag tag;
- if (PeekTag().To(&tag) && tag == SerializationTag::kTheHole) {
- ConsumeTag(SerializationTag::kTheHole);
- continue;
- }
-
Handle<Object> element;
if (!ReadObject().ToHandle(&element)) return MaybeHandle<JSArray>();
-
- // Serialization versions less than 11 encode the hole the same as
- // undefined. For consistency with previous behavior, store these as the
- // hole. Past version 11, undefined means undefined.
- if (version_ < 11 && element->IsUndefined(isolate_)) continue;
-
+ // TODO(jbroman): Distinguish between undefined and a hole.
+ if (element->IsUndefined(isolate_)) continue;
elements->set(i, *element);
}
« no previous file with comments | « no previous file | test/unittests/value-serializer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698