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

Issue 7473028: Implement a type recording ToBoolean IC. (Closed)

Created:
9 years, 5 months ago by Sven Panne
Modified:
9 years, 5 months ago
CC:
v8-dev
Visibility:
Public.

Description

Implement a type recording ToBoolean IC. The IC records the set of types it has seen, e.g. {String} or {Boolean, Undefined}, etc. Note that in theory this could lead to a large number of different ToBoolean ICs (512, to be exact, because we distinguish 9 types), but in practice only a small handful of them are actually generated. Currently the type recording part is only implemented on ia32, other platforms continue to work like they did before, though. Removed some dead code on the way. Committed: http://code.google.com/p/v8/source/detail?r=8716

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+331 lines, -74 lines) Patch
M src/code-stubs.h View 1 chunk +45 lines, -3 lines 0 comments Download
M src/code-stubs.cc View 1 chunk +69 lines, -0 lines 2 comments Download
M src/debug.cc View 1 chunk +2 lines, -1 line 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 chunk +138 lines, -47 lines 8 comments Download
M src/ic.h View 2 chunks +11 lines, -1 line 0 comments Download
M src/ic.cc View 3 chunks +26 lines, -8 lines 0 comments Download
M src/log.cc View 1 chunk +1 line, -0 lines 0 comments Download
M src/objects.h View 5 chunks +16 lines, -12 lines 0 comments Download
M src/objects.cc View 1 chunk +1 line, -0 lines 0 comments Download
M src/objects-inl.h View 4 chunks +21 lines, -2 lines 0 comments Download
M src/spaces.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Sven Panne
9 years, 5 months ago (2011-07-21 09:35:56 UTC) #1
danno
LGTM with comments. http://codereview.chromium.org/7473028/diff/1/src/code-stubs.cc File src/code-stubs.cc (right): http://codereview.chromium.org/7473028/diff/1/src/code-stubs.cc#newcode341 src/code-stubs.cc:341: if (Contains(UNDEFINED)) stream->Add("Undefined"); Doesn't the lack ...
9 years, 5 months ago (2011-07-21 12:39:06 UTC) #2
Mads Ager (chromium)
From a very quick look it LGTM too.
9 years, 5 months ago (2011-07-21 12:52:47 UTC) #3
fschneider
DBC: http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc File src/ia32/code-stubs-ia32.cc (right): http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc#newcode346 src/ia32/code-stubs-ia32.cc:346: if (types_.Contains(INTERNAL_OBJECT)) { Can you explain why we ...
9 years, 5 months ago (2011-07-21 13:16:44 UTC) #4
Vitaly Repeshko
Drive by comment. http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc File src/ia32/code-stubs-ia32.cc (right): http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc#newcode288 src/ia32/code-stubs-ia32.cc:288: __ xor_(tos_, Operand(tos_)); The macro assembler ...
9 years, 5 months ago (2011-07-21 13:17:22 UTC) #5
Sven Panne
9 years, 5 months ago (2011-07-21 13:49:28 UTC) #6
http://codereview.chromium.org/7473028/diff/1/src/code-stubs.cc
File src/code-stubs.cc (right):

http://codereview.chromium.org/7473028/diff/1/src/code-stubs.cc#newcode341
src/code-stubs.cc:341: if (Contains(UNDEFINED)) stream->Add("Undefined");
On 2011/07/21 12:39:07, danno wrote:
> Doesn't the lack of separation between types end up in unreadable strings in
the output?

This is intended and consistent with other conversion routines. The output is
nicely readable.

http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc
File src/ia32/code-stubs-ia32.cc (right):

http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:288: __ xor_(tos_, Operand(tos_));
On 2011/07/21 13:17:23, Vitaly Repeshko wrote:
> The macro assembler has Set macro that emits the optimal instruction without
hurting readability.

I didn't know that one, thanks. :-)

http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:316: __ mov(eax, FieldOperand(eax,
String::kLengthOffset));
On 2011/07/21 12:39:07, danno wrote:
> eax -> tos_?

Ooops, fixed, same for Smi part above.

http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:346: if (types_.Contains(INTERNAL_OBJECT)) {
On 2011/07/21 13:16:44, fschneider wrote:
> Can you explain why we need the INTERNAL_OBJECT case?

While we probably can't encounter internal objects at "normal" runtime (at least
I think so), they *do* occur at v8 startup, e.g. object/function templates etc.

http://codereview.chromium.org/7473028/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:362: __ cmp(eax, value);
On 2011/07/21 12:39:07, danno wrote:
> This should be duplicated in the two if branches so that the else at the
bottom
> doesn't generate a spurious cmp.

Done.

Powered by Google App Engine
This is Rietveld 408576698