http://codereview.chromium.org/7044100/diff/1/src/parser.cc
File src/parser.cc (right):

http://codereview.chromium.org/7044100/diff/1/src/parser.cc#newcode2559
src/parser.cc:2559: if (value == 0) {
On 2011/06/10 09:20:08, Kasper Lund wrote:
Could this be something ala:

    Handle<Object> boolean(isolate->heap()->ToBoolean(value == 0));
    return new(zone()) Literal(boolean);

or perhaps consider negating the result of calling
expression->AsLiteral()->handle()->ToBoolean() and refactoring the
code so it
works for cases where the expression is a non-numeric literal.

We already have this constant folding in void
FullCodeGenerator::TestContext::Plug(Handle<Object> lit).  It just needs
to be 'ported' to TestContext::BuildBranch(HValue* value) in
hydrogen.cc.

I would prefer that solution rather than having it here, because it can
properly cope with things like

x = 0
if (!x) ...

http://codereview.chromium.org/7044100/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to