Ignore:
Timestamp:
Oct 1, 2009, 4:32:48 PM (16 years ago)
Author:
[email protected]
Message:

Take one branch instead of two to test for JSValue().

Patch by Geoffrey Garen <[email protected]> on 2009-10-01
Reviewed by Sam Weinig.

1.1% SunSpider speedup.

  • jit/JITCall.cpp:

(JSC::JIT::compileOpCall):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_to_jsnumber):
(JSC::JIT::emit_op_create_arguments):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead
of testing for the cell tag with a 0 payload.

  • runtime/JSValue.cpp:

(JSC::JSValue::description): Added support for dumping the new empty value,
and deleted values, in debug builds.

  • runtime/JSValue.h:

(JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag.

(JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value
tag, to avoid having two different c++ versions of null / empty.

(JSC::JSValue::operator bool): Test for the empty value tag, instead
of testing for the cell tag with a 0 payload.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSValue.h

    r48068 r49004  
    214214        enum { NullTag =         0xfffffffb };
    215215        enum { UndefinedTag =    0xfffffffa };
    216         enum { DeletedValueTag = 0xfffffff9 };
     216        enum { EmptyValueTag =   0xfffffff9 };
     217        enum { DeletedValueTag = 0xfffffff8 };
    217218
    218219        enum { LowestTag =  DeletedValueTag };
     
    428429    inline JSValue::JSValue()
    429430    {
    430         u.asBits.tag = CellTag;
     431        u.asBits.tag = EmptyValueTag;
    431432        u.asBits.payload = 0;
    432433    }
     
    464465    inline JSValue::JSValue(JSCell* ptr)
    465466    {
    466         u.asBits.tag = CellTag;
     467        if (ptr)
     468            u.asBits.tag = CellTag;
     469        else
     470            u.asBits.tag = EmptyValueTag;
    467471        u.asBits.payload = reinterpret_cast<int32_t>(ptr);
    468472    }
     
    470474    inline JSValue::JSValue(const JSCell* ptr)
    471475    {
    472         u.asBits.tag = CellTag;
     476        if (ptr)
     477            u.asBits.tag = CellTag;
     478        else
     479            u.asBits.tag = EmptyValueTag;
    473480        u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
    474481    }
     
    476483    inline JSValue::operator bool() const
    477484    {
    478         return u.asBits.payload || tag() != CellTag;
     485        ASSERT(tag() != DeletedValueTag);
     486        return tag() != EmptyValueTag;
    479487    }
    480488
Note: See TracChangeset for help on using the changeset viewer.