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

Issue 2232243003: Blink-compatible serialization of oddball values. (Closed)

Created:
4 years, 4 months ago by jbroman
Modified:
4 years, 4 months ago
Reviewers:
Camillo Bruni
CC:
esprehn, jochen (gone - plz use gerrit), v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Blink-compatible serialization of oddball values. BUG=chromium:148757 Committed: https://crrev.com/e6d1a80e790117dc27b20e9b14de4b6ac9f7512f Cr-Commit-Position: refs/heads/master@{#38625}

Patch Set 1 #

Patch Set 2 : isolate version of v8::TryCatch in unit tests #

Patch Set 3 : return on all branches of VS::WO #

Patch Set 4 : static_cast in unit tests #

Total comments: 6

Patch Set 5 : Add comments explaining varints. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+447 lines, -0 lines) Patch
M BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
M src/v8.gyp View 1 chunk +2 lines, -0 lines 0 comments Download
A src/value-serializer.h View 1 chunk +101 lines, -0 lines 0 comments Download
A src/value-serializer.cc View 1 2 3 4 1 chunk +174 lines, -0 lines 0 comments Download
M test/unittests/unittests.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A test/unittests/value-serializer-unittest.cc View 1 2 3 1 chunk +167 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (21 generated)
jbroman
In the spirit of getting this ball rolling, I'd like to start landing the serialization ...
4 years, 4 months ago (2016-08-11 19:00:22 UTC) #16
Camillo Bruni
LGTM with nits https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.cc File src/value-serializer.cc (right): https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.cc#newcode63 src/value-serializer.cc:63: switch (HeapObject::cast(*object)->map()->instance_type()) { This is much ...
4 years, 4 months ago (2016-08-12 09:54:44 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2232243003/80001
4 years, 4 months ago (2016-08-12 14:27:32 UTC) #23
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 4 months ago (2016-08-12 14:49:14 UTC) #24
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/e6d1a80e790117dc27b20e9b14de4b6ac9f7512f Cr-Commit-Position: refs/heads/master@{#38625}
4 years, 4 months ago (2016-08-12 14:49:32 UTC) #26
jbroman
4 years, 4 months ago (2016-08-12 15:16:34 UTC) #27
Message was sent while issue was closed.
https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.cc
File src/value-serializer.cc (right):

https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.cc...
src/value-serializer.cc:63: switch
(HeapObject::cast(*object)->map()->instance_type()) {
On 2016/08/12 at 09:54:44, Camillo Bruni wrote:
> This is much slower than directly comparing against the heap constants (e.g.
isolate()->heap()->undefined_value() and friends).
> Given that you will have to do 4 checks (true, false, null undefined) it might
still be faster to read out the maps' instance_type.
> 
> I definitely like the code better how it is currently, but just wanted to add
the for future reference once you start optimizing ;)

I'll be branching on the instance type of all objects anyhow, so I'm not sure
whether it'll be faster to check for oddballs first separately, or just have
them go through the same switch.

For what it's worth, this is how json-stringifier does it, and I've assumed that
it's fairly optimized already.
https://chromium.googlesource.com/v8/v8/+/bbd0a09/src/json-stringifier.cc#294

Nonetheless I'll definitely keep that in mind when I later try to
micro-optimize.

https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.h
File src/value-serializer.h (right):

https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.h#...
src/value-serializer.h:55: template <typename T>
On 2016/08/12 at 09:54:44, Camillo Bruni wrote:
> nit: Could you add a comment what WriteVarint does (or add inline comments in
the function definition.

Added comments inline, with a link to the protobuf encoding page (this, and
zigzag which is used for signed integers, are encoded the same way as in
protobuf, and they have a nice page that explains it clearly).

https://codereview.chromium.org/2232243003/diff/60001/src/value-serializer.h#...
src/value-serializer.h:55: template <typename T>
On 2016/08/12 at 09:54:44, Camillo Bruni wrote:
> nit: Could you add a comment what WriteVarint does (or add inline comments in
the function definition.

Added comments inline, with a link to the protobuf encoding page (this, and
zigzag which is used for signed integers, are encoded the same way as in
protobuf, and they have a nice page that explains it clearly).

Powered by Google App Engine
This is Rietveld 408576698