Commit 297ad1ec authored by Pan, Tao's avatar Pan, Tao Committed by Commit Bot

[serializer] Fix judgement of map changed

This CL can improve the performance of below microbench by ~40%.

// touch worker.js in shell is needed
let json_obj = ${content of v8_trace.json};
let worker = new Worker("worker.js");
let start = performance.now();
for (let i = 0; i < 1e5; i++) {
  worker.postMessage(json_obj);
}
console.log(performance.now() - start;

Change-Id: I69b40e4d7e0b49ab90c01c21c5d03b02e292d246
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2489329Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Tao Pan <tao.pan@intel.com>
Cr-Commit-Position: refs/heads/master@{#70723}
parent 62af317d
......@@ -596,7 +596,7 @@ Maybe<bool> ValueSerializer::WriteJSObject(Handle<JSObject> object) {
if (details.IsDontEnum()) continue;
Handle<Object> value;
if (V8_LIKELY(!map_changed)) map_changed = *map == object->map();
if (V8_LIKELY(!map_changed)) map_changed = *map != object->map();
if (V8_LIKELY(!map_changed && details.location() == kField)) {
DCHECK_EQ(kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment